loading

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). It will demonstrate the functionalities, building process, circuitry, and sketch of my Plant Waterer. The Plant Waterer is able to automatically water a plant(s) based on the dryness of its soil. This dryness is determined by a humidity sensor. An LCD screen shows the data retrieved from the sensor and shows when the device is watering your plant. Furthermore, a 3-d printed indicator attached to a servo motor shows how moist the soil is. Four LED lights light up indicating where the servo is positioned.

Step 1: Building Process

The Plant Waterer is constructed from five 3d printed parts, 1/2" tubing, a humidity sensor, a servo motor, four LED lights, an LCD screen, a solenoid valve, and an Arduino Uno microprocessor. The five 3d printed parts are the electronics container, the reservoir, an adapter connecting the reservoir to a 1/2" tube, a lid to the reservoir, and an indicator attached to the servo motor. The container at the bottom houses all the electronics and contains strategically placed cuts to display the LCD screen, LED lights, and Indicator and allow inputs such as power and the humidity sensor to be connected to the microprocessor inside. The reservoir's function is to hold the water inside while the plant is fully watered. It is lined with plastic to stop the water from wearing away at the plastic over prolonged use. The adapter connects this reservoir to the tubing housed inside the electronics container. These components were glued together and a sealant was applied to keep the water from leaking out. The tubing is then sealed to the solenoid valve inside the electronics container. The other side of the valve protrude out through a hole on the side of the deice and another tube is connected to that and sealed to minimize leakage. This tube is put over the plant intended to be watered. An optional nozzle can be attached allowing the water to "shower" the plant simulating rain. The humidity sensor is put deep into the soil of the plant to get an accurate reading of its dryness. Finally, the 3d printed indicator is glued on to the moving peg of the servo motor through a hole.

Step 2: Circuitry

The circuitry starts with the input of the moisture sensor. This is connected to pin A0 of the Arduino board and the power is connected to the power rails of the bread board. These power rails are connected to the ground and 5v of the Arduino board. The servo motor is connected to these same power rails and pin 9. Four LED lights are connected to pins 4-7. The solenoid valve requires a separate power rails because it needs 12v. Two 9 v batteries are connected to these power rails in series to provide the correct voltage. A transistor, diode, and resistor are also connected to allow the Arduino to control when current flows to the valve.

Step 3: Sketch

Here is the sketch the Arduino board runs. The code essentially determines what the reading from the humidity sensor is and compares it to the moisture limit reading. If it is greater, than it runs the openValve loop. If it is less, then it runs the writeSensor loop. The openValve loop opens the valve and flashes the word watering a number of times determined by the variable blinkCount before closing the valve. The writeSensor loop simply displays the sensor reading on the LCD screen. If the moisture reading is less than the moisture limit, a number of if statements are run to determine which LED light should light up and where the servo would be positioned.

//Author: Nick Brown

//Revised: 12/3/15

//Semester: Fall 2015

//Include statements

#include

#include

#include

LiquidCrystal_I2C lcd(0x27,16,2);

#define servopin 9 // Defines servo motor as pin 9 Servo indicator;

int valvePin = 10; // Solenoid valve is connected to pin 10

int moistureLimit = 450; // The limit of moisture before the plant needs to

//be watered is 450

int greenLimit = 350; // The limit of moisture that the green LED lights up

int yellowLimit = 400; // The limit of moisture between the first and second

// yellow LED lights

int blinkCount = 4; // represents the amount of time the message "watering" will

// blink before the valve closes

int greenled = 7; // Green LED is connected to pin 7

int yellow1led = 6; // First yellow LED is connected to pin 6

int yellow2led = 5; // Second yellow LED is connected to pin 5

int redled = 4; // Red LED is connected to pin 4

void setup() {

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

lcd.init();

lcd.backlight();//turns the backlight on

pinMode(valvePin, OUTPUT); // Defines valve and LED lights as outputs

pinMode(greenled, OUTPUT);

pinMode(yellow1led, OUTPUT);

pinMode(yellow2led, OUTPUT);

pinMode(redled, OUTPUT);

indicator.attach(servopin); // attaches servo motor to pin

delay(1000); //wait 1000msec }

void loop() {

// read the input on analog pin 0:

int moistureValue = analogRead(A0);

Serial.println(moistureValue); // If statement tells wether the moisture reading is higher than the

// moisture limit. If so, the loop open valve will run, the red LED will

// light up, and the servo motor will be positioned at angle 0.

if (moistureValue > moistureLimit)

{

digitalWrite(redled,HIGH);

digitalWrite(yellow1led,LOW);

digitalWrite(yellow2led,LOW);

digitalWrite(greenled,LOW);

indicator.write(0);

OpenValve (valvePin);

}

// If if statement is not concluded, the writesensor loop will run

// and a series of if statements will run determining how moist the

// soil is. These statements will tell wich LED light needs to be lit

// and what position the servo motor should be in.

else

{

writeSensor(moistureValue);

digitalWrite(redled,LOW);

if ( yellowLimit > moistureValue)

{

if (greenLimit > moistureValue)

{

digitalWrite(greenled,HIGH);

digitalWrite(yellow2led,LOW);

digitalWrite(yellow1led,LOW);

indicator.write(180);

}

else

{

digitalWrite(yellow1led,HIGH);

digitalWrite(greenled,LOW);

digitalWrite(yellow2led,LOW);

indicator.write(120);

}

}

else

{

digitalWrite(yellow2led,HIGH);

digitalWrite(yellow1led,LOW);

indicator.write(60);

}

}

}

// Open Valve loop runs when the soil is too dry

void OpenValve (int pinNum) {

// valve opens

digitalWrite(pinNum,HIGH);

// The LCD screen flashes the word watering blink count times

// before the valve is closed.

lcd.clear(); for (int i = 0; i < blinkCount; i ++)

{

// Print watering on the display

lcd.print("Watering");

delay (1000);

// Turn off the display:

lcd.noDisplay();

delay(500);

// Turn on the display:

lcd.display();

delay(500);

lcd.clear();

}

digitalWrite(pinNum,LOW);

}

// writeSensor loop runs when soil is wet enough

void writeSensor(int sensorData)

{

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

lcd.print("Sensor ");

lcd.setCursor(0, 1);

// print the moisture reading passed in the sensorData parameter:

lcd.print(sensorData);

}

<p>Nice project,What is the function of the servo motor?</p>
<p>Great way to keep the plants alive while you aren't home. </p>

About This Instructable

778views

10favorites

License:

More by NickB77:Automatic Watering System 
Add instructable to: