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.
I used an ESP8266 that let me attached an external antenna. My ESP is about 800ft away from my Wifi through trees, with the antenna it works great. You can see it in my post here
You have to move a resistor on the chip to enable the external wifi which is annoying.
I believe there should be no problem with extending (or shortening) the cable. The readings are related to current (not voltage) so the voltage drop in the cable should not matter. To be 200% sure I would do the test before mounting in the final destination: With some tank or barrel without extension and with extension (on the same water level).
@nickrout, @Maco65, @hummingbear thanks for the helpfull advice! I think I’ll try with a sufficiently thick wire. I have a tube running from my garage to my water citern, but the thicker the wire the lower the chance I will be able to pull it through the tube. Unfortunately there thickness of the 5m cable attached to the sensor isn’t specified. Any clue about what geige those strands of wire are?
In my opinion from the currents and voltage prospective, normal “telecom” cable (wires 0,5mm diameter) should be OK. The one I had in my sensor (which on the opposite side I had to cut sorter) has 2 small wires (appr. 0,5mm) and shield. It was thicker then normal as I believe it was ready to be submerged into different liquids and potentially outside so must be for “ouside use”.
The way I understand the mechanism of that sensor, voltage does not matter (therefore also supply voltage can be from 12 to 24 V) - and this is why you connect it to current->voltage converter. The sensor “provides” specific current depending on the pressure of liquid. So even small cable which can provide 500mA capacity should be OK.
Thanks a lot. I was thinking of using the typical 1.5mm² electricity cables we use for lighting here in Europe, so that should be fine then. I understand you use a different sensor than this one ? The one I linked has two wires and an air tube. As the air tube isn’t used I assume I only need to extend the two wires.
I trust our sensors are very similar (of not the same). Here is link to one I have. It looks like cable is pretty much the same:
Actually now I realized, that i have made my cable shorter and then I had extended it with regular 0,5mm par (only two wires). It works fine.
As mentioned before I am not happy with repeating values (there are differences up and down within 1 hour of 5-7%) and at this point I believe it is due to tolerance and stability of my “simple” current-voltage converter based on 1 resistor… waiting for ordered converted (like yours) and then will see.
FWIW I get a variety of values as well, but I have the ESP take the median over 15-readings, this has generally given me a very stable result. See filters
below
sensor:
- platform: adc
pin: A0
update_interval: 2s
id: "water_tank_sensor_voltage"
name: "Water Tank Sensor Voltage"
accuracy_decimals: 3
icon: "mdi:water-percent"
filters:
- multiply: 3.3
- median:
window_size: 15
send_every: 15
send_first_at: 15
(The big increase is from turning on my well pump)
@hummingbear, interesting that you are measuring every 2 seconds. Then you do median on 15 measures which “practically” makes measure every 30 seconds. Quite frequent…
In my case I do not see the need to measure so often, here is my config:
- platform: adc
pin: A0
name: "liquid level"
update_interval: 300 s
unit_of_measurement: cm
icon: 'mdi:arrow-expand-vertical'
filters:
- lambda: return (x-0.128) * (1000 + 50) ;
- sliding_window_moving_average:
window_size: 10
send_every: 1
send_first_at: 1
And my measures are like that:
I am looking forward for current-voltage converter to see how much it will be improved.