Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Thashwanth
Published © GPL3+

Water and air quality measuring system

Good water ! Good Air ! Good Life !

AdvancedShowcase (no instructions)2 days557
Water and air quality measuring system

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
YOU CAN ALSO BUY IN AMAZON !
×1
Turbidity Sensor, Phototransistor Output
Turbidity Sensor, Phototransistor Output
YOU CAN ALSO BUY IN AMAZON !
×1
Grove - Gas Sensor(MQ2)
Seeed Studio Grove - Gas Sensor(MQ2)
YOU CAN ALSO BUY IN AMAZON !
×1
Alphanumeric LCD, 20 x 4
Alphanumeric LCD, 20 x 4
YOU CAN ALSO BUY IN AMAZON !
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
YOU CAN ALSO BUY IN AMAZON !
×1
Jumper wires (generic)
Jumper wires (generic)
YOU CAN ALSO BUY IN AMAZON !
×1
PHPoC Bread Board
PHPoC Bread Board
YOU CAN ALSO BUY IN AMAZON !
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Turbidity and air quality measuring system

Code

Turbidity and air quality measuring system

C/C++
#include<LiquidCrystal.h> 
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

#define samp_siz 4
#define rise_threshold 4
#define sensor_pin A0
int sensorPin = 9; 
int sensorValue;
int read_ADC;
int ntu;

// make some custom characters:
byte heart[8] = {
  0b00000,
  0b01010,
  0b11111,
  0b11111,
  0b11111,
  0b01110,
  0b00100,
  0b00000
};

byte smiley[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b10001,
  0b01110,
  0b00000
};

byte frownie[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b00000,
  0b01110,
  0b10001
};

byte armsDown[8] = {
  0b00100,
  0b01010,
  0b00100,
  0b00100,
  0b01110,
  0b10101,
  0b00100,
  0b01010
};

byte armsUp[8] = {
  0b00100,
  0b01010,
  0b00100,
  0b10101,
  0b01110,
  0b00100,
  0b00100,
  0b01010
};
 
void setup(){// put your setup code here, to run once 
pinMode(sensor_pin, INPUT);

lcd.begin(20, 4); // Configura lcd numero columnas y filas
lcd.clear();
lcd.setCursor (4,0);
lcd.print("!!Welcome!!");
lcd.setCursor (2,1);
lcd.print(" T.AQI Project"); 
lcd.setCursor (0,2);
lcd.print(" Made By Thashwanth"); 
lcd.setCursor (6,3);
lcd.print("Arumugam"); 
delay(7000);
lcd.clear();
  // create a new character
  lcd.createChar(0, heart);
  // create a new character
  lcd.createChar(1, smiley);
  // create a new character
  lcd.createChar(2, frownie);
  // create a new character
  lcd.createChar(3, armsDown);
  // create a new character
  lcd.createChar(4, armsUp);

  // set the cursor to the top left
  lcd.setCursor(6, 3);
  delay(2000);
  // Print a message to the lcd.
  lcd.print("Welcome!");
  lcd.write((byte)1);
  delay(2000);
}
 
void loop(){
  
read_ADC = analogRead(sensor_pin);
if(read_ADC>208)read_ADC=208;

ntu = map(read_ADC, 0, 208, 300, 0); 
 
lcd.setCursor(0,0);
lcd.print("Turbidity: ");
lcd.print(ntu);
lcd.print("  ");
lcd.setCursor(4,3);
lcd.write((byte)4);
lcd.print("!Welcome!");
lcd.write((byte)1);

lcd.setCursor(0,1);//set cursor (colum by row) indexing from 0
if(ntu<20)            lcd.print("Water Very Clean");
if(ntu>=20 && ntu<50) lcd.print("Water Norm Clean");
if(ntu>=50)           lcd.print("Water Very Dirty");

delay(2000);

  sensorValue = analogRead(A1); // read analog input pin 0
  lcd.clear();
  lcd.setCursor(0,2);
  lcd.print("Air Quality:");
//  lcd.setCursor(0,8);
  lcd.print(sensorValue);
  Serial.print(sensorValue);
  if (sensorValue <= 100)
  { 
    lcd.setCursor(15,2);
    lcd.print("Good");
  }
  else if (sensorValue >= 100 && sensorValue < 150){
    lcd.setCursor(15,2);
    lcd.print("Poor");
  }
  else {
    lcd.setCursor(15,2);
    lcd.print("Toxic"); 
  }
}

Credits

Thashwanth
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.