在此帖子中,我们将使用Arduino和16 x 2 LCD显示器构建数字水流量计。我们将看看YF-S201水流传感器,其施工和工作以及如何与Arduino接口以提取一些有用的读数。
The proposed project can measure the rate of water flow in litre / minute and total water flow in litres.
Let’s take a look at YF-S201 water flow sensor.
YF-S201的插图:
YF-S201 is a霍尔效应基于water sensor. It has three terminals 5V (nominal working voltage), GND and output. The +5V is red coloured wire, the black one is GND and yellow one is output.
传感器给出了与水流成正比的频率。YF-S201传感器可以从1升/分钟到30升/分钟测量。水压应小于或等于1.75MPa。
The water can be injected from one end and water flows through the other end.
The sensor may be placed after the main gate-valve of tank; if you want to measure the water flow in a network of water pipes or you can place just before a water tap to measure the water flow of single tap.
The placement of the sensor can be anywhere according to user’s need but, care must be taken to avoid leakage of water.
The sensor has a磁铁和霍尔效应传感器; if we take a look at the sides of the water flow sensor, we can witness a plastic turbine in the path of water flow.
A round shaped magnet is embedded at the center of the turbine and the Hall Effect sensor is sealed and protected from moisture and placed above the magnet. The Hall Effect sensor produces a pulse for every revolution of the turbine.
Water Flow Waveform on Serial Plotter
We can see the pulses generated by water flow sensor on serial plotter of arduino IDE, shown below (Using Arduino Single channel Oscilloscope).
We have blown air through the sensor to旋转涡轮机as a test and the waveform generated is shown above. The denser waveform on left hand side represents higher frequency and faster rotation of turbine, the less dense waveform at right hand side signifies the vice versa.
一致的水流赋予了一致的频率输出。
We have toconvert the frequencyinto litre/minute scale. To do this, the manufacturer has given a formula:
水的流量(升/min) = frequency / 7.5
So, we need to measure the generated frequency and apply the above formula in the program code.
YF-S201的技术规格:
·准确度:+/- 10%,如果您需要更好的精度,我们需要校准。
·工作温度:-25至+ 80摄氏度。
· Working humidity: 35% to 80% RH.
·产量占空比:50%+/- 10%。
·最大水压:1.75 MPa。
· Pulses per Litre: 450.
·最大电流拉布:5V的15 mA
总结了YF-S201水流传感器。
Now let’s move to the schematic.
Schematic Diagram:
水流量传感器的输出引脚连接到Arduino的A0。使用10K电位器for adjusting display contrast. Wire the Arduino andLCD display根据上图。
Program Code:
//-----Program Developed by R.Girish-----//
#include
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
X;
int y;
浮动时间= 0;
浮动频率= 0;
float waterFlow = 0;
float total = 0;
float ls = 0;
const int输入= a0;
const int测试= 9;
void setup()
{
Serial.begin(9600);
LCD.BEGIN(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Water Flow Meter");
lcd.setCursor(0,1);
lcd.print("****************");
delay(2000);
pinMode(input,INPUT);
Pinmode(测试,输出);
analogWrite(test,100);
}
void loop()
{
X = pulseIn(input, HIGH);
Y = pulseIn(input, LOW);
时间= x + y;
频率= 1000000 /时间;
waterFlow = frequency/7.5;
LS =水流/ 60;
if(频率> = 0)
{
if(isinf(frequency))
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("L/Min: 0.00");
lcd.setCursor(0,1);
lcd.print(“总:”);
lcd.print(总计);
lcd.print(“L”);
}
else
{
总=总+ ls;
Serial.println(frequency);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“l / min:”);
lcd.print(waterFlow);
lcd.setCursor(0,1);
lcd.print(“总:”);
lcd.print(总计);
lcd.print(“L”);
}
}
延迟(1000);
}
//-----Program Developed by R.Girish-----//
作者的原型:
“L / MIN”表示当前的水流量,“总”表示自电路导通以来流动的总水。
您还可以流动任何粘度值靠近水的液体。
如果您对使用Arduino有关此数字水流量计的任何疑问,请随时在评论部分中表达,您可以获得快速回复。
爵士请回答我的问题
I made a transformer which have primery winding is 220 turn(18 swg wire 1kg) and secondary turn is 22 turn(10 swg 650gram) now the input voltage is 210 volt and output is 18 volt
鲍宾大小是(6英寸×3英寸)输出给出多少电流?????
plz回答我的问题
Afrid,
无法通过视觉分析判断当前的信息......您必须用电流表检查。
SIR,我知道将LCD连接到电位器是用于调整亮度,但为什么您将流量传感器的5V引脚连接到电位器?我可以知道为什么需要该连接吗?
嗨拉胡尔,
仔细看电路,5V线对于电位计和流量传感器很常见,它只是5V路径,红色线。
Regards
你好
是否可以将EPROM存储器添加到电路中,以便随着时间的推移保持消耗,即使电源已关闭?我想也必须在代码上完成一些更改。你能解决这个问题吗?谢谢!
嗨魏克勒,
Yes, we can add an SD card or utilize built-in EEPROM of ATmega 328P for saving data. We can provide you the solution.
自定义的Arduino代码是截至现在的溢价,如果您感兴趣地评论您的详细要求,我们将继续进行。
Regards
你能提供这个程序的流程图吗?
Water pressure should be less than 1.75 mpa so . sir can we use this project for petrol pump pressure. Because im not sure about the pressure of petrol pumps in mpa thankyou
嗨Shaihk,
汽油应该用这个传感器正常工作。我不会建议使用汽油或任何昂贵的液体,因为该传感器具有+/- 10%的公差。这意味着您最终将在泵送10%或10%的汽油中。
Regards