Yf-s201 Proteus Library Page
Now for the main event: simulating a water flow monitoring system. We will use an Arduino Uno (available in Proteus’s default library) and the newly installed YF-S201.
Once you have validated your code using the YF-S201 Proteus library, you must transition to real hardware. Here are pro tips: yf-s201 proteus library
For this example, assume the signal pin of the YF-S201 is connected to Digital Pin 2 of your Arduino. Now for the main event: simulating a water
const int flowPin = 2; // Digital pin for the flow sensor
volatile int pulseCount = 0; // Counts the number of pulses
void setup()
pinMode(flowPin, INPUT);
attachInterrupt(digitalPinToInterrupt(flowPin), pulseCounter, RISING);
Serial.begin(9600);
void loop()
static unsigned long lastTime = 0;
static float flowRate = 0;
if (millis() - lastTime >= 1000)
lastTime = millis();
// The YF-S201 gives 450 pulses per liter
flowRate = (pulseCount / 450.0) * 60; // Calculate flow rate in liters per minute
pulseCount = 0; // Reset pulse count
Serial.print("Flow Rate: ");
Serial.print(flowRate);
Serial.println(" liters per minute");
void pulseCounter()
pulseCount++;
The applications of the YF-S201 Proteus library span across various domains: For this example, assume the signal pin of
