So i felt confidant enough to actually try my first esphome project.
i followed some instructions i found online and tried to make a “stupid” water flow sensor.
for starters i was willing to setle for a “binary sensor” to just let me know if the water were “running” or “not running”.
so i got this sensor of AliExpress, and combined it with an esp8266 board i had from another project. its a simple sensor with 3 wires and a “spin module” to sense the flow. the sensor gets its power from the 5V and G pins of the esp8266, and “data” wire is connected to pin 13.
i use esphome addon with home assistant, and added these lines to the “standard code”:
the sensor shows up in home assistant, and when blowing air into the sensor i can see the state changing to “running”.
here are the problems:
without the “- delayed_off: 1s” code, i can see the state changing rapidly (running/not running), several times, for as long as the inner sensor is spinning (while air is being blown).
is that normal?
sometimes the state stays in “running” state, though nothing is making the sensor spin (no air nor water is passing through the sensor).
that can not be “normal”, as it misses the whole sensor idea…
I don’t have enough experience to understand if its something to do with my configuration, execution, of maybe a bad sensor?
i know this kind of sensor can give accurate water consumption (or spose to…) but for now, i like to better understand what did i do wrong, with the steps i took.
any help and pointers will be appreciated.
cheers
Well done for getting this far. You have a flow sensor; the sensor is designed to generate a single “on” (the circuit is made) moment during a rotation. The idea is that you then use a pulse meter sensor platform in ESPHome to allow you to count the number of rotations per second.
The final bit is to then write a little formula that calculates the amount of water flow from the rotations per second.
If you just want a binary on/off, then you could then write a template that is “off” when rotations are zero and “on” when rotations are >0.
I suspect you might find if you look up the sensor on these forums that you might need a pull-up resistor to ensure you do not get spurious “bouncing”. I hope I have your sensor correct!
if you look at the pulse_sensor Q=6.6 for my sensor, so 6.6 x 60s = 396 and you will add the good pulse with x / 396, so look at the seller description to find the good “Q” number for your flowmeter.
thank you @JulianDH for the explanation. that make sense as a behavior for a “pulse meter”, and same goes for the pointers to the right info. i’ll probably use your template idea for the “on\off” state as further indication, while using @Olivier974 code to play around with the other info the sensor can provide.
If i understood correctly, @Olivier974 had made a perfect example, that works fine for my sensor “as is”.
im sure ill have to tweak if further than the “pin number”, to get accurate measurements.
for example, this line in the code does not validate for my config:
if its not too much trouble, i would love some more elaborate explanation for @Olivier974 code.
what every sections does, and more explanation for the “Q” parameter your refer to.
what exactly am i looking for, and how do i implement it in the code.
thank you for your help
cheers
sorry you can deleted the “index_compteur_eau” its the number of my flowwater counter on the road, because i want to follow my total water consumption and when you start your flowsensor, you start from “0” and actually my index is 188. So i create a number sensor like this in EspHome
if i understood you correctly, you refer to the width (diameter) of the faucet\pipe, as the pulse counter for the difference between the 3/4" and 1/2" will change as well. further more, it is possible that different sensor are using different “counters”, so yours is not necessarily uses the same inner components as my 3/4 (guess i will start with your setup, and work my way through).
i think i will need to measure it myself. is that an option? if so, what would be the best way of doing it?
can i pour 1 litter on water and check the “overall” reading is correct, and change the values accordingly?
ill keep playing with it to further figure it out.