Yfs201 Proteus Library Page
To use the YF-S201 model in your project, you must manually add the third-party library files to your local Proteus installation directory. Step-by-Step Installation
While there is no “official” YFS201 library included with standard Proteus distributions, the absence of a dedicated component is by no means a barrier to successful simulation. You have several powerful and practical options:
A recent and well‑made YF‑S201 library for Proteus 8 is available from . The library is provided as a free download, and the accompanying blog post explains exactly how to install and use it. The model has been tested to behave like the real sensor: it outputs a pulse signal whose frequency can be varied to simulate different flow rates.
volatile int pulseCount = 0; float flowRate = 0.0; unsigned int flowMilliLitres = 0; unsigned long totalMilliLitres = 0; unsigned long oldTime = 0; const byte sensorPin = 2; // Connected to YF-S201 Output void pulseCounter() pulseCount++; void setup() Serial.begin(9600); pinMode(sensorPin, INPUT_PULLUP); // Trigger pulseCounter on falling edge attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); void loop() if((millis() - oldTime) > 1000) // Detach interrupt while calculating to prevent data corruption detachInterrupt(digitalPinToInterrupt(sensorPin)); // Calculate flow rate in Liters per minute based on sensor calibration factor (7.5) flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); // Determine volume passing through per second flowMilliLitres = (flowRate / 60) * 1000; totalMilliLitres += flowMilliLitres; // Print the results to the Virtual Terminal Serial.print("Flow rate: "); Serial.print(flowRate); Serial.print(" L/min"); Serial.print("\t Total Liquid: "); Serial.print(totalMilliLitres); Serial.println(" mL"); // Reset pulse counter and restart interrupt monitoring pulseCount = 0; attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); Use code with caution. Running and Verifying the Simulation yfs201 proteus library
Launch Proteus and open a new schematic capture design. Press the key on your keyboard to open the "Pick Devices" window. Type YF-S201 or Water Flow Sensor into the keywords box. If the installation was successful, the component schematic symbol will appear in the results. Circuit Design in Proteus (Step-by-Step)
Compile this code into an .HEX file inside your Arduino IDE, then upload it directly to your Proteus microcontroller properties panel.
Finally, many industrial flow‑monitoring systems start their life as a Proteus simulation. By the time the first PCB is ordered and the first physical sensor is installed, the core firmware has already been validated, saving weeks of debugging and re‑spinning hardware. To use the YF-S201 model in your project,
is not in your default Proteus component list, follow these steps to add it manually: How to Add the ESP32 Library to Proteus 8
The YFS201 Proteus library is not just another component file; it opens the door to serious simulation of water flow systems. Once you have it installed, you can design, test, and refine flow‑meter projects in a fraction of the time it would take using physical hardware alone. With the growing popularity of smart water management, irrigation automation, and industrial IoT, mastering sensor simulation in Proteus is a skill that pays dividends again and again.
Whether you want to output data to a (like an LCD1602 or OLED) The library is provided as a free download,
C:\Program Files (x86)\Labcenter Electronics\Proteus 7 Professional\LIBRARY
A useful behavioural model should have at least the following properties:
const int sensorPin = 2; // Connected to YF-S201 OUT pin volatile uint16_t pulseCount = 0; float flowRate = 0.0; unsigned long oldTime = 0; void pulseCounter() pulseCount++; void setup() Serial.begin(9600); pinMode(sensorPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, RISING); void loop() if ((millis() - oldTime) > 1000) detachInterrupt(digitalPinToInterrupt(sensorPin)); // Calculate flow rate in Liters/Minute using the F = 7.5 * Q formula flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); Serial.print("Flow Rate: "); Serial.print(flowRate); Serial.println(" L/min"); pulseCount = 0; attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, RISING); Use code with caution. 7. Troubleshooting Simulation Errors