Was thinking of implementing something similar with ESP-home. Re the weatherproof sensor that has been used, I am wondering if this is the same sort of thing and/or would it work with esp-home?
Can’t say I’ve found this successful. Sensor seems to under report distance. Sensor reads 0.23m where the actual distance is 0.5m. Randomly reports 0.23m when the actual distance is 1.8m. Adjusting the potentiometer doesn’t seem to have any effect.
I swapped the pins to GPIO’s 1 & 3 as per the original post. Seems much more stable now.
Checking the logs, there is one thing I’m curious about. I get a time outs from ultrasonic.sensor:026 while I receive correct reports from ultrasonic.sensor:030. Not sure why I have two sensors when there is only one specified in the config. Here’s a log extract.
[10:37:12][D][ultrasonic.sensor:026]: 'Tank Level' - Distance measurement timed out!
[10:37:17][D][ultrasonic.sensor:030]: 'Tank Level' - Got distance: 1.78 m
[10:37:17][D][sensor:131]: 'Tank Level': Sending state 1.77708 m with 1 decimals of accuracy
[10:37:22][D][ultrasonic.sensor:026]: 'Tank Level' - Distance measurement timed out!
[10:37:27][D][ultrasonic.sensor:030]: 'Tank Level' - Got distance: 1.78 m
[10:37:27][D][sensor:131]: 'Tank Level': Sending state 1.78103 m with 1 decimals of accuracy
[10:37:32][D][ultrasonic.sensor:030]: 'Tank Level' - Got distance: 1.78 m
Can anyone shed some light on this?
Still reports 0.23m randomly for some reason though…
Did you get the timeout issue resolved? By default the pulse time used for Ultrasonic sensors is 10usec whereas these sensors need 20usec (from the spec sheets). I changed this parameter plus the timeout parameter (default is 2.0m), but I was getting erroneous readings with the HC-SR04 above 1.80m.
No timeout errors since I made these changes months ago. Still to resolve in code the random readings I get when it’s actually raining (so the water surface is rippled) which really mess up the charts (negative levels and percentages creep in), and temperature stabilisation (tank level inflates a few percent through the day as it gets warmer).
Thanks, I didn’t know about the pulse time though it is in the docs I didn’t think to try it. I’ll give that try. Thanks for that. My tank is way smaller that 1.8m.
After a month of stable operations (still to resolve temperature-based variations, and stable readings when it’s raining), my level sensor started playing up two weeks ago - often reading a distance greater than the height of my tank, frequent time-outs, etc. I figured I had a moisture or corrosion problem, but after replacing the Wemos D1 mini and the sensor board and sensors…same problem!
My fix? Upgrade ESPHome and HASSOS to current versions. I was running 2021.08 versions, not on 2021.10 and everything seems good.
I’m using the JSN-SR20 (samre as HC-SR04 with 2x waterproof sensors), it has a much better range than the JSN-SR20:
I do multiple readings / calls presently, to return other calculations for litres and %full. I’d guess there’s an easier (smarter!) way to do this but I’m learning as i go!
Right now in the winter my pit is almost completely empty there is a little bit of water down there. The sensor however is reporting in that the pit is at 80%. I’ve drilled 2 different holes into the lid of my pit to try and figure out if maybe the sensor was hitting off of something else in there but I don’t think thats the case. I live in the US but I converted all of my measurements over to metric for this. My pit is actually 76.2CM deep but I knocked off the decimal and I figure that the exclusion distance is about 10CM which is about the highest level I’d ever like my water to get in that pit anyways. If it ever got above 70% I’d be worried. Thank you all in advance for your help with this.
And, have you confirmed that the distance measurement is working in prinicple? For example tried the sensor outside of your pit just against a wall? And if installed in the top of the pit, is the distance measured correctly in metres (i.e. without that lambda conversion)?
Please note that the sensor is still returning the actual distance, it just can’t measure correctly if the distance is outside its operating range, so in your case you would expect values up to ~0.76 metres.
You could then simplify the lambda:
Yeah I sit here at my desk with it and point it at various things in my office
So I took your code and its now returning that its 70% full which is still not right so I’m still poking around at it trying to determine what its issue is. Thank you for your help this.
ok so I think I figured out my issue. The minimum reading for the sensor is 23cm and with my tank being 76cm deep I think that I’ll either need to change over to the other ultrasonic sensors or see if there is some tweaks I can make to my formula to get a better reading.
EDIT: This is what happens when I work until some odd hour in the morning and my mind isn’t firing on all cylinders. The min reading has nothing to do with my tank depth ugh.
So still attempting to tinker with settings for this thing but its still reporting in that the measurement is 0.23m regardless of where I put the sensor inside of the pit. I’ve tried to lower it down to see if it would change, I’ve held it above the pit and that changes the value but there is something that is causing it to report 0.23m once its placed inside the tank regardless of where its at.