This is the sensor. You should be able to source it in whichever country you live. In my case this was one of those rare occasions where I could buy the sensor from a “bricks and mortar” supplier in Australia and a better price than the Chines version (which was 304 stainless steel, not 316 as this unit is.)
Instad of using the current to voltage converter board, why don´t you use just a simple resistor in series? With a 165 Ohm resistor, at a current of 20mA it returns 3,3 Volts over the resistor.
After toiling away with the ultrasonic, I’m going to bin it for a drop-in sensor… There’s too many variables with the ultrasonics that it’s not a solution I’d rely on!
@rusty_away if you wouldn’t mind mocking up a wiring / components diagram? Just curious what DC/DC converter you’re using.
Hi Gerhard. The I to V board comes with the kit anyway.
Hi jmjm
Here is the simplest way to do it. You can flash the nodemcu with tasmota or ESPHome, or write an arduino sketch if you are so inclined. In my case, I use an ADS1115 A to D converter just because it is more stable and accurate than using the analog pin on the nodemcu, which tends to have fluctuating readings if the supply voltage is not rock solid. I probably don’t need to because the LM 2596 DC-DC converter is pretty good.
To insert the ADS1115, wire Vin +ve and -ve of the ADS1115 to the 5.2VDC supply of the LM2596, connect the analog output of the current to voltage converter module to the A0 pin on the Ads1115, connect the SCL of the ADS1115 to D1 of the nodemcu, connect SDA of the ADS1115 to D2 of the nodemcu and finally, connect the ADDR (Address line) of the ADS1115 to ground (-ve) of the 5.2VDC output of the LM2596. Use tasmota-sensors.bin or the code (below) for ESPHome (after doing the preliminary config.)
i2c:
sda: GPIO4
scl: GPIO5
scan: true
id: bus_a
ads1115:
- address: 0x48
i2c_id: bus_a
sensor:
- name: "Your Tank Name"
platform: ads1115
multiplexer: 'A0_GND'
update_interval: 60s
gain: 4.096
unit_of_measurement: "V"
icon: "mdi:gauge"
accuracy_decimals: 3
filters:
- median:
window_size: 7
send_every: 4
send_first_at: 3
Cheers
Rusty
which store was this?
surprise no one has made a plug and play version of this throw in sensor
Hi Britespark,
can you please post your working code for JSN-SR20 with Wemos D1 Mini?
If you have more infos regarding your setup or documented it somewhere it would be fine if you share it also
I also ordered a JSN-SR20 and will test it in my water tank.
Thanks
Hi @giovanne ,
I have some environmental monitoring on my water tank, tracking outdoor details as well as the water tank level. My config is as follows:
- Wemos D1 mini as control unit. This is powered by an old DC plug-pack sheltered from the rain etc, connected to a cheap DC level converter to provide 5V DC to the D1 mini. The wifi connection to my home router is surprisingly reliable given the conditions.
- A standard “rain monitor” daughter board and sensor connected to A0 and D4. This DOES NOT work reliably regardless of sensitivity setting; the unit false triggers on dew and high humidity (Sydney hits 100% humidity many mornings so not much use), the PCB gets a corrosive build-up quickly and needs cleaning, and the sensor reports “wet” conditions for a day or more after rainfall.
- Temperature monitoring using a DS10B20, connected to pin D3.
- Water tank level sensing using the JSN-SR20 connected to pins D6 & D7. I have dual sensors located directly on the top of the tank (it has a flat top, and I used exterior double-sided tape to stick them on which worked surprisingly well). This has been UNRELIABLE for me; I replaced the daughter board and dual ultrasonic sensors 4 times before I gave up. Additionally the water level can’t be read when it’s raining as the surface waves cause invalid readings (you could fix this by putting the sensors into a vented pipe within the tank), plus the reported levels vary with temperature (this might be the DC supply drifting with temp, haven’t really investigated).
- Water level reported in cm, L, and %full.
- All the above is in a capped 90mm PVC pipe enclosure, with entry and venting at the base and temp / rainfall sensors stuck to it. Despite the wettest first 3 months of the year on record here, I’ve had zero issues with moisture or condensation.
- Tank is a 5000L circular tank, 2m tall.
I’m going to upgrade with humidity monitoring, a DIY rainfall sensor, and a 5MPa water pressure sensor (which I’ll connect via a 3mm x 2m tube to the tank outlet) to replace the JSN-SR20 but am still to test and config it. The drop-in sensors discussed previously sound like a better idea but I haven’t gone down that path yet.
My ESPHome yaml code:
esphome:
name: tank-mon
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "my_secret_password"
wifi:
# networks:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Tank-Mon Fallback Hotspot"
password: !secret fallback_hotspot_pswd
captive_portal:
web_server:
port: 80
dallas:
- pin: D3
text_sensor:
# Platform parameters
- platform: version
name: 'ESPHome Version'
- platform: wifi_info
ip_address:
name: "IP"
ssid:
name: "SSID"
### All sensors defined below
binary_sensor:
# Rainfall sensor - digital wet/dry output.
#switch:
- platform: gpio
pin:
number: D4
inverted: true
name: "Rain sensor"
device_class: moisture
sensor:
# Platform parameters
- platform: wifi_signal
name: 'Tank_mon WiFi Signal strength'
update_interval: 60s
accuracy_decimals: 0
- platform: uptime
name: "Tank_mon Uptime"
unit_of_measurement: days
update_interval: 300s
accuracy_decimals: 1
filters:
- multiply: 0.000011574
# DS18B20 temperature sensor (enable once address is recorded)
- platform: dallas
address: 0xXXXXXXXXXXXXX
name: "Tank_mon air temp"
# Rainfall sensor - analogue voltage on A0 (0.0 to 1.0V), digital output D4 (wet/dry)
- platform: adc
pin: A0
name: "Rainfall intensity"
update_interval: 60s
filters:
- lambda: return (1 - x);
# JSN-SR20 ultrasonic sensor for water level monitoring
# Tank height: 2m (Th)
# Tank circumference: 1.6m
# Tank volume: 4000L (Tv)
# Return water level (as Th - x)
- platform: ultrasonic
trigger_pin: D7
echo_pin: D6
timeout: 4m
pulse_time: 20us
update_interval: 60s
name: "Water level"
unit_of_measurement: "cm"
accuracy_decimals: 0
filters:
- filter_out: nan
- lambda: return (200 - (x * 100));
# Return water level %
- platform: ultrasonic
trigger_pin: D7
echo_pin: D6
timeout: 4m
pulse_time: 20us
update_interval: 60s
unit_of_measurement: "%"
accuracy_decimals: 0
name: "Tank full %"
filters:
- filter_out: nan
- max:
window_size: 15
send_every: 5
- lambda: return ((200 - (x * 100))/2);
# Return water level in L
- platform: ultrasonic
trigger_pin: D7
echo_pin: D6
timeout: 4m
pulse_time: 20us
update_interval: 60s
name: "Water volume (L)"
unit_of_measurement: L
accuracy_decimals: 0
filters:
- filter_out: nan
- sliding_window_moving_average:
window_size: 10
send_every: 5
- lambda: return ((2 - x)/2)*4000;
In my dashboard, I’ve included all the sensors plus standard ESPHome wifi / device monitoring (to monitor uptime, wifi network & signal strength).
Good luck!
Britespark,
This is a project i am about to get onto. I am just waiting to get my hands on some 18650 cells so i can set up a 24v battery with solar feed in.
My tank is located about 60m from my house uphill and I get good wifi there so will be using an esp32 as my controller with a thrown in pressure sensor.
The plan is to have the measured values provide a reliable value that will then be sent to another esp32 to trigger the pump for refill.
Would be good to keep in contact on our respective projects. I am in Northern NSW.
Pat
Sounds like fun, Pat. My brother has a very similar scenario, with a header tank on a hill he’d like to monitor and a bore to fill it when needed. If I get my system working reliably (I’m in residential Sydney, so if it fails there’s always mains pressure ) I’m planning to install on his property.
Keep us posted!
I read this somewhere and I have been doing this to any outdoor electronics. Coat them with this nail polish liberally to seal them from the elements https://www.amazon.com/Sally-Hansen-Nails-Polish-Crystal/dp/B00AJKJ6JW
Thanks @OzGav that sounds sensible but I think that will defeat the purpose here - you need the tracks exposed for the rain / moisture to complete the circuit. It’s the actual tracks on the rain sensor, which look like solder-coated copper, that get the corrosion buildup on them. If the tracks were straight copper they’d probably be ok but I think the wave solder process in manufacture coats everything.
I haven’t really looked into what the impact of the buildup is, I guess over time it would reduce the conductivity. Or the buildup might become waterlogged and prevent the circuit drying out in a reasonable time. I’m thinking of replacing the stock sensor with some thin brass wire (easy to solder, or maybe stainless steel wire) wrapped as a closely-spaced double-helix around a piece of veroboard.
hi everyone,
I also need to know how much water is in my cistern so I know when to fill it up again.
I bought an TL-136 Water Level Sensor and have an ESP8266 here.
this thread is miles long (with many different aprroaches) and I would like to know If anyone can share a step-by-step tutorial how to set everything up.
- components used
- how to wire everything up
- how to setup up the software and the home assistant integration
Best regards
Tobias
hi, which component did you use for this one? looks very nice and simple.
- LM2596
- Water Level Sensor (TL-136?)
- MCU 8266 (is this an esp8266?)
-CurrentToVoltage Converter ?? which one is it?
Best regards
HIi @kimocal,
Just a few questions. I have the same setup, but looking to connect to a Wemos D1 mini
I assume that the VCC & GND of your INA219 connect to the 5V and GND of your ESP, right ?
I assume that the SDA of your INA219 connects to the A0 of your board ?
Where is the yellow one going to ?
Thanks in advance !
Kr,
Bart
Hi Kimocal,
Would you mind sharing your yaml code ? I constantly receive errors in the way you wired
Thanks in advance !
Kr,
Bart
Hi,
Do you mind sharing your esphome yaml file used ? I’m having trouble using my TL sensor and the ina219
Much appreciated !
Jt,
Bart
Here’s the esphome yaml parts:
esphome:
name: water-tank
platform: ESP32
board: m5stack-core-esp32
# Enable logging
logger:
# Enable Home Assistant API
api:
i2c:
sda: 21
scl: 22
sensor:
- platform: ina219
address: 0x40
shunt_resistance: 0.1 ohm
current:
name: "INA219 Current"
id: ina_current
accuracy_decimals: 5
filters:
- multiply: 1000 #convert from Amps to mA
unit_of_measurement: "mA"
power:
name: "INA219 Power"
accuracy_decimals: 5
bus_voltage:
name: "INA219 Bus Voltage"
accuracy_decimals: 2
shunt_voltage:
name: "INA219 Shunt Voltage"
accuracy_decimals: 5
max_voltage: 32.0V
max_current: 400mA
update_interval: 10s
Here is the Home Assistant configuration.yaml parts:
template:
- sensor:
- name: "Water Tank Level"
unique_id: "water_tank_level_sensor_inches"
unit_of_measurement: "inches"
state: >
{% set height = ((states('sensor.ina219_current')|float * 5.0663) - 24.86) |round(2) %} #This equation was derived in a spreadsheet based upon actual water height and ina219 current values
{% if 0.000 <= height <= 72.000 %}
{{ height }}
{% else %}
unknown
{% endif %}