ads1115:
- address: 0x48
i2c:
sda: 4
scl: 5
scan: True
sensor:
- platform: ads1115
multiplexer: 'A0_GND'
gain: 2.048
id: watertank_voltage
name: "watertank Level Voltage"
icon: 'mdi:water'
unit_of_measurement: 'V'
update_interval: 0.5s #the delta filter will ensure it only sends values when something changes.
filters:
- sliding_window_moving_average:
window_size: 5 #creates a moving average of the last 10 values
send_every: 1 #sends the moving average at every measurement (but only if it passes the delta filter below))
send_first_at: 1 #after startup immediately start sending the result rather than wait for the first 10 measurements
- delta : 0.001 #only send the result if the voltage difference with the last sent result is higher than this
- platform: uptime
name: "irrigation System Uptime"
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 60s
- platform: ultrasonic
trigger_pin: GPIO 01
echo_pin: GPIO 03
name: "Ultrasonic Sensor"
pulse_time: 10us
update_interval: 1s
- platform: ultrasonic
trigger_pin: GPIO 1
echo_pin: GPIO 3
name: 'ultrasonic water distance'
id: dist2water
unit_of_measurement: 'm'
accuracy_decimals: 3
update_interval: 2s
pulse_time: 10us
timeout: 2.0m
filters:
- filter_out: nan
- sliding_window_moving_average:
window_size: 10 #creates a moving average of the last 10 values
send_every: 1 #sends the moving average at every measurement (but only if it passes the delta filter below))
send_first_at: 1 #after startup immediately start sending the result rather than wait for the first 10 measurements
- delta : 0.0015 #only send the result if the voltage difference with the last sent result is higher than this
- platform: ultrasonic
trigger_pin: GPIO 1
echo_pin: GPIO 3
name: "Ultrasonic Sensor Level"
unit_of_measurement: '%'
accuracy_decimals: 3
update_interval: 5s
pulse_time: 10us
timeout: 2.0m
icon: mdi:water-percent
filters:
- lambda: return ((((x*100)-27)-(60-27))/(60-27))*-100;
- filter_out: nan
- sliding_window_moving_average:
window_size: 10 #creates a moving average of the last 10 values
send_every: 1 #sends the moving average at every measurement (but only if it passes the delta filter below))
send_first_at: 1 #after startup immediately start sending the result rather than wait for the first 10 measurements
- delta : 0.0015 #only send the result if the voltage difference with the last sent result is higher than this
- platform: ultrasonic
trigger_pin: GPIO 1
echo_pin: GPIO 3
name: "Ultrasonic Sensor Volume"
unit_of_measurement: 'l'
icon: mdi:cup-water
accuracy_decimals: 2
update_interval: 2s
pulse_time: 10us
timeout: 2.0m
filters:
- lambda: return ((((x*100)-27)-(60-27))/(60-27))*-70;
- filter_out: nan
- sliding_window_moving_average:
window_size: 10 #creates a moving average of the last 10 values
send_every: 1 #sends the moving average at every measurement (but only if it passes the delta filter below))
send_first_at: 1 #after startup immediately start sending the result rather than wait for the first 10 measurements
- delta : 0.0015 #only send the result if the voltage difference with the last sent result is higher than this
- platform: pulse_counter
pin: 02
id: water_usage
name: 'Current water usage'
unit_of_measurement: 'L/min'
accuracy_decimals: 2
update_interval: 2s
filters:
- lambda: return x / 450.0;
- filter_out: nan
- sliding_window_moving_average:
window_size: 10 #creates a moving average of the last 10 values
send_every: 1 #sends the moving average at every measurement (but only if it passes the delta filter below))
send_first_at: 1 #after startup immediately start sending the result rather than wait for the first 10 measurements
- delta : 0.0015 #only send the result if the voltage difference with the last sent result is higher than this
Hi @raidnet-ms, I made that board 2 years ago and its been in a box on a pole ever since. Iâm afraid I donât remember what the specs of the MOVs are, I just remember that I chose them for their capacities.
Power out here is very bad; the system hasnât been maintained in decades and everyone expects it to collapse. We get brown-outs, spikes, and short drops from things like trees brushing the lines. And thatâs just on a local level. Nationally we also have rolling blackouts - scheduled outages to help reduce load on the grid. When the power comes back, it tends to spike at the moment it comes on, and can destroy appliances.
My intention with the big MOV was to smooth out spikey transients in the power, and protect the circuit if bigger than expected voltages appear. A fuse after it would probably be a good idea, youâre right.
The capacitor smooths the DC power, and acts as a sort of miniature UPS. One of the many power problems we get is that power can go off, then immediately back on. Not great for connected devices. Although it will only last a second or so, the capacitor should keep the circuit running during these very common events.
Since I built that device, we have invested in an array of solar panels and a 5kW inverter. We are still grid-tied, but the inverter conditions the incoming power so that it is smooth and stable. So a lot of these tricks are no longer strictly necessary. Still, you canât be too safe.
I bought 2 types of MOV but I wasnât able to use them.
5D471K
14D241K
I didnât find a place where I could understand what code is meant for the capacity I need for a circuit like yours.
If you got a link where I could understand how the code/capacity works, would be great!
The supplier I bought MOVs from was kind enough to list the voltages that the MOVs could handle in the product descriptions - thatâs how I knew what to get.
The best thing to do is to search for the product code along with the words âspec sheetâ. Google says that your 5D471K can handle up to 750V, which is not good for either 110v or 240v power supply (I donât know what you have). If there was a spike of 700v it would cook your device long before the MOV kicked in.
The 14D241K handles 240v, though, so that might work, but it doesnât allow a lot of overhead. For example, my power is 240v but will often go just a few volts over, which would trigger this MOV.
I am afraid I donât know anything about solenoids, bistable or otherwise.
Iâm in EU yes, so you recommend something a little higher then 240v?
In the 14D241K link you sent me I read a value called âclamping valueâ. Does it mean anything important?
I am not very advanced in these topics, but as I understand it, the clamping value of an MOV is the voltage at which it will kick in, preventing the excess voltage from reaching your circuit. Depending on the size of the incoming spike, this may destroy the MOV, but it sacrifices itself to save the circuit.
I would recommend something just a little higher than 240 volts only so you donât have it clamping from normal voltage fluctuation, if thatâs a thing where you live. Here in South Africa the voltage varies between 220-240, and a little bit on each side.
So as far I understand this 14D241k handles 240-390v. Over 390 it should pop and burn opening the circuit
While fuse works only on current, this preserve for overvoltage.
The mov has one leg on L and the other on N. Right?
Hi Alexxed, I have the same YF-B5 and used your x/396 calculation. It seems to underestimate usage (~70%). What are your findings? How accurate are your measurements?
Hi,
Iâm using the yf-b2 water flow sensor for my measurements and monitoring my system, but sometimes the code canât detect the small amount of watering Iâm using for.
My watering valve turns on each hour for 30 seconds and then turn off the watering valve for that reason it canât detect the flow.
This thread is the graal for those looking to build flow meters with ESPHome! Thank you all for sharing your knowledge and building the path toward achieving it. I still have a question that, I think, has not been answered so far.
kbx81 on the ESPHome Discord channel said that:
apparently the GPIO pins on the ESP32 are all 5-volt tolerant
I am working with a YF-B5 + ESP32 Development board. Iâve seen some people in this conversation adding a 10k resistor to keep signal pin high. Can I build a flow meter without using a resistor or are there cons to not using it? rradar on ESPHome Discord channel suggested that I
could activate the internal pull up from the esp
I am wondering if using internal pull up from the ESP32 would really help avoid applying 5 volts for an extended time. Is a 10k resistor the only way to go? Anyone has knowledge on this?
@donparlor Sorry Iâm only noticing your question now.
I am not strong on the electronics side, I tend to learn by googling what others have done, and making terrible mistakes.
I did use a 10k resistor when I built my initial device based on a Wemos D1 mini (esp8266). However, I have also found that this wasnât necessary. While experimenting, I got just as good signal connected to other pins that didnât have the 10k resistor, and thatâs to a sensor with a cable that runs a good 12 metres.
So I would say test it and see. The common wisdom is that the 10k resistor is necessary, and I sort of understand why a bit. But my personal experience is that there doesnât seem to be a benefit.
Of course, if itâs not working at all, maybe add the resistor and see?
After 15 days, I confirm it is working flawlessly. The pull up parameter seems to provide a reliable signal and ESP32 pins are very stable with a 5V input from the flow meter. I managed to do quite a lot of interesting programming with my flow sensor, I get different values calculated, Iâm very happy with the end result: