Last active
April 20, 2024 23:19
-
-
Save EDISON-SCIENCE-CORNER/1a4d5f8cd400a6ca1d10806494a8f76c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////// | |
// Arduino turbidity meter Project // | |
// // | |
// www.edisonsciencecorner.blogspot.com // | |
///////////////////////////////////////////////////////////////// | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 2, 16); | |
int sensorPin = A0; | |
void setup() | |
{ | |
lcd.begin(); | |
pinMode(3,OUTPUT); | |
pinMode(4, OUTPUT); | |
pinMode(5, OUTPUT); | |
} | |
void loop() { | |
int sensorValue = analogRead(sensorPin); | |
int turbidity = map(sensorValue, 0,640, 100, 0); | |
delay(100); | |
lcd.setCursor(0, 0); | |
lcd.print("turbidity:"); | |
lcd.print(" "); | |
lcd.setCursor(10, 0); | |
lcd.print(turbidity); | |
delay(100); | |
if (turbidity < 20) { | |
digitalWrite(7, HIGH); | |
digitalWrite(8, LOW); | |
digitalWrite(9, LOW); | |
lcd.setCursor(0, 1); | |
lcd.print(" its CLEAR "); | |
} | |
if ((turbidity > 10) && (turbidity < 50)) { | |
digitalWrite(7, LOW); | |
digitalWrite(8, HIGH); | |
digitalWrite(9, LOW); | |
lcd.setCursor(0, 1); | |
lcd.print(" its CLOUDY "); | |
} | |
if (turbidity > 50) { | |
digitalWrite(7, LOW); | |
digitalWrite(8, LOW); | |
digitalWrite(9, HIGH); | |
lcd.setCursor(0, 1); | |
lcd.print(" its DIRTY "); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is this turbidity value is in ntu?
Sir how can we say that this particular turbidity i.e. till 50 is suitable for crops?