Thanesh GunaselanNARENDRANYeogessh
Published

Lake water pollution control and wastage clearance

Lake water pollution control and wastage clearance system to monitor and control the quality of the lake water and wellbeing of living org.

IntermediateShowcase (no instructions)20 hours31
Lake water pollution control and wastage clearance

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04
SparkFun Ultrasonic Sensor - HC-SR04
×1
Buzzer
Buzzer
×1
Adafruit Waterproof DS18B20 Digital temperature sensor
Adafruit Waterproof DS18B20 Digital temperature sensor
×1
Gravity analog turbidity sensor for Ardunio
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
9V battery (generic)
9V battery (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
ESP8266 ESP-12E
Espressif ESP8266 ESP-12E
×1

Software apps and online services

Blynk
Blynk
Tinkercad
Autodesk Tinkercad

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

GUI (Thanesh Gunaselan TP062487)

THANESH GUNASELAN(TP062487)

The objective of this part was to create a Graphical User Interface (GUI) for user to monitor and control the overall system. The important data of the overall system was being transmitted to two devices notably the laptop and the mobile phone and the data was displayed using the GUI. It allows the user to monitor and analyse the output or information of the system. Most part of the system was for monitoring and controlling, where it monitored the quality of the water, the temperature of the, and finally controlling the pollution or wastage in the water. Moreover, The GUI created was used in the Blynk application on both devices to make it easier for the user to identify each sensor during the process. The GUI created along with the usage of the Blynk application has enhanced the user interface for easier monitoring of the lake water.

Ultrasonic sensor with buzzer output (Mahmoud Dabour TP054861)

MAHMOUD DABOUR(TP054861)

For monitoring the pollution of the lake water, the ultrasonic sensor is used. The ultrasonic sensor is used to check if the water is polluted with waste materials. This process is carried out to check the amount of wastage and how polluted the lake water is from the scale of 0-100 cm using the ultrasonic sensor. Therefore, a buzzer is used as the output for the ultrasonic sensor input. The buzzer sounds when there is wastage nearby that is ranging from 0-100 cm distance. Waste materials such as plastic bottles, paper waste, aluminium cans could be detected by the ultrasonic sensor when it comes near the sensor and therefore the buzzer sounds to indicate the waste material on the water.

Turbidity with I2C LCD (Yeogessh Ravichandran TP062419)

YEOGESSH RAVICHANDRAN (TP062419)

For monitoring the quality of water, the turbidity sensor is used. The turbidity sensor is used to check if the water is clear, cloudy, or dirty. This process is carried out to check the quality of the lake water, and to check the amount of dirt in the lake water and to monitor the wellbeing of the living organisms in the water from the scale of 0-100 using the turbidity sensor. Therefore, an LCD screen is used as the output for the turbidity sensor input. The LCD displays the quality of the water ranging from 0-100, whereby 0-20 or lesser indicates clear water, 20-50 displays cloudy water and above 50 displays dirty water.

Temperature sensor output servo motor (Ahmad Sbai TP024887)

(Ahmad Sbai TP057887)

For monitoring the temperature of the water, the temperature sensor is used. The temperature sensor is used to check if the water is at optimum temperature. This process is carried out to check the temperature of the lake water and monitor the wellbeing of the living organisms in the water from the scale of 0-100 degrees using the temperature sensor. Therefore, a servo motor is used as the output for the temperature sensor input. The servo motor displays the quality of the water ranging from 0-50 degrees, when at 0-25 degrees, the servo motor is at rest or 90 degrees angle and when the water temperature is at 25-30 degrees threshold the servo motor moves to 30 degrees angle and when the temperature of the water is above 30 degrees the servo motor moves to 60 degrees angle to indicate the water temperature. The optimum water temperature in the lakes is from between 25-32 degree Celsius in our country. Therefore, any temperature reading out of the optimum temperature is regarded as not optimum for the wellbeing of the living organisms in the lake water.

Blynk GUI

Schematic

Code

Final Integrated Arduino Uno

Arduino
#include <Servo.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
SoftwareSerial ArduinoUno(9, 10);

LiquidCrystal_I2C lcd(0x27, 2, 16);

const int TRIG_PIN = 6;             // Arduino pin connected to Ultrasonic Sensor's TRIG pin
const int ECHO_PIN = 7;             // Arduino pin connected to Ultrasonic Sensor's ECHO pin
const int BUZZER_PIN = 3;           // Arduino pin connected to Piezo Buzzer's pin
const int DISTANCE_THRESHOLD = 30;  // centimeters

int sensorPin = A0;

// variables will change:
float duration_us, distance_cm;

const int SERVO_PIN = 8;                 // Arduino pin connected to Servo Motor's pin
const int SENSOR_PIN = 5;                // Arduino pin connected to DS18B20 sensor's DATA pin
const float TEMPERATURE_THRESHOLD = 26;  // °C

Servo servo;                         // create servo object to control a servo
OneWire oneWire(SENSOR_PIN);         // setup a oneWire instance
DallasTemperature sensor(&oneWire);  // pass oneWire to DallasTemperature library
float temperature;
int angle;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  ArduinoUno.begin(4800);       // initialize serial port
  pinMode(TRIG_PIN, OUTPUT);    // set arduino pin to output mode
  pinMode(ECHO_PIN, INPUT);     // set arduino pin to input mode
  pinMode(BUZZER_PIN, OUTPUT);  // set arduino pin to output mode
  servo.attach(SERVO_PIN);      // attaches the servo on pin 9 to the servo object

  lcd.init();
  lcd.backlight();

  servo.write(0);
  sensor.begin();  // initialize the sensor
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);
  // measure duration of pulse from ECHO pin
  duration_us = pulseIn(ECHO_PIN, HIGH);
  // calculate the distance
  distance_cm = 0.017 * duration_us;
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  sensor.requestTemperatures();             // send the command to get temperatures
  temperature = sensor.getTempCByIndex(0);  // read temperature in Celsius
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  if (distance_cm < DISTANCE_THRESHOLD)
    digitalWrite(BUZZER_PIN, HIGH);  // turn on Piezo Buzzer
  else
    digitalWrite(BUZZER_PIN, LOW);  // turn off Piezo Buzzer
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  if (temperature > TEMPERATURE_THRESHOLD)
    angle = 45;  // set angle to 45 degrees
  else if (temperature < TEMPERATURE_THRESHOLD)
    angle = 30;  // set angle to 30 degrees
  else
    angle = 0;         // set angle to 0 degrees
  servo.write(angle);  // rotate servo motor
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  int sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue);
  int turbidity = map(sensorValue, 0, 750, 100, 0);
  delay(100);
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  //delay(500);
  // print the value to Serial Monitor
  Serial.print("distance: ");
  Serial.print(distance_cm);
  Serial.println(" cm");
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  // print to serial
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print("°C => servo angle: ");
  Serial.println(angle);
  //////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////
  lcd.setCursor(0, 0);
  lcd.print("turbidity:");
  lcd.print("   ");
  lcd.setCursor(10, 0);
  lcd.print(turbidity);
  delay(100);
  if (turbidity < 20) {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    lcd.setCursor(0, 1);
    lcd.print(" its CLEAR ");
  }
  if ((turbidity > 20) && (turbidity < 50)) {
    digitalWrite(2, LOW);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    lcd.setCursor(0, 1);
    lcd.print(" its CLOUDY ");
  }
  if (turbidity > 50) {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    lcd.setCursor(0, 1);
    lcd.print(" its DIRTY ");
  }

  ArduinoUno.print(temperature);
  ArduinoUno.println("x");
  delay(30);

  ArduinoUno.print(turbidity);
  ArduinoUno.println("y");
  delay(30);

  ArduinoUno.print(distance_cm);
  ArduinoUno.println("z");
  delay(30);
}

GUI code for ESP 8266

Arduino
GUI code
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define BLYNK_TEMPLATE_ID "TMPL6JKUwWdQA"
#define BLYNK_TEMPLATE_NAME "Project"
#define BLYNK_AUTH_TOKEN "FfDIeIyXyghoqux8OXeYxbQ3NiJHLpoU"

char ssid[] = "Tharu";
char pass[] = "thara1728";

SoftwareSerial NodeMCU(D2, D3);

void setup() {
  Serial.begin(9600);
  NodeMCU.begin(4800);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  pinMode(D2, INPUT);
  pinMode(D3, OUTPUT);
}

void loop() {
  Blynk.run();
  while (NodeMCU.available() > 0) {

    int temperature = NodeMCU.parseFloat();
    if (NodeMCU.read() == 'x') {
      Serial.println(temperature);
      Blynk.virtualWrite(V0, temperature);
    }
    
    int turbidity = NodeMCU.parseFloat();
    if (NodeMCU.read() == 'y') {
      Serial.println(turbidity);
      Blynk.virtualWrite(V1, turbidity);
    }
    
    int distance_cm = NodeMCU.parseFloat();
    if (NodeMCU.read() == 'z') {
      Serial.println(distance_cm);
      Blynk.virtualWrite(V2, distance_cm);
    }
  }
}

Ultrasonic Sensor With Buzzer Output

Arduino
// constants won't change
const int TRIG_PIN   = 6; // Arduino pin connected to Ultrasonic Sensor's TRIG pin
const int ECHO_PIN   = 7; // Arduino pin connected to Ultrasonic Sensor's ECHO pin
const int BUZZER_PIN = 3; // Arduino pin connected to Piezo Buzzer's pin
const int DISTANCE_THRESHOLD = 30; // centimeters

// variables will change:
float duration_us, distance_cm;

void setup() {
  Serial.begin (9600);         // initialize serial port
  pinMode(TRIG_PIN, OUTPUT);   // set arduino pin to output mode
  pinMode(ECHO_PIN, INPUT);    // set arduino pin to input mode
  pinMode(BUZZER_PIN, OUTPUT); // set arduino pin to output mode
}

void loop() {
  // generate 10-microsecond pulse to TRIG pin
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  // measure duration of pulse from ECHO pin
  duration_us = pulseIn(ECHO_PIN, HIGH);
  // calculate the distance
  distance_cm = 0.017 * duration_us;

  if(distance_cm < DISTANCE_THRESHOLD)
    digitalWrite(BUZZER_PIN, HIGH); // turn on Piezo Buzzer
  else
    digitalWrite(BUZZER_PIN, LOW);  // turn off Piezo Buzzer

  // print the value to Serial Monitor
  Serial.print("distance: ");
  Serial.print(distance_cm);
  Serial.println(" cm");

  delay(500);
}

Turbidity with I2C LCD

Arduino
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 16);
int sensorPin = A0;
void setup()
{ 
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
}
void loop() {
  int sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue);
  int turbidity = map(sensorValue, 0, 750, 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(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    lcd.setCursor(0, 1);
    lcd.print(" its CLEAR ");
  }
  if ((turbidity > 20) && (turbidity < 50)) {
    digitalWrite(2, LOW);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    lcd.setCursor(0, 1);
    lcd.print(" its CLOUDY ");
  }
  if (turbidity > 50) {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    lcd.setCursor(0, 1);
    lcd.print(" its DIRTY ");
  }
}

Temperature sensor output servo motor

Arduino
#include <Servo.h>
#include <OneWire.h>
#include <DallasTemperature.h>

const int SERVO_PIN  = 2; // Arduino pin connected to Servo Motor's pin
const int SENSOR_PIN = 13; // Arduino pin connected to DS18B20 sensor's DATA pin
const float TEMPERATURE_THRESHOLD = 26; // °C

Servo servo; // create servo object to control a servo
OneWire oneWire(SENSOR_PIN);         // setup a oneWire instance
DallasTemperature sensor(&oneWire); // pass oneWire to DallasTemperature library
float temperature;
int angle;

void setup() {
  Serial.begin(9600);      // initialize serial
  servo.attach(SERVO_PIN); // attaches the servo on pin 9 to the servo object
  servo.write(0);
  sensor.begin();          // initialize the sensor
}

void loop() {
  sensor.requestTemperatures();             // send the command to get temperatures
  temperature = sensor.getTempCByIndex(0);  // read temperature in Celsius

    if (temperature > TEMPERATURE_THRESHOLD)
      angle = 45; // set angle to 45 degrees
    else if (temperature < TEMPERATURE_THRESHOLD)
      angle = 30; // set angle to 30 degrees
    else
      angle = 0; // set angle to 0 degrees

  servo.write(angle);  // rotate servo motor

  // print to serial
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print("°C => servo angle: ");
  Serial.println(angle);
}

Credits

Thanesh Gunaselan

Thanesh Gunaselan

1 project • 0 followers
NARENDRAN

NARENDRAN

11 projects • 9 followers
Yeogessh

Yeogessh

0 projects • 0 followers
Thanks to Mohmoud Dabour Tp054861 and Ahmad SBAI TP057887.

Comments

Add projectSign up / Login