Yfs201 Proteus Library -
If your third-party library block is purely visual, it acts as a passive terminal pass-through. To simulate the mechanical rotation of water in a real environment, attach a or a Function Generator tool directly to the sensor's yellow output line.
While simulation provides consistent pulses, physical sensors may need calibration for precise flow rates (typically pulses per second per liter/min).
If your simulation fails to run or behaves unexpectedly, review these common simulation layout issues:
Once you've downloaded the library files, proper installation is critical. Here's a complete, step-by-step guide. yfs201 proteus library
With this knowledge, you can now incorporate YFS201‑based flow measurement into any Proteus project, from a simple classroom exercise to a fully validated industrial‑grade design.
The YF-S201 works by outputting a square wave pulse for every rotation of its internal rotor. Working Principle
Because this approach gives you full control, you can also simulate temperature effects, voltage drift, or non‑linearities for more advanced studies. If your third-party library block is purely visual,
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
Are you encountering any specific with your hex file? Share public link
Proteus is distributed with a vast library of over 30,000 components, including many sensors (such as DS18B20, DHT11, and MPU6050). Nevertheless, the YFS201 is not among them. This is not an omission, but a reflection of how the Proteus library system is designed. If your simulation fails to run or behaves
The sensor outputs a train of TTL‑level pulses: each rotation of an internal magnetic impeller generates a digital pulse, and the pulse frequency is directly proportional to the instantaneous flow rate. The three‑wire interface (red = +5 V to +24 V DC, black = GND, yellow = signal) is compatible with most microcontrollers and can be read via a simple digital input pin on devices such as Arduino, ESP8266, STM32, or 8051‑based boards.
If you're looking for the files, I can suggest searching for "WaterSensorTEP.LIB" to find the simulation library described above.platformio.org/libraries/4211421036/YF-S201%20Water%20Flow">PlatformIO instead? Water Sensor Library For Proteus - The Engineering Projects
While Proteus ISIS is the industry standard for circuit simulation, it does not include a native, pre-installed simulation model specifically labeled "YF-S201".
Compile this code into an .HEX file inside your Arduino IDE, then upload it directly to your Proteus microcontroller properties panel.
This public link is valid for 7 days and shares a thread, including any personal information you added. This link or copies made by others cannot be deleted. If you share with third parties, their policies apply. Can’t copy the link right now. Try again later.