YFS401

Generic - Pulse counter NORMAL

../_images/P003_YFS401_1.jpg

Introduction

Just as the ESP may be used with specific pulse counters it may also be used with any generic pulse based unit as long as the pulses are not giving to high voltages. A generic 5V flow sensor that gives a pulse each complete revolution. You may have to measure what each revolution/pulse means in volume. The one used in this example is called YF-S401, a 5V unit, which is great to use for watering systems or in this case (pictured) to measure a drainage system.

Specifications:
  • General, output as pulse

  • Min. working voltage: 4.5V

  • Max. working current: 15mA (5V)

  • Working voltage range: 5V-12V

  • Flow range detectable: approx. 0.3-6L/min

Wiring

ESP               YFS401
GPIO (14)  <-->   Signal (yellow)

Power
5.0V       <-->   VCC (red)
GND        <-->   GND (black)

Setup

../_images/P003_Setup_YFS401_1.png

Danger

Only task number 1..4 is currently supported for the pulse plugin!

Task settings

  • Device: Name of plugin

  • Name: Name of the task (example name WaterMeter)

  • Enable: Should the task be enabled or not

Sensor

  • Device: Name of plugin

  • Name: Name of the task (example name WaterMeter)

  • Enable: Should the task be enabled or not

Sensor

  • GPIO <– Pulse: Pulse input is generally set to GPIO 14 (D5).

  • Debounce time: Debounce time is generally set to 100.

  • Counter type: In this example the type is set to Delta/Total/Time.

  • Mode type: Pulse input is generally set to Falling

    LOW = count when signal go from not low to low (0.8+V to 0.8-V)

    CHANGE = count on signal being changed, low to high (0.8-V to 2.4+V) or high to low (2.4+V to 0.8-V)

    RISING = count if signal is rising, from low to not low (0.8-V to 0.8+V)

    FALLING = count if signal is falling, from high to not high (2.4+V to 2.4-V)

Warning

GPIO 16 (D0) is not compatible with pulse counters.

Data acquisition

  • Send to controller 1..3: Check which controller (if any) you want to publish to. All or no controller can be used.

  • Interval: How often should the task publish its value (5..15 seconds is normal).

Rules examples

  On WaterMeter#mL Do
   If [WaterMeter#mL]=0
     Publish,%sysname%/WaterStream/status,Water stream empty
   Else
     Publish,%sysname%/WaterStream/status,Water is life!
   EndIf
 EndOn


.. Commands available
.. ~~~~~~~~~~~~~~~~~~

.. .. include:: P003_commands.repl

Where to buy

Store

Link

AliExpress

Link 1 ($)

Banggood

Link 2 ($) Link 3 ($) Link 4 ($)

eBay

Link 5 ($)

$ = affiliate links which will give us some money to keep this project running, thank you for using those.

More pictures

../_images/P003_YFS401_2.jpg ../_images/P003_YFS401_3.jpg ../_images/P003_YFS401_4.jpg ../_images/P003_YFS401_5.jpg