💬 Distance Sensor
-
@zboblamont thanks for putting more thoughts into this for me!
As I'm just an motivated hobbyist (far from being expert in electronics), I've tried to switch the pro mini to a nano, in a hope that keeps me from dealing with the relay (new to me). My thought was that the 5V it provides should mitigate the issue - looks like it doesn't. So if the readings aren't getting more consistent with the 5V Nano, what else could be the issue? -
@zboblamont thanks for putting more thoughts into this for me!
As I'm just an motivated hobbyist (far from being expert in electronics), I've tried to switch the pro mini to a nano, in a hope that keeps me from dealing with the relay (new to me). My thought was that the 5V it provides should mitigate the issue - looks like it doesn't. So if the readings aren't getting more consistent with the 5V Nano, what else could be the issue?@jjk Hey, no expertise here either, hobbyist also, I am just old school measure thrice cut once. To be clear, I am fixed on a low voltage node so the relay gives the US board a solid and separate 5v, as I read that some of these are power sensitive, and some folks had problems powering them from an Arduino. The US trigger is supposedly ok at 3v, I only need to voltage divide the signal to the Mini. But that is my scenario, low power reliability.
In your situation, I would restore everything to completely original in a test space, use separate supplies and run checks. If the board is faulty the inconsistencies should still be there. If not, introduce each variable methodically to identify the cause.
-
@zboblamont thanks and yes, that's exactly what I doing... I have take. everything down and will look into a detailed test setup over the weekend. Will post any findings ;)
-
o.k. here's an update for those who are interested...
I have completely take down the components and resembled the setup in a test environment with a newly created prototype pcb. It works as expected - kind of. What I found is that the SR04 seems to be very sensitive to weak electrical connections. At first, I had a similar effect of inconsistent readings in the test and was about to conclude that there must be a piece of hardware at fault. Then I found a cable poorly soldered to the pcb and after fixing that, voila, the readings were consistent over 50 or so samples.
Another source of headache is probably that I have used pin headers to easily connect/exchange the components and my observation is that there, too seems to be a certain sensitivity in "quality of craftsmanship". After about half day of running the test setup, I got unable to read errors from a DHT22 that is also attached to the node. I inspected everything and it looked good, but only after pushing firmly of the Nano (that looked like it was perfectly sitting in it's header), the readings came back o.k.
Now trying to figure out how to bring that into the outside world where eventually I will have to deal with temperature changes that I suspect might further contribute to the issue... -
o.k. here's an update for those who are interested...
I have completely take down the components and resembled the setup in a test environment with a newly created prototype pcb. It works as expected - kind of. What I found is that the SR04 seems to be very sensitive to weak electrical connections. At first, I had a similar effect of inconsistent readings in the test and was about to conclude that there must be a piece of hardware at fault. Then I found a cable poorly soldered to the pcb and after fixing that, voila, the readings were consistent over 50 or so samples.
Another source of headache is probably that I have used pin headers to easily connect/exchange the components and my observation is that there, too seems to be a certain sensitivity in "quality of craftsmanship". After about half day of running the test setup, I got unable to read errors from a DHT22 that is also attached to the node. I inspected everything and it looked good, but only after pushing firmly of the Nano (that looked like it was perfectly sitting in it's header), the readings came back o.k.
Now trying to figure out how to bring that into the outside world where eventually I will have to deal with temperature changes that I suspect might further contribute to the issue...@jjk @jjk Well, at least the issue is resolved, annoying but at least you found it. I thought these boards had some temperature compensation incorporated, but unless the distance is critical it should not cause dramatic shifts anyway.
Out of curiosity, I have seen these particular devices described as JSN-SR04T and DYP-ME007Y, and I note on another thread that a JSN-SR04T-2.0 version which was otherwise identical but would not respond as expected. What is the type you are using? -
@zboblamont the temperature issue I'm expecting is mainly wrt the electrical connections and the components sitting tightly (or not) in the pin headers. However, I guess only time will tell whether or not that becomes an issue ;) The SR04 is labeled "HC-SR04" and I got it from Amazon. The accuracy is "ok", I'd say. I did some reference measurements with a tape measure and below 1m the sensor returned consistently correct readings. Beginning at about 1.5-2m the readings occasionally would fluctuate by +/- 1cm, but on average it is o.k. As I intend to use it as a "general level indicator" in my grey water tank that's good enough for me - if I get it to work properly.
-
@zboblamont the temperature issue I'm expecting is mainly wrt the electrical connections and the components sitting tightly (or not) in the pin headers. However, I guess only time will tell whether or not that becomes an issue ;) The SR04 is labeled "HC-SR04" and I got it from Amazon. The accuracy is "ok", I'd say. I did some reference measurements with a tape measure and below 1m the sensor returned consistently correct readings. Beginning at about 1.5-2m the readings occasionally would fluctuate by +/- 1cm, but on average it is o.k. As I intend to use it as a "general level indicator" in my grey water tank that's good enough for me - if I get it to work properly.
@jjk said in 💬 Distance Sensor:
HC-SR04
Ooops, my apologies, the thread began with the JSN, I didn't pick up on you were referring to the HC until now and I read back.
I was looking to deploy ultrasonics in a sewage holding tank and a raw water storage tank and looked at these devices, but had misgivings over the high humidity and -20 winters here with the dual sensor and PCB. It is stated that the membranes of the transducer are waterproof, so if you can seal the PCB and connectors they should work fine.There are already two types turn up for the JSN type single transducer, one PCB mounted the other on a long cable, per link text . Now it seems there is a version 2.0 which is not work as per the original, so putting ordering on hold until this is resolved or the exact version is known to the supplier.
Will be interesting to see if you get it to work reliably in your scenario.
-
@zboblamont lol, yeah that can happen with all the wonderful acronyms we have to deal with :)
I had played with a JSN-SR04T (cable version) a while ago, but was very disappointed with accuracy and consistency, which also seems to be in line with most online ratings. So I switched to the HC-SR04 which worked well in another (indoor) setup. I'm not sure how that sensor will do in the water tank, but since it will always be at least 1m above the water level, I'm hoping it'll do o.k. - Will report once I got it working and then how it does over time... -
o.k. folks, here's another update. Thanks to a number of rainy days, I have worked on the setup in my lab environment, even got myself a fritzing pcb to make things a bit more stable. Indoors, with a new sensor, things worked out o.k., the readings were stable. With the sun back in our area, brought everything out to the tank. First finding: I proved the sensor that was still out there was faulty! Now everything is installed, readings are transmitted every 15 minutes. That's the good news. The bad news is, the readings are again not consistent! The following is a list of the last 20 or so readings:
120
86
82
84
85
67
0
82
85
80
84
126
84
85
0
85
84
60
85
51
82I'd be happy with the "around 85cm" readings, but the other ones really bug me. Anyone has a clue what can cause that? Has anyone ever experienced something similar?
-
o.k. folks, here's another update. Thanks to a number of rainy days, I have worked on the setup in my lab environment, even got myself a fritzing pcb to make things a bit more stable. Indoors, with a new sensor, things worked out o.k., the readings were stable. With the sun back in our area, brought everything out to the tank. First finding: I proved the sensor that was still out there was faulty! Now everything is installed, readings are transmitted every 15 minutes. That's the good news. The bad news is, the readings are again not consistent! The following is a list of the last 20 or so readings:
120
86
82
84
85
67
0
82
85
80
84
126
84
85
0
85
84
60
85
51
82I'd be happy with the "around 85cm" readings, but the other ones really bug me. Anyone has a clue what can cause that? Has anyone ever experienced something similar?
@jjk Possible echoes confusing the flight time, possibly moisture buildup on the grille?
For echo minimisation, it largely depends on where it is mounted relative to sidewalls or other objects which can give different flight times relative to the surface to be measured. In the water industry US sensors are frequently blinded to scatter effects by mounting on a tube through which the transducer sounds etc.. -
@zboblamont thanks for the thoughts! I think I can rule out moisture build up as the effect started right after everything was installed. The confusing echos might be a lead?! I though I had made sure the sensor is over an area with no other objects around, but... I will see if I can test that by attaching some sort of tubing and report back when it's done
-
@zboblamont thanks for the thoughts! I think I can rule out moisture build up as the effect started right after everything was installed. The confusing echos might be a lead?! I though I had made sure the sensor is over an area with no other objects around, but... I will see if I can test that by attaching some sort of tubing and report back when it's done
@jjk Fair enough. If you try relatively snug fitting tubes in the dry at say the same length as the dead zone at least you can check if it still works ok before trying on the tank. In theory all you are doing is limiting the angles of the return path. It's a puzzle....
-
@gohan that's what I'm doing already, I even disregard the "zero" readings and am looking into algorithms to eliminate runaway values. But frankly, that's not how it's supposed to work and you never know when the readings start becoming random, so the trust level is pretty low...
@zboblamont I've tried a tube (one around the whole sensor for now) and that didn't change a thing, I'm afraid. I did notice, though, that there was quite a bit condesnsation on the box that I placed the sensor in, so maybe your thought about moisture build-up has a hang to it after all... Not sure, yet, how to deal with that, though... -
o.k. folks, here's another update. Thanks to a number of rainy days, I have worked on the setup in my lab environment, even got myself a fritzing pcb to make things a bit more stable. Indoors, with a new sensor, things worked out o.k., the readings were stable. With the sun back in our area, brought everything out to the tank. First finding: I proved the sensor that was still out there was faulty! Now everything is installed, readings are transmitted every 15 minutes. That's the good news. The bad news is, the readings are again not consistent! The following is a list of the last 20 or so readings:
120
86
82
84
85
67
0
82
85
80
84
126
84
85
0
85
84
60
85
51
82I'd be happy with the "around 85cm" readings, but the other ones really bug me. Anyone has a clue what can cause that? Has anyone ever experienced something similar?
@jjk said in 💬 Distance Sensor:
I'd be happy with the "around 85cm" readings, but the other ones really bug me. Anyone has a clue what can cause that? Has anyone ever experienced something similar?
You may need to run a waterproof ultrasonic sensor as condensation inside the tank will probably affect unsealed units. I have found the DYP-ME007 units work well for tank sensors.
Power supply is critical for the ultrasonic sensor. In testing i could only get stable readings from the DYP out to just over 1m when the circuit was running from my computer usb port. When i ran the same from a stable 5v supply it all worked as it should.
The two best filtering methods for ultrasonic sensor are to:
A: check for a number of identical readings in a row before transmitting the reading or
B: use median filtering to obtain a stable reading
if you are using the newping library it has median filtering built in and is very easy to use. See the sketch in my tank sensor project to see how. -
@Boots33 thanks for your detailed response! Is the DYP-ME007 the same as the JSN-SR04? As my experience with the latter is not too exciting... Anyways, I might as well give it another try! Also, thanks for the lead to your project and the median filtering in newping. I will definitely look into that and might just have to increase the number of readings the node takes and than filter for a transmission every 15 mins or so.
-
@Boots33 thanks for your detailed response! Is the DYP-ME007 the same as the JSN-SR04? As my experience with the latter is not too exciting... Anyways, I might as well give it another try! Also, thanks for the lead to your project and the median filtering in newping. I will definitely look into that and might just have to increase the number of readings the node takes and than filter for a transmission every 15 mins or so.
@jjk said in 💬 Distance Sensor:
Is the DYP-ME007 the same as the JSN-SR04
They certainly look the same but not sure if they are identical. definitely check on the power, i went around in circles for a while and was nearly ready to give up on the DYP until i found they are very fussy on voltage. at 4.7v I could not get mine to be stable over 1.2m yet it was still rock solid under 1.2m.... nearly drove me crazy :)
-
@Boots33 o.k. that's good advice! I just ordered some DYP and they have a bit of a lead time, that gives me time to think about getting an extra and stable 5V to the sensor.
@jjk The JSN-SR04 looks very similar to the DYP-ME007 sensor, but what I found even more confusing is that there is a direct board mounted single transducer type advertised under the same type number for both models numbers when you do a search. As Boots33 has said and not the first to say it, these seem very voltage 'fussy'. I was about to order a JSN-SR04T variety to test out when I spotted this exchange. If you still have the JSN version would it not be worth trialling with a beefier supply as a test? I am most curious if this a case of voltage/current rather than faulty device.
I would suggest a 5v booster in your own scenario running off two AAs, they are cheap enough these days... -
@zboblamont, excellent idea, but unfortunately my previous tries with the JSN-SR04T were in a "previous life" of arduino experimenting quite a while ago and at the time, I dumped pretty much most of it (I hate to say, the JSN failures were one if the reasons...). That said, I have ordered some DYP and will give it another try. The tips you and @Boots33 have provided should get me much farer than last time ;) The key information I guess I was missing at the time was the sensitivity to voltage.
On another note... has anyone played around with alternative ways to measure water level, like a pressure tube or so? I'd be interested to see if that's an easier way, maybe?!