JSN-SR04T long range ultrasonic wange finder Mininmum Range

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

How did you get on with this? I've just bought one myself (currently waiting for it to arrive). Have you considered the time between ping and echo to be the cause of the issue?

Any news about this issue? I was planning to use this kind of ultrasonic sensor since they are waterproof, but i need smaller minimum detection range (about 2cm) like HC-SR04. Is there any way to reduce minimumdetection range?

Regards

Because the sensor uses the same transducer to both create the sound and listen, it needs time to switch from one mode to the other. This is probably why the sensor can't measure below 20cm but a HC-SR04 can because it has a separate emitter and receiver.

I just ordered a JSN-SR04T, but being from China I may not have it for a month. Once I get it, I can see if there's some way to be more reliable at close distance.

One sure way is to place the sensor in such a position where it could never be closer than 20cm. For example, if it was on a car, it would need to be 20cm from the front. That may not work for your project, but it would technically work if the sensor could be positioned that way.

Anyway, I'll do some testing once I get the sensor.

Tim, author of NewPing

Recieved the JSN-SR04T for testing and it's a great sensor. Works really well with NewPing as well. However, the 20cm minimum distance can be a real problem. I tested it out and it just doesn't have enough time to switch between generating the ultrasonic ping and listening to the echo. My library can't fix the <20cm problem because on the software side you have no way of knowing if the ping was really <20 or 200cm (or whatever seemingly random distance) it reports sometimes. What makes things worse is that the sensor is designed to be mounted. So, echos between the surface the sensor is mounted to and the object you're trying to measure the distance from can create bogus distances.

Anyway, if you want to use the JSN-SR04T sensor you'll need to make sure it's mounted in such a way where <20cm isn't possible. Too bad, because everything else works really well.

Tim

Unfortunately i cannot put the sensor back 20cm.

I was wondering... is it possible to grab a non waterproof sensor like HC-SR04 (or equivalent like US-100 or SRF-06) and change the transducers for waterproof ones like these? 5pcs Hosiden Huc1002 Electret Condenser Mic Capsule Microphone Cartridge for sale online | eBay

geologic:
Unfortunately i cannot put the sensor back 20cm.

I was wondering... is it possible to grab a non waterproof sensor like HC-SR04 (or equivalent like US-100 or SRF-06) and change the transducers for waterproof ones like these? 5pcs Hosiden Huc1002 Electret Condenser Mic Capsule Microphone Cartridge for sale online | eBay

I would highly doubt that the sensors are interchangeable. Even if electronically they would be compatible, the rest of the hardware is designed and calibrated to a specific sensor.

If 20cm back doesn't work, what about a 20cm tube with a right angle to reflect the sound? The performance wouldn't be quite as good, but it would allow for creative mounting positions. Maybe if you could describe your mounting limitations a solution could be pieced together.

The only other solution is to get with the manufacture and see if a two sensor device could be created. One that had an echo transmitter and a ping receiver. I believe the 20cm minimum and the strange readings inside that are due to the sensor both transmitting and listening.

Tim

I'm using the ultrasonic sensor to measure an empt/full tank, the sensor is placed on top of the tank in a little box with a solar panel, the solar panel is outside, the sensor is inside. It is not praticle to move up the sensor 20 cm since the box will be much exposed.

Regards

geologic:
I'm using the ultrasonic sensor to measure an empt/full tank, the sensor is placed on top of the tank in a little box with a solar panel, the solar panel is outside, the sensor is inside. It is not praticle to move up the sensor 20 cm since the box will be much exposed.

Regards

What about moving the sensor left or right along the tank, not up. Then, installing a 45 degree acoustic reflector into the tank?

Also, how deep is the tank when empty? Will the tank really be so full the surface will reach the top of the tank? What I'm getting at here is that if we could better understand your situation a solution may become available.

Tim

I want to avoid moving sensor to the side, since my solar panel need to stay on top. That way i need exposed wires to connect sensors to power and extra stuff like reflectors. Sitting everything on top makes a more robust solution since i can put everything inside one box.

My tank is about 2,5m and my sensor box is about 5cm tall, so i loose about 2% of the total measure. With JSN-SR04T i have a blind distance of 20+5cm so i loose 10% ot the total measure.

I really don't need a waterproof sensor, just weatherproof. My tank will be filled with solids, not water, but i found some moisture inside the box, because HC-SR-04 is not sealed or waterproof.

I searched a lot and didn't find any cheap waterproof sensor with 2 transducers. There are some but very expensive.

geologic:
I want to avoid moving sensor to the side, since my solar panel need to stay on top. That way i need exposed wires to connect sensors to power and extra stuff like reflectors. Sitting everything on top makes a more robust solution since i can put everything inside one box.

My tank is about 2,5m and my sensor box is about 5cm tall, so i loose about 2% of the total measure. With JSN-SR04T i have a blind distance of 20+5cm so i loose 10% ot the total measure.

I really don't need a waterproof sensor, just weatherproof. My tank will be filled with solids, not water, but i found some moisture inside the box, because HC-SR-04 is not sealed or waterproof.

I searched a lot and didn't find any cheap waterproof sensor with 2 transducers. There are some but very expensive.

I have a solution. It seems that when this sensor is closer than 20cm, the readings are all over the place. It's almost random.

Since you don't need very quick measurements, how about taking something like 10 readings rapidly (would take about a half second). Calculate the average from these 10 readings, and then compare the average to the 10 readings. If all readings are within 1cm, the reading can be assumed correct. If the 10 readings are not within 1cm of the average, you know that you're within 20cm and you can proceed accordingly. This way, you would absolutely know it was at the "full" point, even if it was much closer than 20cm.

If the fill rate could be more than 1cm in a half second, you would just need to change the range you're looking for to 2cm or whatever instead of just 1cm.

If you were trying to use this sensor for a possibly faster moving object (like in a backup sensor for a car), you would probably need to only take 2 or 3 readings and make the possible range of the readings over a larger area, say maybe 5 or 10cm.

If you need some assistance on the code, let us know.

Tim

1 Like

Good point, doesn't solve the 20cm blind zone but at least we know that we are inside that zone.
I think i'll give a try, loosing 20cm of the capacity is better than a dead system caused by moisture corrosion.

Just another question: there are models with temperature compensation (US-100 or SRF-06), but JSN-SR04T doesn't have it. Do you think is a big issue?

Thanks Tim for your efford.

geologic:
Good point, doesn't solve the 20cm blind zone but at least we know that we are inside that zone.
I think i'll give a try, loosing 20cm of the capacity is better than a dead system caused by moisture corrosion.

Just another question: there are models with temperature compensation (US-100 or SRF-06), but JSN-SR04T doesn't have it. Do you think is a big issue?

Thanks Tim for your efford.

Also, before you needed to keep at least 25cm clearance to be sure it didn't go below 20. With this technique, you can go below 20cm as readings at 19cm become random and detected with the stated technique. So, instead of 25cm of head space, you'll have closer to 19cm or less.

Sure, not quite full, but better. Also, if you know your fill rate you could put a timer on it. For example, when you sense it's below 19cm, you would close the filling 1 minute later. It would then wait till the readings were at a certain amount before the filling would resume.

Not sure what kind of fill rate to have to know if this is helpful.

Tim

teckel:
Since you don't need very quick measurements, how about taking something like 10 readings rapidly (would take about a half second). Calculate the average from these 10 readings, and then compare the average to the 10 readings. If all readings are within 1cm, the reading can be assumed correct. If the 10 readings are not within 1cm of the average, you know that you're within 20cm and you can proceed accordingly.

The average of ten bogus readings could/would occasionally agree with the last reading.

It seems like a more reliable way for checking for bogus returns would be to check the range between the maximum returned value and the minimum returned value. If this range is more than few centimeters, it's probably safe to assume the readings are bad.

DuaneDegn:
The average of ten bogus readings could/would occasionally agree with the last reading.

It seems like a more reliable way for checking for bogus returns would be to check the range between the maximum returned value and the minimum returned value. If this range is more than few centimeters, it's probably safe to assume the readings are bad.

You're not thinking of the same logic. I'm talking about doing 10 pings, averaging those, then making sure that ALL 10 match that average. Your second paragraph is exactly what I proposed. As I said, if you have a problem coding it, I could assist.

Tim

teckel:
You're not thinking of the same logic. I'm talking about doing 10 pings, averaging those, then making sure that ALL 10 match that average. Your second paragraph is exactly what I proposed. As I said, if you have a problem coding it, I could assist.

Tim

Ah yes, you said "compare the average to the 10 readings". I didn't read what you wrote carefully enough. My apologies. Thanks for the clarification.

DuaneDegn:
Ah yes, you said "compare the average to the 10 readings". I didn't read what you wrote carefully enough. My apologies. Thanks for the clarification.

Further, you could make some realistic assumptions. For example, from one set of readings to the next it can't change by 20cm. So, by keeping the last maybe 20 sets of readings in an array, you could compare the current results to the last 20 sets. Basically, you want to prevent it from being full and then right away being 20% full and allow more to fill the tank. It should go from <20cm to maybe 21 or 22cm, maybe even 25cm just to be sure. If it goes straight to 50cm, you know there's something wrong with the result.

Basically, you should be doing some kind of multiple pings and averaging with a project like this. My ping_median() would normally be prefect, but with the JSN-SR04T sensor using ping_median() won't work so you need to do it on your own. Then, you need to do other types of precautionary calculations based on your project. Knowing how quickly the tank can fill or drain will allow you to throw out erroneous results.

Tim

hi, i have the jsn sr04t sensor, but when i test it, i cant find which part the module is actually using to sense object, i cover all the dicrection of the sensor, it still got some reading, even i din connect the probe, it still have reading. do u guys know hw to use this sensor? tq

kikilum:
hi, i have the jsn sr04t sensor, but when i test it, i cant find which part the module is actually using to sense object, i cover all the dicrection of the sensor, it still got some reading, even i din connect the probe, it still have reading. do u guys know hw to use this sensor? tq

The round black thingy is the sensor.

Tim

can this sensor sense object underwater? once i put into the water , the reading show 20cm no matter hw deep i go in