How to build a plant monitor with Arduino




As a preview of his latest book, Arduino Project Handbook: 25 Practical Projects to Get You Started, Mark Geddes takes us through the project to create a simple plant monitor.

How to build a plant monitor with Arduino




In this project I’ll introduce a new type of analog sensor that detects moisture levels. You’ll set up a light and sound alarm system (an inexpensive piezo buzzer) to tell you when your plant needs watering

See alsoHow to build a laser trip wire alarm with Arduino

How it works

You’ll use an HL-69 moisture sensor, readily available online for a few dollars. The prongs of the sensor detect the moisture level in the surrounding soil by passing current through the soil and measuring the resistance. Damp soil conducts electricity easily, so it provides lower resistance, while dry soil conducts poorly and has a higher resistance.

The sensor consists of two parts, as shown below.

The two pins on the sensor need to connect to the two separate pins on the controller (connecting wires are usually supplied). The other side of the controller has four pins, three of which connect to the Arduino.

The sensor consists of two parts

 

The HL-69 moisture sensor prong is pictured first, followed by the controller underneath it.

The four pins are, from left to right, AO (analog out), DO (digital out), GND, and VCC (see pic below). You can read the values from the controller through the IDE when it’s connected to your computer.

How it works

This project doesn’t use a breadboard, so the connections are all made directly to the Arduino.

READ  IOT Lighted Xmas Tree

Lower readings indicate that more moisture is being detected, and higher readings indicate dryness. If your reading is above 900, your plant is seriously thirsty. If your plant gets too thirsty, the LED will light and the piezo buzzer will sound.

This project doesn’t use a breadboard

The build

1. Connect the sensor’s two pins to the + and – pins on the controller using the provided connecting wires, as shown below.

The build

2. Connect the three prongs from the controller to +5V, GND, and Arduino A0 directly on the Arduino, as shown in the following table. The DO pin is not used.

The DO pin is not used

3. Connect an LED directly to the Arduino with the shorter, negative leg in GND and the longer, positive leg in Arduino pin 13, as shown below.

plant-monitor-figure-5-4-1024x383

plant-monitor-figure-5-4-1024x383

4. Connect the piezo buzzer’s black wire to GND and its red wire to Arduino pin 11.

plant-moniutor-table-3

5. Check that your setup matches that below, and then upload the code in “The Sketch” (see below).

plant-moniutor-table-3

6. Connect the Arduino to your computer using the USB cable. Open the Serial Monitor in your IDE to see the values from the sensor – this will also help you to calibrate your plant monitor.

The IDE will display the value of the sensor’s reading. My value was 1,000 with the sensor dry and not inserted in the soil, so I know this is the highest, and driest, value. To calibrate this value, turn the potentiometer on the controller clockwise to increase the resistance and counterclockwise to decrease it (see pic above).

When the sensor is inserted into moist soil, the value will drop to about 400. As the soil dries out, the sensor value rises; when it reaches 900, the LED will light and the buzzer will sound.

READ  BLINKING AN LED USING AN ARDUINO UNO (EXPLAINED)

Turn the potentiometer to calibrate your plant monitor:

Turn the potentiometer to calibrate your plant monitor

The Sketch

The sketch first defines Arduino pin A0 so that it reads the moisture sensor value. It then defines Arduino pin 11 as output for the buzzer, and pin 13 as output for the LED. Use the Serial.Println() function to send the reading from the sensor to the IDE, in order to see the value on the screen.

Change the value in the line

if (analogRead(0) > 900) {

depending on the reading from the sensor when it is dry (here it’s 900). When the soil is moist, this value will be below 900, so the LED and buzzer will remain off. When the value rises above 900, it means the soil is drying out, and the buzzer and LED will alert you to water your plant.

The Sketch

Parts list for the plant monitor

  • Arduino board
  • Jumper wires
  • LED
  • HL-69 hygrometer soil moisture sensor
  • Piezo buzzer

Parts list for the plant monitor

Extracted from the Arduino Project Handbook, written by Mark Geddes and published by No Starch Press. It is described as a beginner-friendly collection of electronics projects using the low-cost Arduino board, and it’s highly recommended by Gadget Master!

arduino-project-handbook_cover-front

See alsoHow to build a laser trip wire alarm with Arduino

See alsoGadget Book: The Arduino Project Handbook

All images: Arduino Project Handbook, © 2016 by Mark Geddes

Source: How to build a plant monitor with Arduino




Leave a Comment

*
= 4 + 6

(Spamcheck Enabled)

Read previous post:
Web Enabled 4 Wheeled Robot using a Photon

Expanding upon MKR1000 based Robot project, I created this 4 wheeled Robot. Things used in this project Hardware components Particle...

Close
Scroll to top