No announcement yet.

water flow sensor and Sonoff Basic/Tasmota

  • Filter
  • Time
  • Show
Clear All
new posts

    water flow sensor and Sonoff Basic/Tasmota

    I've been trying to get this to work. Very little info out there using this combination of YF-S201 type flow meter and Sonoff Basic device. Lots of stuff using Arduino.

    I seem to have things wired up and configured, but flow is always showing 0. I have MQTT setup and working/sending data and using mcsMQTT created device.

    Setup on Tasmota as a Counter

    In Console have set these commands

    teleperiod 60
    counterdebounce 100
    countertype 0
    rule1 on tele-counter#c1>0 do counter1 0 endon

    I understand this rule will send flow rate per minute.

    Wiring I currently have (1) 4.7K resistor across 5v and Signal as pullup. I have seen references to the YF-S201 already having an internal pullup resistor but do not know if that is correct.

    Have (2) 4.7K resistor in series on signal line returning to Sonoff (RX) to reduce 5v to @3.3V. I saw this somewhere and cannot find the reference again. I have seen conflicting statements as to if this is needed or not.

    Anyone out there been able to make this combination work?

    Where/how do I convert signal to gal/min in HS?

    I implemented a similar Digiten sensor and documented it in mcsMQTT.pdf Section 20.5. It was early in my use of Tasmota and did some customization of the source, but with current Tasmota versions no customization is needed. No rules are needed either.

    GPIO14 should be selected as a Counter in the Module configuration.

    You do need the resistors and the ESP8266 is a 3.3v device while the sensor is a 5v device.

    Once you have the sensor counter topic associated with HS device from the Association tab, then go to the Edit tab (click on the Ref # button). Use the Expression textbox to convert the Tasmota reported count to gallons. If you have 100 counts per gallon, as an example, your expression would be $$PAYLOAD:/100

    You asked about a gal/min value in HS. In this case you would create the Rate device from the same Edit tab. Section 6.3 of mcsMQTT.pdf described the Rate device. There is a setting that can be tweaked for adjust the filter that removes the high frequency changes in the computed rate to provide a more stable rate measurement.


      McsMQTT edit tab should offer the correct customization tools but this could help if you are using Tasmota rules