Flood Warning System using Arduino
![](https://blogger.googleusercontent.com/img/a/AVvXsEhJcwbMaK26M1lPJuMSoTrwiuj5CQyf4VVRyAgEGgBCuhOFyDi3_Cp8ZySIBRSRavaDNVBSsLuWLs1SdAeguJ_EvdJd5QUlXHkBUga_VBNDB7n_UAjToBUoVi63z6ev_85Mss9_XnlHiAfD7IzQxJASog74PgZYj3OS7o1f_dnfGWEyyf9A4hDm-NYlTA=w640-h478)
The sensor system without casing
Project Concept
Since now it’s entering the raining season, flood risks would increase. Because of this, I want to make a simple system and demonstration to help detect early indications of flooding.
This project is about making a simple flood warning system using Arduino
Tools
Ultrasonic Sensor
The ultrasonic sensor is a sensor used to determine distance. It uses ultrasonic sound waves, which are sound waves whose frequencies exceed 20000 Hz (the highest frequency humans can hear) and thus we cannot hear the sound waves they produce. These sound waves are transmitted from the sensor's transmitter (in this case it is labelled with T). When the waves reach an object or obstacle, they are reflected, and the sensor's receiver (labelled R in this case) detects the signal.
HC-SR04 ultrasonic sensor | |
The sensor has four pins, VCC, TRIG, ECHO, and GND. VCC and GND are commonly used names for power input and ground pin. The VCC pin is connected to a 5v power supply, and GND is connected to a ground cable.
The TRIG pin controls the transmitter. Sending a signal pulse to this pin will activate the transmitter for a brief moment, and then turn it off again. The ECHO pin is the reading of the receiver. The ECHO pin will output the time taken for the sound wave to travel, setting the pin to HIGH when the waves are sent, and turning it back to LOW when the sounds are received.
To compute the distance, we can use the delay between activating the transmitter and receiving a wave on the receiver. This multiplied by the speed of the sound waves gives twice the distance from the sensor to the object, as the wave travels from the transmitter to the object, and then to the receiver of the sensor, and hence we have to divide it by two.
To implement this in the Arduino programming language (a programming language that we can use to program Arduino boards or similar ones, or any other board compatible with the Arduino programming language), we can set the trigger pin to HIGH for 10 microseconds, then set it to LOW again. To measure the duration we can use the pulseIn() function with two arguments, the pin number of the echo pin, and a predefined constant named HIGH. This gives the time taken for the waves to travel, and then we multiply it by 0.034 (the speed of sound in cm/ms, as the pulseIn function measures the time in ms) and divide it by two.
In this project, I use the sensor to measure the distance between the water to to the sensor. Given the height of the sensor from the ground this can determine the water level (although the measured area has to be clear of other objects, because if not the object may get detected by the sensor, potentially causing the reading to be incorrect)
1602 LCD
- Character-based LCD display.
- Two display lines, with 16 characters each
- A larger version, the 2004 LCD can display 4 lines with 20 characters each
- In this project I use the LCD to display the status generated by the system (Safe, Standby, Warning, and Danger, ordered in increasing order of risk. In normal conditions the status is safe, when the water level rises it will become standby, then if the water level rises again the status will become warning and if the water level is high enough to cause a flood the status is danger)
1602 LCD |
I2C backpack for 1602 LCD display
- Reduces the number of pins used
- Has to be soldered to the display
- Can be bought pre-soldered
- For this project I use this backpack to simplify the communication between the Arduino and the LCD, so it does not use too much pins (the original LCD uses 16 pins, but the I2C backpack uses only 4 pin)
I2C backpack soldered to 1602 LCD display |
Passive buzzer
- Can be used to create various sounds of different frequencies
- For this system the buzzer is used to generate two different sounds. When the status is warning, the buzzer generates a non-continuous beeping sound. If the status reaches danger, the buzzer generates a continuous sound of a higher frequency
Arduino or similar board
- Does the computation and controls the other components
- For this project, any board should work well (although for me having more than one 5v pin is better as the LCD should have a separate 5v power supply, if it is connected to the same power pin as another component, the LCD display may become dimmer)
The board I use for this project is a similar one to the Arduino Mega 2560 board |
Breadboard
The breadboard is used to connect some of the components and wires, and makes it easier to use (rather than soldering the wiring together). This breadboard is a small one, because for this project I made the system more compact so it fits in the casing. For some cables I directly connect it to the other components, instead of connecting it through the breadboard.
Breadboard |
Documentation
In this project I also made a model house for the demonstration
For this sensor system, I also made a cover for the system using Lego