0% found this document useful (0 votes)
48 views1 page

Sensor - Waterflow

This Arduino code is measuring water flow using a water flow meter connected to an analog input pin. It uses pulse counting to calculate the water flow frequency and volume per minute. It displays the real-time volume and total accumulated volume on an LCD screen and also outputs the frequency over the serial port for monitoring.

Uploaded by

Athok Illah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Sensor - Waterflow

This Arduino code is measuring water flow using a water flow meter connected to an analog input pin. It uses pulse counting to calculate the water flow frequency and volume per minute. It displays the real-time volume and total accumulated volume on an LCD screen and also outputs the frequency over the serial port for monitoring.

Uploaded by

Athok Illah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <LiquidCrystal.

h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int X;
int Y;
float TIME = 0;
float FREQUENCY = 0;
float WATER = 0;
float TOTAL = 0;
float LS = 0;
const int input = A0;
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);
}
void loop()
{
X = pulseIn(input, HIGH);
Y = pulseIn(input, LOW);
TIME = X + Y;
FREQUENCY = 1000000/TIME;
WATER = FREQUENCY/7.5;
LS = WATER/60;
if(FREQUENCY >= 0)
{
if(isinf(FREQUENCY))
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print(�VOL. :0.00�);
lcd.setCursor(0,1);
lcd.print(�TOTAL:�);
lcd.print( TOTAL);
lcd.print(� L�);
}
else
{
TOTAL = TOTAL + LS;
Serial.println(FREQUENCY);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(�VOL.: �);
lcd.print(WATER);
lcd.print(� L/M�);
lcd.setCursor(0,1);
lcd.print(�TOTAL:�);
lcd.print( TOTAL);
lcd.print(� L�);
}
}
delay(1000);
}

You might also like