A higher frequency inputs more pulses per second into Pin 2, causing the virtual LCD screen to display an increased Flow Rate (L/Min). Common Troubleshooting Steps
Simulates the sensor's rotor movement by generating a square wave signal proportional to the virtual flow rate.
Simulating the YF-S201 Water Flow Sensor in Proteus: A Complete Guide
Click the button at the bottom-left corner of the Proteus workspace. Troubleshooting Common Issues yfs201 proteus library
: Connect the 16x2 LCD data and control lines to the microcontroller to display your calculated metrics. Arduino Code for Proteus Simulation
const int sensorPin = 2; volatile long pulseCount = 0; float flowRate = 0.0; unsigned int flowMilliLitres = 0; unsigned long totalMilliLitres = 0; unsigned long oldTime = 0; void pulseCounter() pulseCount++; void setup() Serial.begin(9600); pinMode(sensorPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); void loop() if((millis() - oldTime) > 1000) detachInterrupt(digitalPinToInterrupt(sensorPin)); // Calculate flow rate based on frequency formula flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); flowMilliLitres = (flowRate / 60) * 1000; totalMilliLitres += flowMilliLitres; Serial.print("Flow rate: "); Serial.print(flowRate); Serial.print(" L/min"); Serial.print("\t Total: "); Serial.print(totalMilliLitres); Serial.println(" mL"); pulseCount = 0; attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); Use code with caution. Troubleshooting Common Simulation Errors "Component Not Found in Library"
| Pin Name | Physical Wire Color | Connection in Proteus | | :--- | :--- | :--- | | | Red | Connect to +5V terminal (Virtual Power) | | GND | Black | Connect to Ground (Virtual Ground) | | OUT | Yellow | Connect to any GPIO input pin (e.g., Arduino Pin 2) | A higher frequency inputs more pulses per second
The flow rate (Q) in liters per minute can be calculated using the following formula:
: 5V to 18V DC (standard 5V TTL logic for simulations). Flow Rate Range : 1 to 30 Liters/Minute. Pulse Frequency Formula : is frequency in Hz and is flow rate in L/min). Pulse Output : Approximately 450 pulses per liter of water. How to Install and Use the Library Go to product viewer dialog for this item. Arduino YF-S201 Hall Effect Water Flow Sensor J0085
If the library doesn't appear immediately after copying, you may need to add its path manually: Troubleshooting Common Issues : Connect the 16x2 LCD
To make your simulation more realistic, consider adding virtual "noise" or environmental variations:
Since the YF-S201 isn't standard, you must download a third-party library file (usually consisting of Locate the Files
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.