garduino automated gardening system

21
Garduino-Automated Gardening System Step 1: Build-Moisture Sensors

Upload: chiramel-mathew-simon

Post on 30-Aug-2014

1.065 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Garduino    automated gardening system

Garduino-Automated Gardening System

Step 1: Build-Moisture Sensors

Page 3: Garduino    automated gardening system

The moisture sensors rely on the resistivity of water to determine the moisture level of the soil.  The sensors measure the

resistance between two separate nails by sending a current through one of them and reading a corresponding voltage drop

due to a known resistor value.  The more water the lower the resistance, and using this we can determine threshold values

for moisture content.

We will use three such sensors and use a multiplexor to alternate reading between them without using more than one

arduino analog port.While we will include a circuit board diagram, we recommend building the circuits on a breadboard first

which will allow for both understanding and debugging.  Each sensor uses two nails, a 100 ohm resistor, and a 100 K-ohm

resistor.  We built a casing for each sensor with acrylic tubes, however this is not necessary.

Step 2: Build-Moisture Sensor- 1

Page 4: Garduino    automated gardening system

The first step is to find two equal length nails of any type, although we found that longer and non-galvanized nails worked

best (galvanized nails do not work at all).  Next, a wire needs to be soldered to each nail.  It is best to use weaved wire since

it is  flexible and less likely to break during use.  The nails act as a heat sink, and to counteract this they must be heated

Page 5: Garduino    automated gardening system

before soldering.  A hotplate was used to get the nails very hot.

A word of caution, as the name implies the hot plate gets extremely hot, as will the nails, so please use pliers to remove the

nails from the hotplate.

It is useful to shrink wrap the soldered parts of the nails, especially if you are not planning to make a probe structure.

Step 3: Build-Moisture Sensor-2

The next step is to wire the nails to the arduino.  Use the circuit diagram provided.  The sensor works by sending a fake AC

current by alternating DC current between the two nails.  The analog voltage is then read and a moisture level can be

inferred.  Our code for the whole project will be available.   A picture of the finished sensor with acrylic covering is on the

next page.

We read an input voltage into a multiplexor from a voltage dividor created by the 100K resistor. The 100 Ohm resistor,

attached to the other lead of the sensor, is used for current limiting. Current limiting imposes an upper limit on the current

coming into the arduino, which protects it from short-circuiting.

Step 4: Build-Moisture Sensor-3 (optional)

Page 6: Garduino    automated gardening system

Take a hollow acrylic tube and attach it to a pointed front with two holes for nails. Seal the bottom from water with silicone

glue. Make sure that the nails are not touching as this will short the circuit.  Use a rubber stopper to seal the top.  It is

Page 7: Garduino    automated gardening system

important that the nails be equal distances apart on each of the moisture sensors, as any variation could affect resistivity

readings from one or more of the probes. 

Step 5: Build-Moisture Sensor-4

To improve performance we used three soil moisture sensors.  However, there may not be enough analog pins on

the arduino to accommodate all of these depending on what other attachments you are using.  We solved this problem by

using a multiplexer, which allowed us to switch between and read from each of the three pairs of sensors. The circuit

diagram is given below.

Step 6: Build-Temperature Sensor -1

Page 8: Garduino    automated gardening system

For the temperature sensor we used a TC-74 chip.  The wiring here is pretty simple and is shown below.  It is recommended

that you use 1K resistors on the ports connecting to the arduino (SDA, SCLK).  The sensor works by exposure of the chip's

metal tab. Attaching this metal tab to a piece of sheet metal will increase the sensor's sensitivity over a wider area and

improve performance. 

Temperature readings are used to normalize soil moisture content readings, since higher temperatures will increase

resistivity between the nails, potentially giving inaccurate readings. It is important to correct for temperature so the arduino

will trigger watering at the appropriate time. 

Step 7: Build-Circuit Board

Page 9: Garduino    automated gardening system

Make a circuit board.  The schematic is shown below and the board file is attached.  We used the program EAGLE to design the board,

and the files are in that format.

Step 8: Build-Pump System-Relay

Page 10: Garduino    automated gardening system

The pump system we created uses a small fountain pump attached to the arduino with a solid state relay, allowing the

arduino to turn the pump on or off automatically.  Strip off a segment of the pump's insulating tubing, and cut only one of the

inner wires in half.  Attach each end of the newly cut wire to the relay's two outputs.  Be careful to avoid touching any

Page 11: Garduino    automated gardening system

exposed metal on the relay, as it is at a high voltage. We recommend putting electrical tape over the exposed wires.  Finally,

connect the relay's ground to the the arduino's ground and the relay's input to an arduino digital pin (in our case 5). 

Step 9: Build-Pump System-Reservoir

Page 12: Garduino    automated gardening system

The submerged pump needs a constant amount water to function properly.  To automate this process we used a float valve

that attaches to a hose and opens when water is needed and closes when the water level rises.  Make sure to drill the hole

high enough to give the float valve room, and that the tank is wide enough to accommodate the float.

Page 14: Garduino    automated gardening system

Drill small holes through a length of plastic tubing that is the correct size for the pump.  Then cut pvc pipe into 5-8 inch

segments, punch small holes through their centers, and thread the plastic tubing through the holes.  These will be staked in

the earth and provide a stable base for the tubing.  One may want to put a point on the bottom of the small pvc pipes so they

are easier to stake.  There are many other ways to build the sprinkler system, so check out your local hardware store for

some inspiration.

Step 11: Connect

Page 16: Garduino    automated gardening system

When connected, the circuit should look like this.  Note: this picture includes a wifly shield that will hopefully be implemented

in the future.  Notice that we connected the relay to the wifly shield.  It would be better to put this on the board, however, this

was an oversight on our part. 

Page 18: Garduino    automated gardening system

We then used a regular plastic box 15x10x6 cm to enclose the circuit board and a separate box to enclose the relay.  The

arduino and relay need to be protected from the elements if they are to be placed outside in a garden. This separation

allows the relay to get very hot but not damage the circuit board, however, it should not get very hot if using the code

provided at the end.

Step 13: Code

The garduino uses arduino and python programs that interact with one another through the library pySerial. The arduino

checks the soil moisture content and if low, triggers the python web scraper and find tomorrow's weather forecast.  If the

forecast includes rain, python tells the arduino to delay checking soil moisture content for the next 24 hours.  If the forcast is

dry then the arduino will be triggered to water.  After this, the system will recheck soil moisture content every twenty minutes

to see if more water is needed.  if water is not needed at the initial watering check, or after a recheck, the system waits for

24 hours and the process is repeated.

For the scraper to work, you need to download and install:

- BeautifulSoup

- urllib2

- pySerial

I would recommended creating a github account (https://github.com/) and pulling everything from github. 

We used yahoo's weather api to find tomorrow's forecast: http://developer.yahoo.com/weather/

Look here for some good documentation:

- http://www.crummy.com/software/BeautifulSoup/ (Beautiful Soup documentation)

- http://www.regular-expressions.info/ (Regular Expressions, useful for parsing html)

- http://www.linuxforu.com/2012/03/building-image-processing-embedded-systems-using-python-part-3/ (best example of

pySerial I found...much better than pySerial's documentation) 

- http://www.akeric.com/blog/?p=1140 (another good example of pySerial) 

Thanks to Joseph Long for help with the code.

Step 15: Further Improvements

Further improvements include implementing the wifly shield as well as doing a better calibration of the moisture sensors. 

The value that we have for the necessary moisture content to water is estimated and a more careful analysis would help

conserve even more water. We would also like to plot real-time data from our garduino using matplotlib and ipython.