Yf-s201 Proteus Library

Circuit:

Arduino Code (Upload to Proteus .HEX):

volatile int pulseCount = 0;
float flowRate = 0.0;
float totalLiters = 0.0;
unsigned long oldTime = 0;

void pulseCounter() pulseCount++;

void setup() Serial.begin(9600); pinMode(2, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(2), pulseCounter, RISING); oldTime = millis(); yf-s201 proteus library

void loop() if (millis() - oldTime >= 1000) detachInterrupt(digitalPinToInterrupt(2));

// Frequency = pulseCount (since 1 second)
float frequency = pulseCount;
// YF-S201 Formula: Flow (L/min) = Frequency / 7.5
flowRate = frequency / 7.5;
// Total volume
totalLiters += flowRate / 60.0;
Serial.print("Freq: "); Serial.print(frequency); Serial.print(" Hz\t");
Serial.print("Flow: "); Serial.print(flowRate); Serial.println(" L/min");
Serial.print("Total: "); Serial.print(totalLiters); Serial.println(" Liters");
pulseCount = 0;
oldTime = millis();
attachInterrupt(digitalPinToInterrupt(2), pulseCounter, RISING);

Short answer: No.

Long answer: Labcenter Electronics (makers of Proteus) focuses on simulation models for ICs, microcontrollers, and generic sensors. The YF-S201 is a niche electromechanical component. As of 2025, there is no official .LIB or .IDX file for the YF-S201 distributed with Proteus.

Before we discuss simulation, let us analyze the sensor’s working principle. Circuit:

Copy the downloaded YFS201.LIB and YFS201.IDX files into the LIBRARY folder.

Now for the main event: simulating a water flow monitoring system. We will use an Arduino Uno (available in Proteus’s default library) and the newly installed YF-S201.