Any update on this topic? I have a yf-b6 sensor that it measure always 0 pulse/min using ESPHOME 2023.12.5… any way to downgrade esphome in case? I have not backup to restore…
Is your HA Sensors shows as unavailable?
Or is your sensor incorrectly configured?
About the ESPHome bug where your entities are duplicated, I don’t know if it has been solved but my workaround worked for all duplicated entities.
The sensor was working before correctly… now the part related the pulse counter seems not working anymore…
@Destroyer1090, your calculations are made from an entity provided by ESPHome.
Because of the recent ESPHome bug there are duplications of entities provided by ESPHome to HA.
Check if your ESPHome Node entities are duplicated by going to your entities lists
I described the temporary solution in my comment here: Using ESPhome to build a water flow rate meter - #289 by donparlor
If you remove your ESPHome Node then add it back to HA, all your calculations should be back to normal.
And if you look at the history of that sensor, do you see anything? Can you see when it last recorded data?
I guess that I connected wrongly the wires because I recognize later the wires color was swapped… so here how I wrongly connected for a while…
Red: signal
Black: 5V
Signal: GND
After this, the device seems stop to working! Do you think I broke it? What I have to do now? any suggestion? Device is yf-b6.
There is a risk that reversing the wire colors on a flow sensor like the YF-B6 could indeed cause damage to the device, potentially rendering it inoperable.
- Reverse Polarity: Electronic sensors, like the YF-B6, are typically designed to operate with a specific polarity. Reversing the polarity (i.e., connecting the 5V where GND should be, and vice versa) can cause an internal short circuit, damaging sensitive electronic components.
- Inappropriate Signal: The red wire is typically used for the signal in many electronic devices. If you connect this wire to 5V instead of the signal, it could send an inappropriate voltage to the signal processing circuit, which could damage the sensor.
- Risk of Overload: Connecting the signal wire (which should normally receive a low voltage) directly to a 5V source could lead to an overload of the signal circuit, causing irreversible damage.
It is usually important to strictly follow the wiring instructions provided by the manufacturer to avoid any risk of damage to the device. If you are now sure about the wiring and it is still not updating, there are chances that your flow sensor is now unusable.
Hi @Destroyer1090, YES, there’s a way to recover, but it does cost some money.
Essentially, you can replace the board inside the sensor without having to remove the unit from the pipe you installed it into, which is the absolutely worst and most painful part of the job. Trust me, I have these in 50mm pipes.
I looked at your sensor online, it has screws on the outside. Take them out, and you’ll find a round circuit board, usually with a rubber gasket around it to keep it watertight. That part is cheap and you can get it anywhere; it’s inside almost all flow meters (really the only difference between them is what the number of rotations means).
If you buy another YF-B6, you can replace the part with confidence, but if you just look at the dead board, you can probably order it on Bangspressdu.
All flow meters are basically just hall sensors. There will be a magnet somewhere in the spinny bit, and the hall sensor just goes blip every time it comes around. You could actually make one, if you really, really needed to.
Like, if the movie takes place after the inevitable fall of society in the wake of late-stage capitalism, and the protagonist ventures into a ruined city, fighting mutants and so forth, and manages to scavenge a hall sensor in the very first place they break into, it would still be a pretty believable movie.
Best of luck. Let us know what happens.
EDIT: oh, and in case anyone else installs this stuff in big pipes, here’s some free advice: install your sensor with some kind of quick-release system on each side of it, and on the cable to the board.
Why? Because you will be doing service on it and/or replacing it at some point. You just will.
Groundwater/rainwater is pure yadda yadda but there’s often minerals and just plain old silt in it. After a time, the blades get stuck.
If you can take the sensor out, you can clean it pretty easily. Brush out what you can, and then rinse until clean. Little spray of something probably carcinogenic to make sure it’s smooth, and then clip it back in. Tadaaa.
Hi,
Thank you for sharing you code. The first code did i copy and paste in an ESP32 file in ESPHome. But i got an error “Mapping values are not allowed here”
Any idea?
Share your code first so we can look at it.
Hello i use the yf-b5 sensor and used your code. However my measurements are aprox 50% off.
When i pour 1 liter through the sensor i get 0.5-0.6 L
Any idea why that would be?
I use esp8266 and yf-b5 with no resistor.
Hello @sazern,
I’m currently using an ESP32 Development Board with my YF-B5 Sensor. I power the flow sensor with 5V and haven’t included a resistor in the setup. The ESP32 pins can handle 5V pulses, unlike the ESP8266, which isn’t designed for that. Given that your flow sensor seems to be working fine with your ESP8266, I assume the voltage is under control, likely using 3.3V to power the sensor.
Regarding accuracy, I haven’t conducted a bucket test or any precise calculations. My water output measurement data are primarily for educational purposes. Ultra precision isn’t a top priority for me at the moment.
To correct the discrepancy observed—where pouring 1 liter through the sensor yields a reading of 0.5-0.6 L—you should modify the lambda calculation to use a new factor of 198 instead of 396. Here’s how you can adjust it:
filters:
- lambda: return x / 198; # Corrected adjustment to match real measurements
This change should provide a more accurate representation of the water measured by the YF-B5 sensor.
Good luck, keep us posted!
Where does this misinformation come from? The esp8266 is most certainly 5v tolerant on the gpio and its the esp32 that is not. Atleast the original esp32, i havnt been keeping up with all the new varients.
You are correct, the eap32 can handle 5v “pulses” and not a stable 5v but, i still wouldnt use 5v personally. Its not a big deal to drop it down.
@Fallingaway24 Thanks for correcting me on the 5V tolerance for ESP8266. The misinformation came from this link.
The quote where I took that information says:
Voltage and current restrictions
The ESP8266 is a 3.3V microcontroller, so its I/O operates at 3.3V as well. The pins are not 5V tolerant, applying more than 3.6V on any pin will kill the chip.
I am not really using ESP8266 microcontrollers, only one NodeMCU V3 for a RFLink project.
oh, that’s a cute little article. Maybe next time instead of quoting third and 4th party sources who frequently all just copy each other’s wrong information resulting in the spread of misinformation, maybe don’t do that. There’s a data sheet for the esp8266 by Espressif… I can 100% verify just like many other people that it is 5v tolerant too. I have several projects running now and taking a stable 4.9v on the gpio for a Wiegand rf keypad.
Thanks for sharing the correct information. I’m no expert with ESP8266. I’m glad you are more knowledgeable than me on this topic. I’ve learn something today.
You hear it all the time. I wasn’t trying to be a dic* It’s just frustrating. There’s a couple things and you mentioned one of them. There are all sorts of Dev boards, different versions, different manufacturers, and so on. I’m guilty of this but, there’s a lot of generalizing boards, just like you aren’t using an esp8266, it’s a NodeMCU V3 with an esp8266 chip and has it’s own specs, capabilities and added circuits. It’s really not helpful and in some cases possibly not even true when we all generalize boards and paint all esp8266 or esp32 with one broad brush. I think it’s best for everone to read the spec sheet for their actual board and when others have questions then point them to the spec sheet of whatever board they have. We all win that way
I have setup as per your instructions, however the above sensor (binary_sensor.water_flow_on_off - as I have named it) is always off.
I think is to do with point 5 above.
@donparlor - How do you ensure that binary_sensor.water_flow_on_off is set up to detect water flow?
Many thanks.