Humingbear,
this is one of those projects in my half completed list. I am keen to see yur wiring in relation to battery running.
Patraff
Just an update as today I have received my sensor and did testing with 70cm pipe full of water. Positively surprised from results!
I was moving sensor down the pipe full of water and each 10cm down I was measuring the current. My measurement were less then 3% different from the calculated current (based on the water level). I am almost sure that those differences are related to the way I was done my measurement (not very precise). What is nice is that at the bottom of my pipe (70cm) the current was 6,24 mA which 100% equal to 70cm depth from data sheet.
Next steps is to make power and configuration on ESP and putting sensor to my tank.
Just waiting for a few parts in the mail, I’ll post photos of my setup once I have it going!
Hey all - I got everything hooked up today for testing and I’m not sure I’m getting a correct reading. I have the sensor in a 3-gal jug and it reads the same voltage (0.09570v) fully out or fully submerged. Is that just not enough depth to get a proper reading? It’s evening here so I can’t go out and test at my water tank.
Also the current to voltage board that was provided gets very hot, has anyone else experienced this (@teich ?)
Also after reading the specs the sensor operates at 12-36v, so I nixed the 24v step-up and am just powering it with 12v.
Update: I dropped the sensor in my water tank and again the voltage was basically the same from top to bottom of the tank. I might have blown the current to voltage sensor when I momentarily hooked it up incorrectly so I have another one on the way.
there shouldn’t be any heat - that sounds like mixed up wiring. Double (triple?) check everything. I had the same symptoms at first - not getting variation. Turns out I had made a mistake (don’t remember anymore what).
I was afraid I had fried it, but it turns out OK.
Check where your 12V vs 5V is, make sure the wires are exactly as diagrammed, etc.
Turns out I had wired things incorrectly and in the process fried the current to voltage sensor. Thankfully that was my hunch and a new one arrived yesterday and now it’s reading correctly!
I got everything wired up and in a waterproof box. I want to post these details below for folks who want to run this off a battery. The sensor pulls current regardless if you’re taking a reading from it or not, so you can use a relay controlled by your ESPxx to give it power. I have my ESP8266 turn the relay on on_boot
and it automatically turns off when I put the ESP8266 into deep_sleep
I only take a reading every 2 hours but it could probably be every 6-hours, we’ll see what kind of data i get back.
Below are some photos and the code I’m running on my ESP:
ESPHome Code:
esphome:
name: water_tank_sensor
platform: ESP8266
board: d1_mini_pro
# Send power to sensor by enabling relay on boot
on_boot:
then:
- output.turn_on: water_sensor_power
- delay: 5s
# Enable logging, api, ota, captive_portal
logger:
api:
ota:
captive_portal:
# wifi settings
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pw
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "watertanksensorAP"
password: !secret ap_pw
# Deep sleep
deep_sleep:
run_duration: 90s
sleep_duration: 2h
# Set relay as output component
output:
- platform: gpio
pin: 13
inverted: True
id: water_sensor_power
sensor:
- platform: adc
pin: A0
update_interval: 2s
id: "waterTankSensorVoltage"
name: "Water Tank Sensor Voltage"
icon: "mdi:water-percent"
filters:
- median:
window_size: 10
send_every: 10
send_first_at: 10
See this interesting guide to using the vl53l1x TOF sensor with the emphasis on waterproofing the sensor.
The vl53l1x reads up to 4 metres and the sensor is supported by tasmota now, so you can easily integrate it with HA.
https://nerdiy.de/en/howto-espeasy-fuellstandssensor-mit-vl53l0x-vl53l1x/
@hummingbear, thank you for sharing your solution. If you cut-off the power from ESP to curent-valtage converter for power saving then I think (not sure) that this does not impact the current which flows through the sensor (4-20mA). If you read the data every 2 hours this means that for most of the time that current id not used. In order to “save” it your relay should connect/disconnect power to sensor. But then I am not sure how much time sensor need after getting power to give reliable readings. Looking forward for data you are getting…
I have installed mine and during test the current measured with multimeter was quite stable. After connecting the sensor to ESP8266 via simple 100 Ohm resistor measurements are not that stable and can vary even 10% - example below of 24 measurement:
Was initially using filter: median and yesterday changed to
- sliding_window_moving_average:
window_size: 10
send_every: 1
send_first_at: 1
Maybe it is related to the fact that noew the sensor is not in water ? Or maybe your current/voltage converter is better the simple resistor ?
Will do some more testing and we will see.
I was using very similar sensor VL53L0X and had the same challenge that water vapors from hotter liquid was condensing on the laser (which in my case is half the year always colder then the liquid) and measures were not correct.
@Maco65 hmmmm, I’m not quite sure I follow you. The relay most definitely does cut off the power going to the sensor. The sensor is wired up directly to the battery through the current to voltage convertor, but the positive goes through my relay. The only wire going to my ESP from the sensor is the analog wire which is not drawing power when the ESP is in deep sleep.
I’m glad to draw up a schematic if that’s helpful.
I run my ESP to take readings for 90 seconds - I take the median of every 10 readings. I’ve been getting very stable and consistent results.
Apologies - for some reason, looking at your picture, I have mixed sides of relay board… Yes, your connection looks as intended and cuts the power off the sensor.
I do not have issue with power so I am measuring every 2 minutes and averaging over 10 measurements. Still for last 24 hours it does not look super stable:
Will consider current-voltage converter instead of simple resistor. It might be this or my sensor is not as stable as yours…
That setup looks great. I’m curious what size (AH) battery you have connected? With your relay controlling power to only come on intermittently I’m assuming it would last a very long time regardless. I am thinking about doing something like this but connecting a solar panel to keep the battery charged. Do you know or are you able to measure how much power your system uses if it were operating constantly? I figure if it was being charged by the solar panel there wouldn’t be much need for the relay switch. I am just trying to figure out what size battery/panel combination I might need.
I had a sealed lead acid battery a friend gave me for free, so I’m using that. It’s 6Ah@12v. The staff on DFRobot said the sensor consumes 30mA, so that + the ESP is how much you want to account for.
I think if you have an appropriately sized panel you’d be just fine. My water tank is in the shade so sadly it’s not an option for me.
A few things I’ve learned about power saving with the ESPs is that the versions with a USB Micro plug take up a lot of power even in deep sleep. So if you want one that’s going to last, get one without the USB plug and use your own serial adapter to flash it. Secondly that if you hookup any sensors so the VIN or 3V pins, it will still power them in Deep Sleep, so it’s best to use a GPIO pin as the lead for a sensor and program the ESP to turn it on when it wakes.
Hey Dave, saw your comment, maybe you have some ideas about how to make this work? Cheers. Use Xiaomi temperature/pressure sensor as water tank level sensor
I did see that thread a while back. Using that Xiaomi unit under water doesn’t really seem like a viable solution to be honest
Yeah apparently not Oh well, cheers.
@teich I would like to have the ESP8266, the “Analog Current to Voltage Converter” and the power supplies indoors, to protect them from the elements and also to ensure WIFI signal. So basically only the pressure sensor would be outside (in the water tank that is).
I see the provided cable is only 5 meters long. Do you know whether it’s possible to extend that and how?
There might be some voltage drop depending how long you want to extend it, but I’m guessing the readings would all still be relative for the most part.
Why not just put it in some kind of waterproof box? That’s what I did, seems easier than extending but idk you’re setup.
Thanks for the tip! Well my outdoor wifi signal isn’t great, so by placing it inside I would not only protect it from the weather, but also ensure connectivity.
Alternatively I could buy one of those POE-capable ESP32 boards so that I can use an ethernet cable rather than wifi, but that seems a bit complex.
Or use bigger gauge wiring so the voltage drop is less.
Or get an outdoor AP.
The poe esp32 is not too complex.