Yfs201 Proteus Library Verified

Latest Update 3 Apr 2026

Yfs201 Proteus Library Verified

void setup() Serial.begin(9600); pinMode(2, INPUT); attachInterrupt(digitalPinToInterrupt(2), pulseCounter, RISING); lastTime = millis();

To read the simulated pulse frequency generated by the Proteus library, upload an interrupt-driven script to your virtual Arduino board within the simulation environment.

The YF-S201 sensor consists of a plastic valve body, a water rotor, and a Hall Effect magnetic sensor.

Ultimate Guide to the YF-S201 Proteus Library for Circuit Simulation yfs201 proteus library

[YF-S201 / DCLOCK] [ARDUINO UNO] [16x2 LCD] Signal Pin -------------------> Digital Pin 2 (INT0) Digital Pin 4 -------------> RS Pin Digital Pin 5 -------------> E Pin Digital Pin 8 -------------> D4 Pin Digital Pin 9 -------------> D5 Pin Digital Pin 10 ------------> D6 Pin Digital Pin 11 ------------> D7 Pin

If your library model features an external pin for tuning, attach the middle leg of a POT-HG potentiometer to it, with the other two legs tied to 5V and GND.

4.5V to 18V DC (typically 5V for microcontrollers). Accuracy: (can be calibrated for better precision). Pulse Characteristic: is frequency in Hz and is flow rate in L/min). Pulses per Liter: Approximately 450 pulses. 2. Proteus Library Installation void setup() Serial

(Note: File names may vary slightly depending on the developer, but the .IDX and .LIB extensions are mandatory). Step 2: Locate Your Proteus Library Folder

path, not just the "Program Files" directory, as newer versions of Windows store library data there. Do you need a sample Arduino code

: The pulse frequency varies linearly with the flow rate. The standard calculation formula is: Pulses per Liter: Approximately 450 pulses

Using the , you can simulate real-world water flow rates directly in Proteus VSM . ⚙️ How the YF-S201 Water Flow Sensor Works

The library model usually features a built-in or Interactive Toggle Switches on the schematic component.

To simulate the YFS201, you have to understand what it actually does electronically.

No matter which path you choose, the key insight remains the same: . Simulate the frequency, and you simulate the sensor.

const int sensorPin = 2; // YF-S201 signal connected to Interrupt 0 volatile uint16_t pulseCount = 0; float flowRate = 0.0; unsigned int flowMilliLitres = 0; unsigned long totalMilliLitres = 0; unsigned long oldTime = 0; void pulseCounter() pulseCount++; // Increment pulse count on every interrupt trigger void setup() Serial.begin(9600); pinMode(sensorPin, INPUT_PULLUP); // Trigger the interrupt on a FALLING edge attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); oldTime = millis(); void loop() // Execute calculations exactly once per second (1000 milliseconds) if ((millis() - oldTime) > 1000) detachInterrupt(digitalPinToInterrupt(sensorPin)); // Pause interrupt to prevent math calculation errors // Formula: Frequency (pulses/sec) / 7.5 = flow rate in L/min flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); // Calculate volume passing through during this single window flowMilliLitres = (flowRate / 60) * 1000; totalMilliLitres += flowMilliLitres; // Output results to Proteus Virtual Terminal Serial.print("Flow rate: "); Serial.print(flowRate, 2); Serial.print(" L/min"); Serial.print("\t Total Liquid: "); Serial.print(totalMilliLitres); Serial.println(" mL"); pulseCount = 0; // Reset counter for the next window attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); // Re-engage interrupt Use code with caution. Compiling and Loading the Binary