Arduino Uno Water Alarm

by jjclark076 in Circuits > Arduino

3591 Views, 0 Favorites, 0 Comments

Arduino Uno Water Alarm

Screen Shot 2022-05-14 at 7.03.24 PM.png
Arduino Uno Water Alarm

Frequent flooding in your area? Use this simple Arduino Uno Water Alarm to alert you if it senses water in your basement! This is a beginner-level project that utilizes a Water Level Detection Sensor Module and a Passive Buzzer. This useful tool uses the passive buzzer to give a warning buzz for a light amount of water and a full panic alarm (higher-pitched constant buzz) when more water is detected. These levels can be adjusted to your liking through quick changes to the code.

Credits to:

ElectroPeak. (2019, September 29). Make a Liquid Level Indicator with Arduino. Arduino Project Hub. Retrieved May 14, 2022, from https://create.arduino.cc/projecthub/electropeak/make-a-liquid-level-indicator-with-arduino-596bd3

Supplies

  • 1 - Arduino Uno
  • 1 - Water Level Detection Sensor Module
  • 1 - Passive Buzzer
  • 5 - Female-to-Male Dupont Wires
  • Water (for testing)

Connect Water Level Detector

Screen Shot 2022-05-14 at 7.32.07 PM.png
Screen Shot 2022-05-14 at 7.31.28 PM.png

Using 3 of the Female-to-Male Dupont Wires, connect the Water Level Detector. The negative leg (-) goes to the ground on the Arduino Uno. The positive leg (+) goes to the 5V power on the Arduino Uno. The Analog Signal (S) goes to the analog in on the Arduino Uno, specifically in port A0.

Connect Buzzer

Screen Shot 2022-05-14 at 7.31.51 PM.png
Screen Shot 2022-05-14 at 7.31.17 PM.png

Using the two remaining Female-to-Male Dupont Wires, connect the Passive Buzzer. The negative leg (-) goes to the ground on the Arduino Uno. The positive leg (+) goes to port 9 on the Arduino Uno.

Finishing Touches

Screen Shot 2022-05-14 at 7.31.40 PM.png
Screen Shot 2022-05-14 at 8.08.34 PM.png

Load the sketch (below in multiple formats) into Arduino Create and connect the Arduino Uno.


Link: https://create.arduino.cc/editor/jodi_clark/6687257a-940b-4726-baff-d8230c00e40a/preview

Copy & Paste:

* Edited Code from: 

* Rain Detector with Water level sensor

 * by Hanie kiani

 * https://electropeak.com/learn/  

 */

const int sensorMin = 0;   // sensor minimum

const int sensorMax = 1024; // sensor maximum

const int buzzer = 9;

void setup() {

 Serial.begin(9600);  

 pinMode(buzzer, OUTPUT);

}

void loop() {

int sensorReading = analogRead(A0);

Serial.println(sensorReading);


if (sensorReading>=300){ // Sensor is wet

 Serial.println("Wet!");

  tone(buzzer, 5000);

}

else if (sensorReading>=250){ // Sensor getting wet

 Serial.println("Warning!");

  tone(buzzer, 1000,5);

}

 else  { // Sensor dry 

  Serial.println("Dry");

  noTone(buzzer); 

 } 

 delay(10); // delay between reads

Test Run

Screen Shot 2022-05-14 at 7.32.23 PM.png
Screen Shot 2022-05-14 at 7.32.43 PM.png
Screen Shot 2022-05-14 at 7.32.33 PM.png

The final step is to use water for a test run. Put the water sensor into the water and hear the alarm sound depending on how deep it is in your test water. If you would like the alarm to sound with either higher or lower water levels, you can adjust accordingly with the code (sensorReading>=300 & sensorReading>=250). Once you are satisfied with your water levels, place in your basement so it can alert you if the water starts a floodin'!