skhiri youssef
Published © GPL3+

Monitoring and detection system of water uplift

The project consists of carrying out a system for monitoring the state of the water and make a GSM call in case of uplift

AdvancedFull instructions provided10 hours9
Monitoring and detection system of water uplift

Things used in this project

Hardware components

DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Float Switch, Vertical
Float Switch, Vertical
×1
MINI RELAY SPDT 5 PINS 12VDC 10A 120V CONTACT
TaydaElectronics MINI RELAY SPDT 5 PINS 12VDC 10A 120V CONTACT
×1
Buzzer
Buzzer
×1
ATmega328
Microchip Technology ATmega328
×1
SIMCom Wireless Solutions SIM800L
×1
LED (generic)
LED (generic)
×2
60W PCIe 12V 5A Power Supply
Digilent 60W PCIe 12V 5A Power Supply
×1

Software apps and online services

Arduino IDE
Arduino IDE
Proteus

Story

Read more

Schematics

20200705_115915_rNz8aJAT4J.mp4

Code

Global code

Arduino
//#include<Wire.h>
//#include<LCD.h>
//#include<LiquidCrystal_I2C.h>
#include<LcdBarGraphI2C.h>
#include <DHT.h>
#include<SoftwareSerial.h>
SoftwareSerial mySerial(3,2);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 
LcdBarGraphI2C  lbg(&lcd, 16, 0, 1); // Creates an LCD Bargraph object.
int pin_relais = 13;
int pin_flotteur = 4;
int pin_buzzer=12;
int LED_rouge=6;
int LED_verte=7;
const int trigPin = 9; /* les pins de l'ultrason */
const int echoPin = 10;
long duree;
int distance;
#define max_distance 60  // distance maximale (en cm)
#define DHTPIN 8     // pin de DHT11
#define DHTTYPE DHT11   // DHT 11

DHT dht(DHTPIN, DHTTYPE);
void setup() 
{
  pinMode(LED_rouge, OUTPUT);
  pinMode(LED_verte, OUTPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(pin_relais, OUTPUT); 
  pinMode(pin_flotteur, INPUT); 
  lcd.begin(20,4); // Initialisation de LCD 
  lcd.backlight();
  dht.begin();
  lcd.setCursor(0,0);
  lcd.print("chargement...");
  lcd.blink();/*pour le clignotement de notre LCD */
  delay(3000);
}
void loop() 
{
  int etat_flotteur = digitalRead(pin_flotteur);
  int h = dht.readHumidity();
  int t = dht.readTemperature();
  // Write a pulse to the HC-SR04 Trigger Pin
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  
  // Measure the response from the HC-SR04 Echo Pin
  duree = pulseIn(echoPin, HIGH);
  
  // Determine distance from duration
  // Use 343 metres per second as speed of sound
  distance= duree*0.034/2;

  if (etat_flotteur == HIGH){
       digitalWrite(LED_verte, LOW);
       lcd.clear();
       lcd.setCursor(0,0);
       lcd.print("Attention... ");
       lcd.blink();
       lcd.setCursor(0,1);
       delay(1000);
       digitalWrite(pin_relais, HIGH);
       digitalWrite(LED_rouge, HIGH);
       tone(pin_buzzer,450);
       delay(1000);
       noTone(pin_buzzer);
       digitalWrite(LED_rouge, LOW );
       delay(1000); 
         
       //Serial.begin(9600);
  
       //Begin serial communication with Arduino and SIM800L
        //mySerial.begin(9600);

        //Serial.println("Initializing..."); 
        //delay(1000);

  //mySerial.println("AT"); //Once the handshake test is successful, i t will back to OK
       // updateSerial();
  
        //mySerial.println("ATD+ +21655185225;"); //  change ZZ with country code and xxxxxxxxxxx with phone number to dial
        //updateSerial();
        //delay(20000); // wait for 20 seconds...
        //mySerial.println("ATH"); //hang up
        //updateSerial();
   }
  else {
      digitalWrite(LED_rouge,LOW);
      digitalWrite(LED_verte, HIGH);
      digitalWrite(pin_relais, LOW);
  // Prints "Distance: " on the first line of the LCD
      lcd.setCursor(0,0);
      lcd.print("Distance: "); 
      lcd.print(distance);
      lcd.print(" cm");

  // Draws bargraph on the second line of the LCD
      lcd.setCursor(0,1);
      lbg.drawValue(distance, max_distance);
      delay(500);
      lcd.setCursor(0,2);
      lcd.print("Temp: ");
      lcd.print(t);
      lcd.print("C");
  
      lcd.setCursor(0,3);
      lcd.print("Humi: ");
      lcd.print(h);
      lcd.print("%");
      }  
}
void updateSerial() {
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

Credits

skhiri youssef

skhiri youssef

0 projects • 0 followers

Comments

Add projectSign up / Login