Proteus Library | Yfs201
If the LCD shows zero, your interrupt pin is not detecting the virtual pulses—check the YFS201 output connection.
Once installed, search for "YF-S201" in your Proteus component picker ( P shortcut). Place the component onto your schematic sheet. The virtual model mirrors the exact 3-wire physical connection interface. Pinout Mapping Table Color (Physical) Connection Destination in Proteus Description Power Rail Powers the internal Hall-effect sensor GND System Ground Common ground connection OUT / DATA Digital Interrupt Pin (e.g., Arduino D2) Outputs the frequency pulse train TEST / SIM Virtual Only Function Generator or Potentiometer Used to manually vary the simulated flow speed 5. Simulating Flow Rates in Proteus
In a Proteus simulation, you would add a VIRTUAL TERMINAL component to view the output, or connect an LCD to display the values directly.
A useful behavioural model should have at least the following properties: yfs201 proteus library
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
Yes, but you must place the files in the Proteus 7 LIBRARY folder. Some models may not support the FLOW_RATE property field; use a pulse generator instead.
The is a gateway to efficient, waterless, and risk-free IoT development. While Labcenter does not provide it natively, the DIY installation process is straightforward: download the .LIB/.IDX pair, drop them into the Proteus library folder, and restart. If the LCD shows zero, your interrupt pin
Paste the file path into the field and click OK.
: The pulse frequency varies linearly with the flow rate. The standard calculation formula is:
void flow() // Interrupt function flow_frequency++; The virtual model mirrors the exact 3-wire physical
This report outlines the integration and simulation of the YF-S201 Water Flow Sensor Go to product viewer dialog for this item.
The YF-S201 is a popular, low-cost water flow sensor that uses a magnetic hall-effect sensor to measure fluid velocity. For embedded systems developers and students, testing this hardware in a virtual environment before prototyping saves time and prevents component damage.
Proteus does not include a visual simulation model for the YF-S201 sensor out of the box. A custom library solves this by providing a graphical component for your schematic capture screen and an underlying SPICE or VSM simulation model. Primary Engineering Benefits
Let’s simulate a real project: Measuring water flow and displaying it on an LCD.