Introduction: Moisture Sensor Water Conservation

Learn how to code and wire a system that can be implemented in a water tank to monitor water use. When the water level drops below a certain point, the moisture sensor detects the drop and an LED blinks to alert the user.

Step 1: Step 1: Wiring

  • Connect the moisture sensor pins to the Arduino.

VCC - 5V

GND - GND

DO - Unconnected

A0 - any analog terminal (A0-A5)

Step 2: Step 2: Coding

Enter the following code into Arduino:

const int LED= 11;//Digital pin that the LED is connected

void setup(){ Serial.begin(9600); pinMode(LED,OUTPUT); }

void loop() { int sensorReading= analogRead(A0); //reads the sensor value

Serial.println (sensorReading); //prints out the sensor reading

if (sensorReading > 800){//if reading is above 800, LED blinks on and off digitalWrite(LED,HIGH); //turns the LED on delay(1000); //waits for a second digitalWrite(LED,LOW); //turns the LED off delay(1000); //waits for a second } }

Now upload it to your Arduino.

Step 3: Step 3: Test Run

Open the Serial Monitor in Arduino and test the moisture sensor by dipping into and removing it from water. The values you get when the sensor is out of water should be high and the values you get when the sensor is in the water should be lower. Tweak the code accordingly if you need to.

Step 4: Step 4: Assemble Model

Put together the components of project. We intended this project for a shower system such that if the water in a the tank drops below a certain point, the shower user could be alerted. This system can be adapted to be used in various different situations.

Comments

author
DIY Hacks and How Tos (author)2017-08-12

Cool project. It would also be interesting if there was a way to track how quickly the water is being used and alert the user if it is being used too quickly.

About This Instructable

75views

2favorites

License:

More by MaryamK14:Moisture Sensor Water Conservation
Add instructable to: