Follow these steps to construct your exclusive YF-S201 simulation circuit using an Arduino Uno. Step 1: Gather the Components
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\Data\LIBRARY
The YF-S201 (often referred to as YFS201) is a common used in embedded systems projects to measure liquid flow rates. While Proteus Design Suite does not include a native, pre-installed model for this specific sensor, "exclusive" third-party libraries are often used to simulate its behavior. Sensor Overview & Mechanism yfs201 proteus library exclusive
void loop() pulseCount = 0; interrupts(); delay(1000); noInterrupts(); float flowRate = pulseCount / 7.5; // L/min Serial.print("Flow: "); Serial.print(flowRate); Serial.println(" L/min");
pull-up resistor between OUT and VCC. The simulation library operates with or without this resistor, but adding it maintains schematic accuracy. Arduino Calibration and Firmware Integration Follow these steps to construct your exclusive YF-S201
(where f is frequency in Hz and Q is flow in L/min), directly in the simulation. This ensures your interrupt-based pulse counting code works before uploading it to a physical board. How to Install the Exclusive YFS201 Library To use this component in your projects, follow these steps:
This is where the "exclusive" factor shines. Because Proteus cannot simulate actual fluid mechanics visually, the model uses a mathematical abstraction. Sensor Overview & Mechanism void loop() pulseCount =
Standard libraries just generate random pulses. The exclusive version includes a . You can dial in the exact flow rate (L/min), and the library calculates the precise frequency in real-time: [ Frequency (Hz) = (7.5 \times FlowRate) / 60 ]
This is a common conflict with older Proteus versions (v7.x). The exclusive library is optimized for v8.9 SP2 or higher. Update your Proteus environment.
// Simple Arduino Code for YFS201 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)); // Calculation flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / 7.5; oldTime = millis(); pulseCount = 0; Serial.print("Flow Rate: "); Serial.print(flowRate); Serial.println(" L/min"); attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounter, FALLING); Use code with caution. Conclusion