Freshwater tank levels

I'm not sure if this is the right place to ask this, but how do you measure your tank levels? For plastic tanks, I've read about capacitive and ultrasound sensors (i would like to avoid to create a hole in the tank), but since i don't do well with electronics, I'm quite confused. Is there any ready-to-go kit or anything like that? Once i have something that i can plug to my rpi5, no matter if nmea, i2c, 1w... I can handle.
12 Replies
Tony
Tony4w ago
Capacitive sensors only provide a yes/no value so you would need to add multiple if you want to see some rough percent. Kus linear resistance sensors are more straightforward because the resistance translates to voltage which can be converted to a curve to get a percent. They are pretty straightforward to use but require a hole since it uses a float that needs a fixed mount inside of the tank. Probably your best bet for accuracy. Capacitive would work but it would only be useful if you know the volume at a specific level. But also needs a somewhat complicated setup to a circuit board to use more than one
jimseng
jimseng4w ago
I glued an ultrasound sensor to a steel fuel tank. It worked well for a bit but stopped working and I haven't been able to investigate why since it is on a friend's boat. I have to say that if I was to do this I would go the ultrasound route using two of these: https://www.alibaba.com/product-detail/XKC-DS1603-Metal-Tanks-Ultrasonic-Water_1600790858083.html I would suggest the RS485 version since they can be daisy chained making wiring simpler and only taking up 1 UART. It was really quite easy to get them woring using the Modbus protocol. I would love to do that with my boat but I can't really get access to the underside of the tanks. They need to sonically ping vertically upwards to the top of the fluid. They certainly seem to be accurate, you have to work out the volume if you want litres rather than millimetres of depth but if you don't want to drill holes I think they are great. I just re read your post and spotted you say your "don't do well with electronics" so my answer might be a bit lacking. To use the ultrasonic sensors you need an RS485 to ttl converter like this: https://www.amazon.co.uk/DAOKAI-Adapter-Hardware-Automatically-Indicator/dp/B09TK2JV9T/ref=sr_1_3_sspa?crid=2YA6K7FVQSFQT&dib=eyJ2IjoiMSJ9.ZvLcMInphnBEEr_jt0BEm-8gVgjOe4s9ccdZg4Z9y88INK1V3fEz8wvrXoXUueMzOZdqcRXD3bvT0iT7Mf6DaYZ5ySmz5DQgifR3XDMQk3KaY6jEUQjxFX3QfdC7dMHPiyXz3_tpPfPKuCmU-cm0yDMHhSd4QvEt6zrEHJyqEccqgVhhmjYHqsupQnYCB88nhqdMc8CpyJEpyMuerR0TQFAdpeyD5nrj2-ZCUO0r3-M.qPb1gREK9wvsTPe4K6L34cm630w-ywBcX-2p1NAmFhA&dib_tag=se&keywords=rs485+ttl&qid=1757443020&sprefix=rs485+ttl%2Caps%2C97&sr=8-3-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1 And with a couple of sensors as per the link above you connect them in a chain to the rs485 converter, which connects to the Pi 5 UART pins. You can also buy a USB RS485 version: https://www.amazon.co.uk/YOUMILE-CH340-Converter-Adapter-Module/dp/B07TYMWNV5/ref=sr_1_9_sspa?adgrpid=159751676806&dib=eyJ2IjoiMSJ9._sI1u43rTy1aKeTr7tc2CAFbBTGrdDYXUm88YZRSxUEiU66k-SGzN8nz4K3sruGyK0IMn0CTskx8-kI4piqInHsL0GyCvWfF-haOMekXTcQ9rCtevzNm3dneXa7JZEvwn-iUONNWGmi-0F2f6ChQaOOw_6s0MIt9cCCx6WF31oZYUxHBCHNMg99yyBrbeGuPg1zgxp-d7tLuv-zkT-PgFW6ODx40yvz-QLRJN2tVH3E.SkqbS4E9F6AgmzCkvbvsn_mGOa27TL7atIdwLORuMls&dib_tag=se&gad_source=1&hvadid=772383274516&hvdev=c&hvexpln=69&hvlocphy=9045345&hvnetw=g&hvocijid=13590193526092189952--&hvqmt=e&hvrand=13590193526092189952&hvtargid=kwd-42330826&hydadcr=170_2755159&keywords=rs485+usb&mcid=8b40c7a3cd1e338eb09fbddda268d850&qid=1757443201&sr=8-9-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9tdGY&psc=1 but I prefer using the Pi5 UARTs You power the sensors with 12v and run twisted pair (I used cat 6 cable) to the + and - of the sensors. Then with python or something query them as often as you like to get the height of the fluid from the bottom of the tank. They work through plastic and steel.
Stefan
Stefan4w ago
Have a look at: https://github.com/Techstyleuk/SensESP-blackwater-tank-sensor-array I use this with little adaptions and it works great!
Feadur
FeadurOP4w ago
Thanks to you both! @Tony I already tried one of those (at home), but the problem i really had was that i couldn't get accurate readings. I think i might messed up with the voltage divider. (Maybe not using the proper resistance?). As I said, i don't do well with electronics, so i chatgpt'ed my way out of it. But also, i only tested on a cheap prototyiping board, and a cheap ADS1115, so that might also be related. I think i'm gonna test it again with a properly soldered "testing PCB" (or whatever that's called, the PCB with an array of soldering holes), and give it another try, since I already have the required hardware. Also, I think it'd be best to use a separated ESP32 with SensESP instead of wiring everything to the raspberry. @jimseng That sounds pretty cool, i would let me for a lot of testing without actually touching the tanks. It's also quite cheap, so i think i will test that too. Same as I said to Tony, i think I'd rather connect it to a dedicated ESP32, so I can just send the deltas to SignalK. I have very limited where I ahve the rpi, and i'm not prone to add more wiring there, so I guess the RS485 version should work with esp32 too? This is interesting, but the fact that it uses switches, kind of turns me down, because i already have a 0/25/50/75/100 % indicator built in my 2005 bavaria panel. Which now makes me wonder, is the XKC-DS1603 also a switch? Or it does measure the actual "distance" between the sensor and the water level, so you can install it on the top of the tank and get a reading? And eventually add a second one to even out the readings.
Stefan
Stefan4w ago
Some of the XKC are only "switches" and one is 0-5 V level meter. I found this in the datasheet: https://www.laskakit.cz/user/related_files/ds1603-v1_0-datasheet.pdf I use 6 "switches" and then calculate the level.
Feadur
FeadurOP4w ago
Thanks for the link. According to this, it seems the more suitable solution to connect to an ESP32 would be the analog voltage output option, right?
No description
Feadur
FeadurOP4w ago
Then I would just use an AnalogRead() (with additional calibration and averaging functions, and whatever necessary) But the more I read on diferent sources, there more confused i get on wether this sensor deploys a continuous reading, or if it works only as a switch (even if I get any of the "non-switch" versions)
Stefan
Stefan4w ago
I ordered the only "switch" version available in China at a low price. The other one I don't found.
jimseng
jimseng4w ago
I am more of an RP2040 person than ESP32 but yes, the RS485 version could easily work with an ESP32 and you could send data via UDP or whatever you want to SignalK. The datasheet has a fairly good writeup of how the Modbus protocol works. You just need to set each sensor up with an address, glue it in place and that's it. I tested mine successfully with a glass of water, a saucepan and my steel bath before moving on to an actual fuel tank. You need to acoustically couple it to whatever you are attaching it to and you can do this before glueing it in place. Vasalene works (so does butter!)
Tony
Tony4w ago
I can also provide my code for the float resistance sensor. The only addition I did was a static curve to get accurate readings from the shape of my tank. A curve interpolator helps a lot with mapping voltage to percent. Otherwise it’s just an analog read. Testing should be straightforward since you just need current through the sensor and to move the float across the rod
Feadur
FeadurOP4w ago
Thanks to all your inputs, i managed to properly wire a variable resistance sensor (i know, it's very easy for most haha) to a SH-ESP32 board. I also wrote the code for it and works just perfect. I don't know what i did wrong in my previous attempt connecting directly to the Rpi (probably was the python code), but this is definetly a better. Anyway, thanks to you all! I'll finish writing the code to add n2k output, and it should be good to go
Feadur
FeadurOP3w ago
Quick question. Do you think this kind of variable resistance sensors will work with graywater tanks too? My concern is most mechanical, rather than electronic-wise.
No description

Did you find this page helpful?