home |  electronics |  toolbox |  science club |  tuxtalk |  photos |  e-cards |  online-shop

http://tuxgraphics.org/electronics




Content:
By Guido Socher

 

Remote flower watering and monitoring

[Illustration]

Abstract:

Every time I go on vacation I find myself investigating who could look after the flowers in the house and the vegetables in the garden.

This year I decided to built an electronic system. Now now it is possible to water indoor potted plants and flower/vegetables in the garden remotely over the internent.

With this system one can monitor temperature and soil humidity. It gives then the possibility to water the plants remotely over the internet. All this can be done from any PC or mobile phone. The tuxgraphics Ethernet board with the appropriate web server software makes it possible.

_________________ _________________ _________________

 

Not only a toy system

I did my first experiments with automatic flower watering as a boy. I used cotton strings to connect my plants to a bottle of water. This system is very simple but works never because it does not adjust to the demands of the plants. It is either always too wet or always too dry.

When I was older I experimented with Hydroponics. Here the plants grow on artificial soil with a bit of fertilizer in the water. It's not a very natural way of growing plants. It makes a difference especially for edible plants. Vegetables grown on real soil taste much better and are probably much healthier.

We need a system to remotely water the plants rather than watering them automatically. Sometimes you know from the weather forecast that it will rain the next day. In other words you don't want to unnecessarily overwater the plants. The system should be compatible with normal potted plants and garden plants (no special soil).
 

Monitoring flowers and other plants

There are many sources of information that you want to use when you monitor plants remotely. The temperature in the area next to the plants, especially when plotted as a graph over time, can give you a fairly good feeling when to water the plants.

Soil humidity is the other important component. If it is not too hot then plants can grow in fairly dry soil. However when the sun shines straight onto the plants then they need moist soil.

The weather forecast is also a very good source of information. You might not need to water the plants if there is a rain or thunderstorm coming. There are many people who apply too much fertilizer and then they apply too much water to save the plants from burning in the sun on salty and fertilizer rich soil. Grass can generally be mistreated this way but herbs, vegetables and flowers need a more natural treatment to grow nicely.

I recommend to water the plants in the evening. The water can then soak in during the night. If you water during the day then most of the water will evaporate immediately especially on a sunny day.  

How to measure soil humidity?

I have seen many soil humidity measurement systems that try to use just two metal bars and measure the ohmic resistance between them. One can also buy cheap humidity meters in garden centers and they use metal electrodes with two different metals. When the soil is wet then this will become a "battery" and they measure the current that is generated. Don't use metal electrodes. You will have to run a small current between the metal bars even if you want to just measure the ohmic resistance. This will cause the metal to de-compose during the electrolysis that was started here. Electrolysis can corrode almost any metal. If we use stainless steal for the metal bars then it will be even worse because we would poison the soil with heavy metals.

Those heavy metals in the soil might be tolerated by the plants for a while but we really don't what to have those in the vegetable garden.

a long 5mm graphite electrode
A long 5mm graphite electrode


Pure graphite is a fairly good conductor, it does not corrode in salty environments and it does not decompose under electrolysis. I used two 5mm diameter graphite electrodes and a potted plant for testing purposes.

graphite electrodes in a potted plant
The graphite electrodes in a potted plant


I observed the behavior over a couple of weeks with an ohmmeter and I was fairly disappointed. The change in ohmic resistance depends to a fairly small degree on the humidity of the soil. The ohmic resistance changes only by a few percent when going from dry to wet soil. What made me finally discard this idea was the observation that the ohmic resistance changed a lot when I added a few drops of fertilizer to the water. In other words you really measure here how salty or sour the soil is. You don't really measure humidity at all.

The graphite does not contaminate the soil but a DC current between the graphite bars still causes an electrolysis. If there is e.g a bit of NaCl (table salt) in the soil then you get chlorine gas on one electrode and hydrogen gas on the other. The amount is very small. You can't smell it but you can notice it on the ohm meter. The longer you measure the higher the resistance becomes. The ohm meter starts to drift. This is because the tiny gas bubbles that form along the electrodes insulate them a bit.

Although this experiment failed it was still very interesting. It means that you can't really trust any equipment that uses two metal or graphite electrodes for soil humidity measurement.

I started to investigate other ideas such as optical humidity measurements. You might have noticed that paper becomes slightly transparent when wet and my idea was that I could use a similar effect in other materials.

One day I had a pack of electrolytic capacitors in my hand and suddenly I knew how to measure humidity. Those electrolytic capacitors consist essentially of two insulated metal plates and in-between there is a salty liquid. In poorly engineered computer motherboard you might have noticed that electrolytic capacitors that are too close to a heat source such as the CPU leak over time. If you then take one of those leaking capacitors out and measure them then you will notice that the capacity values are off a lot. There is a huge capacity difference between a new "wet" electrolytic capacitor and one that has dried out. It should be possible to use this effect for soil humidity measurements.

Painted PCBs
Two pieces of PCB insulated and painted with clear coat.


I took two unused sheets of PCB (2.5cm x 10cm [about 1inch x 4inch]) and sprayed them with a clear coat paint can. Normal transparent car paint. Any paint spray for cars will probably work. This gives a nice thin and well insulating film of paint. If you can't find any unused PCBs then you can take as well some sheet metal. It should be brass, iron or copper. Something that is solderable because you need to connect wires to it. You can cut e.g two sheets out of a vegetable oil can and round off any sharp edges with a bit of sand paper. Solder a wire to each of the sheets and then spray the sheets with a paint can. Take care to not hurt yourself when cutting the sheets out of the vegetable oil can. Wear good gloves.

Dig a little hole in the soil and insert the two metal sheets. They should be about 1cm to 2cm apart. Fill back the soil and compress it just a little bit.

The capacitor is now ready. It will have a capacity of around 5-10nF when the soil is dry and up to 20nF when it is wet.

There is a little bit of a dependency on the concentration of salts and minerals in the soil. The capacity seems also to depend a bit on the temperature. These disturbances are however small and a change in the soil's humidity changes the capacity values a lot. As we do not run any permanent DC current through the soil we will not decompose the minerals.

I had also the idea that one could not put soil between the electrodes but rather some sponge or membrane like material such that only the water from the surrounding soil gets between the electrodes and not any "dirt". The above design with two simple insulated electrodes in the soil is however working very well and it is robust enough for outdoor use.

capacitive humidity sensor in action
The capacitive humidity sensor in action

DS18S20 1-wire temperature sensor  

Measuring temperature

All chemical processes such as plant growth depend on temperature. A rule of thumb is that the "speed" of a chemical reaction doubles when the temperature increases by 10'C. When it is warmer the plants will need more water because they grow faster and more water will evaporate. Over time one gets a good feeling for the amount of water that will be needed just by looking at the temperature curve.

We use here the DS18S20 sensor. It is a calibrated digital temperature sensor.  

The electric watering can

The most obvious solution is to attach a small electric water pump to a relay. When it is time to water the plants then the relay controlled by the tuxgraphics Ethernet board will close its contacts and provide power to the pump.

The pump can be connected to a small canister or even a rain barrel. Note that many water pumps require the water to flow freely into the pump and then they can pump it up to a higher level. In other words you should connect any pump to the bottom of the rain barrel. Pumps will not totally block the water flow when they are off. A lawn sprinkler connected to the pump will therefore need to be placed higher up on a post. At a level that is equivalent to the top of the rain barrel.

For indoor plants and all potted plants I recommend to use a small electrical pump.

To get such a pump was more difficult to get than I thought. There is no measure for the quality and efficiency of such pumps. You have generally no idea what power consumption it has until you really test it.

My first idea was to use a car windscreen washer pump. Those pumps are cheap and they can be found everywhere. I was very disappointed when I tried different models. It seems the car industry had never a need for a clever and efficient design. All of them consume at least 5 to 10 ampere at 12V before they even move one drop of water. What a waste of energy. They are unusable for our purpose because it has a knock-on effect on all other parts. You need a stronger power supply, a relay rated for 20A or more and appropriate shielding to protect the sensitive electronics and the Ethernet magnetics from the electric and magnetic fields that you generate when you switch the pump on or off.

After searching for quite a while I found two online shops that sell suitable water pumps.

As you can see a good pump needs less than 100mA at 6V. This does of course not generate a strong water jet but we don't want to excavate our plants either.

I ordered from both shops but I used for the potted plant watering system the pump from siliconsolar.com.

solar water pump
The submersible water pump from siliconsolar.com I attached a short hard
plastic tube to the hose and I bended it like a little hook at the end.


This little pump goes then into a 3L plastic container and the electric watering can is ready. 3L of water quite sufficient for a single potted plant. It will be enough for several weeks.

electric watering can


For my first tests I used a small palm tree. Here is my "test plant" with the electric watering can.
"test plant" with electric watering can


This electric watering can is made for a single plant. If you want to water two plants then you use a T-tube connector and run from one pump hoses to both plants. This solar water pump needs very little energy but it is als not very strong. To water more than two plants you would need more pumps.

When I am absent during vacation then I will rather put most of the plants outside where I have the lawn sprinkler attached to the above magnetic water valve. I can then water the potted plants at the same time as the vegetables in the garden. You just have to be careful where you put the plants outside. Some indoor plants are not used to direct sun light. They grow better in shade.  

Lawn watering and electric sprinkler valves

Pumps are however not the only solution. All washing machines and dish washers have a magnetic water valve. It opens when you connect it to straight line power and otherwise it is closed. In most cases this valve is somewhere inside the machine. Some european Miele dish washers have an external valve. It can be connected directly to the water tap. It is easy to take it off an old machine on a scrap yard or when somebody puts an old one on the curb for the city to collect it.

Such a valve allows you to water a larger area such as a vegetable garden. Note that washing machines and dish washers are build for indoor use. Make sure you protect this valve as well as the relay to control it from direct exposure to rain otherwise you risk to get an electrical shock.

magnetic water valve
A magnetic water valve taken from an old dish washer. It connects
directly to the water tap and you can attach a garden hose to it.


Valves from dish washers and washing machines make a nice hobby solution but the have the big problem that they require full line power (120V or 230V) and that means you can't use them safely outdoors. If you want to build a full professional garden watering system then look for 24V electric sprinkler valves. They come in various forms sometimes even in little boxes to hide them in ground at the corner of your lawn.

sprinkler valve box Gardena sprinkler valve a 24V sprinkler valve
Different 24-volt lawn sprinkler valves.


The advantage of those sprinkler valves is that they run with 24V which is more or less save for outdoor use.

The ethernet board with a relay to control the valve can then be located inside the house. Some generic laptop power supplies can be used as an inexpensive power source for the sprinkler valve. You would then run the cable from the sprinkler valve into the house and connect it there via the relay to the laptop power supply brick and to the tuxgraphics ethernet board. After that you are ready to water your lawn over the internet.

The sprinkler valves have a solenoid (electromagnet) that can work with both AC and DC voltages. Most control equipment uses 24V AC. If you use DC then the valves work with much lower voltages. 16V to 20V DC will normally be enough for reliable operation of the sprinkler valve. A sprinkler valves consumes about 0.4A to 0.6A current when powered with 16V to 20V DC.

orbit sprinkler valve
An Orbit sprinkler valve connected to a graden hose for testing purposes.
The other side (water output) is just left open.


orbit sprinkler valve on
Power-on and water flows. The sprinkler valve works. We can now install it properly.
 

The circuit

We have now discussed external components such as sensors and pumps. How do we connect all this to the tuxgraphics Ethernet board?

To use the capacitive humidity sensor we need to generate a tone and then run it through a capacitive voltage divider. One of the capacitors in this voltage divider is the humidity sensor. All we need to do then is measure the voltage after the divider and it is somehow proportional to the soil humidity.

The only problem is that we don't have here a DC voltage. It has to be an alternating voltage (a tone) and the microcontroller can not measure AC voltages. The solution to this is to add a precision rectifier circuit and convert AC to DC. This is what the circuit in the upper left part of the diagram does. The rest of the circuit is just the standard tuxgraphics Ethernet board. To simplify the drawing I have omitted most of the components on the Ethernet board.

circuit diagram
Click on the diagram to open it as high resolution PDF file.


The amplifier circuit looks bigger than it is. All this fits onto the dot matrix field of the tuxgraphics Ethernet board.

ethernet board with precision rectifier circuit


The whole circuit is very compact and fits easily into a little plastic box. You just attach the sensors and the watering can via a 6V relay. I recommend to not try to design this water proof. It is better to have air circulating freely. The best place for the circuit is in the house or in a small garden shed.  

Switching on/off an electromagnet

1n4001 as flyback diode Switching on and off a devices that contains a large coil causes high voltages to be induced. The sprinkler valves contains large coil. If we just switch it on and off with the relay then the contracts on the relay will wear off quickly, you will hear a click on the radio and it can cause interference with the electronics on the ethernet board. It can even destroy the insulation around the wire of the coil.

To prevent this one needs to add a suppressor diode known as flyback diode. If you power the coil with AC voltage instead of DC then you can insert a resistor instead of the diode. The best solution is however a diode and DC current as it is much more efficient. The below circuit diagram shows how to insert the diode.

add a flyback diode
A flyback diode is used to eliminate the sudden voltage spike across an inductive load.

 

Flower and lawn watering over the internet

The remote watering system is completely web based. You can access it from any desktop PC as well as any mobile phone with integrated web browser.

The tuxgraphics Ethernet board provides a web server. To access it remotely over the internet you will need a DSL router that allows for port forwarding. Most DSL routers can do that. To know where your remote watering system is you will either need a static IP address or a DSL router that can interwork with dyndns.org. A static IP is the best and most reliable solution. Some DSL service providers offer static IP addresses for a small extra fee.

Here are some screen-shots of the remote watering system.

the main window
This shows the main window. From here you can get to all other pages and you can see current sensor readings. We don't measure the humidity in absolute calibrated units. Humidity is displayed as an 8bit value (0-255). After observing the values for a couple of days you will be able to give a meaning to those values and decide what is dry, normal and wet. Those ranges can then be entered in the "levels" dialog screen.


humidity level adjustment
You can adjust the humidity levels. The red LED on the Ethernet board
will start to blink when the soil humidity goes below dry.


pump control
The water control dialog. For a potted plant you would specify a value
in the order of a few seconds. To water the lawn you can enter large values like 1200s (=20min).


graphs
You can see several days of history in graphical form. A trend can be observed easily.
The most recent reading is shown on top. The graphs show a history of 10 days.


The software for the tuxgraphics avr ethernet board is called eth_rem_flowercare. You can download the software at the end of this article. To load it you need an avr-gcc compiler and a programmer like e.g the avrusb500.  

On the road: flower and lawn watering with the phone

Here is how you can take care of your flowers while you are on the road. It works even with a basic data phone:

flower care on the road flower care on the road flower care on the road flower care on the road

... of course it works also on the iphone:

lawn and flower watering with the iphone lawn and flower watering with the iphone
 

Conclusion

It's really good to be able to water the garden where ever I am. It's even fun to sit in the living room and turn the lawn sprinkler on with the mobile phone.  

References/Download





© Guido Socher, tuxgraphics.org

2009-09-28, generated by tuxgrparser version 2.57