The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 24, 2024, 06:31:47 18:31


Login with username, password and session length


Pages: [1]
Print
Author Topic: JSN-SR04T long range ultrasonic wange finder Mininmum Range  (Read 7659 times)
0 Members and 1 Guest are viewing this topic.
snowman
Junior Member
**
Offline Offline

Posts: 78

Thank You
-Given: 181
-Receive: 53


« on: July 31, 2015, 02:36:47 14:36 »

Hi,
I'm using arduino mega2560, JSN-SR04T and newping 1.5 library. code is pretty simple, I'm using example code comes with newping library. I'm testing with only one sensor  and its working. there's some difference between measured one and real but its tolerable.

Problem is, JSN-SR04T has a minimum measuring range which is about 20cm. Below that values come from device not consistent. when you move sensor close to wall less than 20cm, value goes crazy. it measure 20, 15, 60, 200 and every possible nonsense. I was expecting that some stable values would return like 99999, -1 or zero that says "I cannot measure anymore".  or at leased it would stuck at 20cm even its closer.

Okay, once my measurement goes under 25cm I can set a value, no problem. I can trigger the relay. but if sensor gets closer to the wall, I read some higher values like 60cm so my application thinks that sensor is moved away and will release the relay. but actually its not. it gets more closer.

have anyone faced this problem ? I forked the newping library but if I could not get any solution. I tried to read echotime, not calculated measurement units (like cm or inch) and I discovered that the information comes from sensor is not correct in close ranges. I even tried to use ArduinoUno, classic ping library, one wire configuration, 2 wire configuration.... I tried another same model sensor to understand if there's a malfunction.

I selected this sensor because its waterproof and satisfies IP66 standards. If you cannot imagine a solution maybe you can suggest another ultrasonic sensor for outdoor.

I even can use HC-SR04 models but unfortunately they are not IP66.


any help would be great.
best
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4668

Thank You
-Given: 834
-Receive: 4322


There is no evidence that I muted SoNsIvRi


« Reply #1 on: July 31, 2015, 04:03:21 16:03 »

What is your target?

you do know if less than 25cm the transmitted signal can't be returned to the receiver your getting an echo signal.
maybe you can set an offset in your code...
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
CocaCola
Senior Member
****
Offline Offline

Posts: 482

Thank You
-Given: 169
-Receive: 232



« Reply #2 on: July 31, 2015, 07:30:18 19:30 »

You could formulate a error trap in the code...

Something along these lines...

Take a burst of say five readings and compare them to each other, if they vary wildly and/or don't show it's moving closer or away (obvious patterns) it's safe to assume you are too close to the object...

Of course this is not the best solution but it should work OK in basic collision detection applications...  If you need precise distance you will need different and/or more sensors...

Also what is the use?  I'm going to assume a robot?  If the sensor can't detect below 25cm a dead simple solution is to mount the sensor offset back 26cm from the front surface and presto problem solved...  In this case now when the robot is 1cm away from the wall you will get a 27cm reading, it will never be below the minimum range, just subtract 26 from the reading to get actual...
« Last Edit: August 01, 2015, 02:27:43 02:27 by CocaCola » Logged
snowman
Junior Member
**
Offline Offline

Posts: 78

Thank You
-Given: 181
-Receive: 53


« Reply #3 on: August 01, 2015, 08:53:54 08:53 »

Application aims to stop a moving basket of firetruck before it hits something in front or bottom. there are 4 sensors at the bottom and 2 at the front.

I get mathematical average of 2 sensors in front and another average for 4 sensors in bottom. then I trigger a relay if one of average distance less tan 25cm. it can be 30cm. its not too much critical.

but you know, CocaCola's idea looks great. place the sensors back !... Clever guy. we and my friend are working on this for 2 days and never came up with this simple and useful idea. we'll discuss that. however as basket is metal it can be a problem. sensors have 30 degrees view angle and we need to experiment this because when we try to install them with offset there will be some metal stuff around it.

anyway I'll post the results here.

thanks..
Logged
gan_canny
Junior Member
**
Offline Offline

Posts: 89

Thank You
-Given: 101
-Receive: 26


« Reply #4 on: August 01, 2015, 02:32:54 14:32 »

There are 3 states.
1) the basket is increasing its distance from echoing surfaces
2) the basket is approaching echoing surfaces
3) it is too close to measure.
If samples are taken periodically over time and stored the 3 states can be distinguished. A velocity can be computed and an estimated position of the next sample can be determined and compared to the actual sample. The period would be such that the basket couldn't travel even at maximum speed more than a few centimeters between samples.
Logged
CocaCola
Senior Member
****
Offline Offline

Posts: 482

Thank You
-Given: 169
-Receive: 232



« Reply #5 on: August 01, 2015, 08:34:06 20:34 »

There are 3 states.
1) the basket is increasing its distance from echoing surfaces
2) the basket is approaching echoing surfaces
3) it is too close to measure.
If samples are taken periodically over time and stored the 3 states can be distinguished. A velocity can be computed and an estimated position of the next sample can be determined and compared to the actual sample. The period would be such that the basket couldn't travel even at maximum speed more than a few centimeters between samples.

Yep, that is what I implied as far as a error trap code, but you went into much more detail...

Quote
however as basket is metal it can be a problem. sensors have 30 degrees view angle

You would need to experiment, but I doubt you will see much if any bounce back from the vertical bottom of the bucket, if you do simply rotate the sensor downward a bit and use triangulation to adjust for actual distance if it skews the numbers that bad...  I have played with these types of sensors on a desktop and can't say I recall false readings due to the desktop aka vertical surface...
« Last Edit: August 01, 2015, 08:38:48 20:38 by CocaCola » Logged
snowman
Junior Member
**
Offline Offline

Posts: 78

Thank You
-Given: 181
-Receive: 53


« Reply #6 on: August 02, 2015, 07:27:50 19:27 »

Hi friends,

I'm happy with CocaCola's solution. Installing sensors with offset solved the problem. apparently did not effect the sensitivity nor maximum measurable range though there's hard surface one side of sensor.

These sensors are not very good in close ranges. So there's no way other than experimenting and adapting your code to sensor.

I also want to note that 6 ultrasonic sensors plus 4x20 LCD is too much for Arduino Mega. At least to me. I have temperature, humidity, wind speed and elctrostatic sensors too. Especially Temp/humidity sensor is too slow. I noticed that there's something wrong with whole device when I drive LCD. When I commented LCD routines it was working fine. I think LCD routines takes too much time and sensors routines (especially ultrasonic ones) missing some reads. So I used another ArduinoUno to use slow temperature sensor and drive LCD. I used softwareserial library. worked like a charm. this is most elegant solution for me.

To anyone have unexpected measurements I can recommend to look into LCD routines. maybe thats why they invented something called "graphic card" Smiley

thanks for your help.
best.

Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC