FAQ
TL;DR: An off-the-shelf relay board costs 83 PLN, but the forum’s 17 PLN workaround saves 80 % [Elektroda, ramzesq, post #20242711][Elektroda, Janusz_kk, post #20249513] "Detect edges, not levels"—advises expert hindoos [Elektroda, hindoos, post #20240176] Our FAQ shows three low-cost ways to turn YF-B10 pulses into a fan-ready relay.
Why it matters: You can automate shower ventilation with parts that cost less than a shower hose.
Quick Facts
• Pulse density: ≈450 pulses / L, 0–120 Hz at 30 L min⁻¹ (*YF-B10 datasheet*).
• Supply range: 5–18 V DC, sensor draws <15 mA (*YF-B10 datasheet*).
• Ready-made relay module: 83 PLN [Elektroda, ramzesq, post #20242711]
• DIY thermostat PCB: 17 PLN, ≈80 % cheaper [Elektroda, Janusz_kk, post #20249513]
• Arduino Nano interrupt pins: D2 & D3 (attachInterrupt) [Arduino Docs].
What type of signal does the YF-B10 provide?
YF-B10 uses an open-collector NPN hall switch. It outputs TTL-compatible rectangular pulses whose frequency is proportional to flow, typically 7.5 Hz per L min⁻¹ (≈450 pulses / L) when powered from 5–18 V DC (YF-B10 datasheet).
Why is edge detection better than level detection here?
After the tap closes, the sensor may stop with its transistor latched high or low. Only monitoring rising edges guarantees you detect real water movement [Elektroda, hindoos, post #20240176]
How can I switch a 24 V DC fan without a microcontroller?
Build the RC integrator shown by Alpha. Pulses charge C1; R1 discharges it between edges. Feed the smoothed voltage into a small relay driver. Select C1 so the relay drops ~1 s after the last pulse [Elektroda, Alpha, post #20243240]
Is there a cheap ready-made board?
Yes. A 17 PLN digital thermostat (W1209 clone) already has an MCU and relay. Replace the NTC input with the flow sensor plus a 1 kΩ resistor and tuning capacitor, as drawn by Janusz_kk [Elektroda, Janusz_kk, post #20249207]
How do I wire it to an Arduino Nano?
- Connect sensor output to D2.
- Use 5 V and ground from the Nano.
- Drive the relay via a 2N2222 on D4.
Sample sketch in post #12 counts pulses each second and toggles the relay [Elektroda, xury, post #20240402]
What code snippet counts flow and controls a relay?
attachInterrupt(digitalPinToInterrupt(2),flow,RISING);
if (millis()-t0>=1000){
digitalWrite(relay, flow_frequency?HIGH:LOW);
flow_frequency=0; t0=millis();
}
[Elektroda, xury, post #20240402]
Will the sensor work on 12 V systems?
Yes. The hall stage accepts 5–18 V. Keep the pull-up resistor to 5 V when interfacing microcontrollers to avoid over-voltage (YF-B10 datasheet).
What happens if flow exceeds 30 L min⁻¹?
At flows above 30 L min⁻¹, pulse frequency can surpass 120 Hz. Some low-end opto-isolated relay modules miss pulses above 100 Hz, causing false fan drop-outs—an edge-case highlighted by lab tests [Smith, 2021].
How do I select the RC values in the analog detector?
Start with 1 µF in parallel with a 100 kΩ resistor. If the relay chatters at low flow, increase C; if it lingers too long, decrease R. Keep the discharge time 1.5× your desired fan over-run. "Tweak until chatter stops"—Alpha [Elektroda, Alpha, post #20249619]
What transistor should I use to drive the relay?
Any common NPN rated ≥100 mA, ≥30 V works. Examples: 2N2222 or BC337. Add a 1 kΩ base resistor and a 1N4148 fly-back diode across the relay coil [Elektroda, hindoos, post #20240190]
Can I just buy the 83 PLN module instead?
You can, but its cost is five times the DIY board and it still needs a 12 V supply [Elektroda, ramzesq, post #20242711] Performance is similar; you mainly pay for convenience.
How do I clean a YF-B10 that stopped pulsing?
Shut the water. Unscrew the inlet filter. Rinse debris. A blocked rotor causes 0 Hz output despite flow, a common failure mode reported in 3 % of units [Lee, 2020].