Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Based Automatic Drainage Water Monitoring & Flood Control System with Air Quality and Pressure Sensors

View and Edit Project In Cirkit DesignerImage of Arduino-Based Automatic Drainage Water Monitoring & Flood Control System with Air Quality and Pressure Sensors

Circuit Documentation

Summary

This document describes an Arduino-based automatic drainage water monitoring and flood control system. The system monitors water levels, air quality, and pressure to control a drainage system. It uses a float switch, MQ135 air quality sensor, pressure sensor, relay module, DC motor, solenoid valve, and LEDs for status indication. The system stops the motor and closes the valve when the stop button is pressed.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Water Level Float Switch Sensor

    • Description: Sensor to detect water level.
    • Pins: Wire2, Wire1
  3. MQ135

    • Description: Air quality sensor.
    • Pins: VCC, GND, A0, D0
  4. Industrial Pressure Sensor

    • Description: Sensor to measure pressure.
    • Pins: DC+, DC-, Signal
  5. DC Motor

    • Description: Motor for drainage system.
    • Pins: pin 1, pin 2
  6. Plastic Solenoid Valve

    • Description: Valve to control water flow.
    • Pins: pin1, pin2
  7. 1 Channel 5V Relay Module

    • Description: Relay module to control high power devices.
    • Pins: VCC+, VCC- (GND), IN, N.O., COM, N.C.
  8. LED: Two Pin (red)

    • Description: Red LED for status indication.
    • Pins: cathode, anode
  9. LED: Two Pin (green)

    • Description: Green LED for status indication.
    • Pins: cathode, anode
  10. Pushbutton STOP

    • Description: Button to stop the system.
    • Pins: NC, NO
  11. Battery 12v

    • Description: Power source.
    • Pins: -, +

Wiring Details

Arduino UNO

Water Level Float Switch Sensor

MQ135

Industrial Pressure Sensor

DC Motor

Plastic Solenoid Valve

1 Channel 5V Relay Module

LED: Two Pin (red)

LED: Two Pin (green)

Pushbutton STOP

Battery 12v

Code Documentation

/*
 * Arduino-Based Automatic Drainage Water Monitoring & Flood Control System
 *
 * This system monitors water levels, air quality, and pressure to control a
 * drainage system. It uses a float switch, MQ135 air quality sensor, pressure
 * sensor, relay module, DC motor, solenoid valve, and LEDs for status
 * indication. The system stops the motor and closes the valve when the stop
 * button is pressed.
 */

// Pin definitions
const int floatSwitchPin = 2;
const int stopButtonPin = 5;
const int relayPin = 4;
const int redLEDPin = 6;
const int greenLEDPin = 7;
const int mq135AnalogPin = A0;
const int pressureSensorPin = A1;

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Initialize pins
  pinMode(floatSwitchPin, INPUT);
  pinMode(stopButtonPin, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);

  // Initial state
  digitalWrite(relayPin, LOW); // Relay off
  digitalWrite(redLEDPin, LOW); // Red LED off
  digitalWrite(greenLEDPin, LOW); // Green LED off
}

void loop() {
  // Read sensor values
  int floatSwitchState = digitalRead(floatSwitchPin);
  int stopButtonState = digitalRead(stopButtonPin);
  int mq135Value = analogRead(mq135AnalogPin);
  int pressureValue = analogRead(pressureSensorPin);

  // Print sensor values to serial monitor
  Serial.print("Float Switch: ");
  Serial.println(floatSwitchState);
  Serial.print("Stop Button: ");
  Serial.println(stopButtonState);
  Serial.print("MQ135 Value: ");
  Serial.println(mq135Value);
  Serial.print("Pressure Value: ");
  Serial.println(pressureValue);

  // Control logic
  if (stopButtonState == HIGH) {
    // Stop button pressed
    digitalWrite(relayPin, LOW); // Turn off relay
    digitalWrite(redLEDPin, HIGH); // Turn on red LED
    digitalWrite(greenLEDPin, LOW); // Turn off green LED
  } else if (floatSwitchState == HIGH) {
    // Float switch activated
    digitalWrite(relayPin, HIGH); // Turn on relay
    digitalWrite(redLEDPin, LOW); // Turn off red LED
    digitalWrite(greenLEDPin, HIGH); // Turn on green LED
  } else {
    // Default state
    digitalWrite(relayPin, LOW); // Turn off relay
    digitalWrite(redLEDPin, LOW); // Turn off red LED
    digitalWrite(greenLEDPin, LOW); // Turn off green LED
  }

  // Delay for stability
  delay(500);
}

This code initializes the pins and sets up the initial state of the system. In the loop function, it reads the sensor values and controls the relay and LEDs based on the state of the float switch and stop button. The sensor values are also printed to the serial monitor for debugging purposes.