Happy Farming . com
How to Grow Your Own Food
-
Jul 16

It pays to watch the soil moisture closely if you want large vegetables. I’ve had good results this year using my garden logging system. Actually my vegetables have gotten a little out of hand. I think the cat is a bit scared too
:
I’ve been kind of obsessed with soil moisture now that my logging system is up and running. I’ve checked the log a couple of times a day, and when the moisture level was low I ran out and turned on the sprinkler. I hope the large size doesn’t affect the taste too much.

What I did was that I checked the soil moisture graph and when the level was below 30 % I would water the vegetables. Looking at the graph below it shows that I’ve turned on the sprinkler three times during a week (week 27), Tuesday at 09:00, Wednesday at 23:00 and Friday at 21:00:

This process screams for a computer controlled solution and I’m working on connecting a water pump to the logging system to make it a soil moisture control system instead. It would need a hysteresis, like for instance turning the water ON below 30 % and turning it OFF above 80 %.
Another thing I’m working on is replacing my 1-wire Ethernet cable with proper outdoor Ethernet cable. The existing system has worked without any problems for half a year, but I just want to make the whole system even more durable, since the whole point of building this is to free time and energy and instability problems and break-downs take up just that, time and energy.
-
May 3
The 1-wire soil moisture sensor circuit I use in my garden is designed by Eric Vickery from http://www.hobby-boards.com.
(c) 2006 Hobby Boards Designed by Eric Vickery
Title: Moisture Meter 3
Rev: 3
Date: 10/27/2006 06:11:30p(Click the picture for a larger version.)
Here’s a bit of explanation on how it works.
The circuit is connected like this:
- Watermark soil moisture sensor: Pin 4 and 5
- 1-wire network: Pin 1 and 2
- 12 volts power supply: Pin 1 and 3
and the circuit works like this:
- Watermark sensor gets wet
- The time constant of oscillator IC 555 changes
- 555 IC oscillates faster and its supply current goes up
- Current in resistor R2 goes up causing the voltage across R2 to go up too
- The value of the current register of IC DS2760 changes
- Current register of IC DS2760 is read via 1-wire network
In my case I got the following values during calibration. I let the Watermark sensor dry in the wind and recorded the current register value, and afterwards the sensor was soaked in a bucket of water:
Dry = -0.2368
Wet = -1.400These numbers form the 0 and 100 % limits of my soil moisture readings.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
4 Responses to “Soil Moisture Sensor Circuit Explained”
-
Dennis Hall said on July 13th, 2009 at 11:13 pm
Quick question. What type of data is provided for the output? Is it serial or a square wave? Please let me know, I want to send the output to a transducer or a pizzo for a simple alarm when the saturation point is reached. Thank you for your time and consideration in reviewing my request.
Sincerely,
Dennis Hall
technician1965@hotmail.com -
Thomas W. said on July 14th, 2009 at 1:48 pm
@Dennis: As I see it the “output” of the circuit is a software register.
I think what you need is an OpAmp Schmitt-trigger measuring the voltage across R2, and removing U1, R1, C3 and D1, but I’m not sure if that’s what you want?… -
braulio said on March 9th, 2010 at 4:51 am
Hi, I want to do this circuit, but in dallas website, the ds2760 is no loger available, I could change the ds2760 to ds2762? thanks, best regards
-
Thomas W. said on March 9th, 2010 at 1:29 pm
@Braulio: I think you can use DS2762 instead as the manufacturer Maxim states, “DS2762 is an update to DS2760″.
Leave a Reply
-
Apr 16
My Watermark soil moisture sensor and additional circuit has been running 24/7 for about 4 months now, and it really is a stable system. Here are the data collected so far:


On the week graph you will notice an oscillation peaking high at 6 PM and low at 10 AM every day:

Compare the above graph to the weekly temperature graph and you will see the connection to the soil temperature:

When the soil temperature goes up, so does the soil moisture reading. It could be that the accuracy of the soil moisture measurement is highly temperature dependent. Another explanation could be, that air is able to contain more moisture at higher temperatures and this more humid air somehow spreads to the soil and raises the soil moisture level.
What do you think is the explanation? Please leave a comment.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
One Response to “Soil Moisture Sensor Update”
-
Michael said on May 7th, 2009 at 3:03 pm
Inspired by your site I got the same devices.
If you find anything further about the relation of soil-temperature and current readings I’d be very interesed..I found something very interesting here:
http://www.emesystems.com/pdfs/SMX.pdfI guess measuring the soil temperature (also while calibrating) and using it for compensation should be possible..
Keep up the good work!
Michael
Leave a Reply
-
-
Mar 4

There are a couple of good reason to install Debian on your small NSLU2 computer. Although it’s not exactly the Debian version you would use on your desktop PC it smells a lot like it. The file system structure is there, and if you’re used to Linux you’ll know your way around right after installation is complete. Also, ‘apt-get’ is available to you making it easy to install new programs on your small computer.
I’ve used a 4 GB USB flash memory stick as disk for the installation. This is not as reliable in the long run compared to a harddrive. Flash memory allows only a limited number of write operations to the disk, but it’ll be sufficient for now. The worst thing that could happen is that I’ll over-water my garden if my water hose valve is stuck open, but the system will be slow so I’ll probably catch the error in time. Wait until the NSLU2 has been upgraded with the Debian installer before plugging in the USB stick.
The NSLU2 comes with an IP address set to 192.168.1.77. Connect it to a local area network in this range or change the IP address of your desktop PC so you’ll be able to communicate with it. Make sure there are no other devices on your network with this IP address.
The NSLU2 is running a webserver on 192.168.1.77 when you first power it up. I logged in with username ‘admin’ and password ‘admin’ and changed the IP address to 192.168.1.76 because I already had a unit with the address 192.168.1.77. And then I immediately lost the connection when I pressed ‘Save’
You must log in again using the new IP address 192.168.1.76. I typed in the Internet gateway address, and the address of DNS servers. These addresses will be used by the upcoming Debian installation.We need a hacked version of the Debian installer from the Internet to put on the NSLU2. Search Google for ‘Debian NSLU2 install’. What you need is a file called di-nslu2.bin around 8 MB in size. It came in a .zip-file called ‘debian-armel-5.0.zip’ last time I did an install. Using the web server interface of the NSLU2 you need to upgrade it with this 8 MB .bin-file.
After an automatic reboot plug in the USB memory stick. The NSLU2 is now running a Debian install program and will need access to the Internet to download and install software automatically. And this is were things usually gets chaotic for me, but after several attempts I usually get Debian installed. Here are some ideas to try if it’s not working in the first attempt:
- Try different USB memory sticks
- Remove any data or partitions from memory stick using desktop PC
- Manual partitioning vs. guided partitioning
- Try different Debian software mirrors
There are many parameters that will different from system to system, but with persistence and a little luck it should be possible to get it up and running. It’s definitely worth the sweat, having your own 5 watts always ON logging server to give you every detail about your garden.
Any problems with this? Is there something I should try to explain in more detail? Please leave a comment.
-
Dec 23

In the middle of the picture you can see the moisture meter board from hobby-boards.com and on the right the Watermark soil moisture sensor. When the moisture sensor gets wet its electrical resistance goes down, and when it dries up the resistance goes up. The sensor is connected as a part of the moisture meter circuit, which has a 1-wire interface to the rest of the system.
The board needs a separate 9 to 24 volt DC power supply. I have placed the power supply indoors and the power supply current is running in the Ethernet cable as well as the 1-wire data signal, but only to the moisture meter board and not further into the 1-wire network.
As the other sensors in my 1-wire network this board is also accessed through owfs software (one wire file system) and I’m using the Current Register of the onboard DS2760 1-wire monitor IC to read out data. The moisture sensor is connected to an onboard timer IC and when the resistance changes so does the oscillating frequency of the IC and its power consumption. This is measured by the DS2760 and the value is stored in the Current Register.
When the moisture sensor is completely wet the value in the Current Register is -1.400 and when completely dry the value is -0.2386. This goes for this particular system.
I’ve dug a hole about 30 cm (12 inch) deep and put the sensor at the bottom. The soil that I dug up has been mixed with water and poured into the hole to fill it up again. It’s important with a close fit between sensor and soil.
As usual I have a Linux script running on the NSLU2 that takes care of reading the sensor along with temperature sensors in the 1-wire network, and making historical graphs of the readings:
update.shIt assumes that you’ve made a valid database for the readings, for example with this script:
make_database.shThe schedule is handled by Linux crontab with these entries:
# m h dom mon dow command
*/5 * * * * /home/thomas/happyfarming/update.sh &> /dev/null
*/5 * * * * /home/thomas/happyfarming/upload.shGraphs are uploaded to happyfarming.com using this updated script:
upload.shThis is an example of one of the graphs:

My About page will be updated with the newest graphs.
If you have any questions or comments please leave a comment or use the contact form.
-
Dec 11
Here’s an overview of the garden temperature logging system as it is at the moment:

Here are links to blog posts with more information on the different blocks:
NSLU2:
Small Computer As Garden Control Center
How To Automatically Update Your Temperature Graphs
Soil temperature sensor:
Air temperature sensor:
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
2 Responses to “Temperature Logging System Overview”
-
I’ve referred to your site on geekculture.dk. There’s gotta be a gardening geek or two over there.
-
@Henrik: Hey thanks! Comments and questions are welcome. Please let me know if anything comes up, Henrik.
At the moment I’m adding a soil moisture sensor. It’s gonna be sweet.
Leave a Reply
-
-
Nov 12

Here’s a bit more explanation on how to run the temperature logging system I described earlier.
The system automatically stores the value of its sensors every five minutes using the crontab function in Linux. crontab is a schedule of recurring things to be done in the form of commands to be run on the system. There’s different crontab’s for different users. In this particular NSLU2 system I’m running crontab commands as root user. As far as I remember it was necessary to do that to have sufficient rights on the system.
To see what is in your crontab at the moment, run this command:crontab -l
where -l is for list only. Use -e for editing your crontab:
crontab -e
This will start a default editor, in my case ‘nano’, so that you can make changes to your list.
crontab -l on this system gives this output:
# m h dom mon dow command
*/5 * * * * /home/thomas/happyfarming/update_temp_2.sh &> /dev/null
*/5 * * * * /home/thomas/happyfarming/upload_temps.shm: Minute. “/5″ means every five minutes.
h: Hour
command: Command to be executed. I run the update_temp_2.sh script every five minutes. “&> /dev/null” takes the output from this command and discards it, so that I don’t get a mail every five minutes.
* means at every value, i.e. minute is 1 through 60 or hour is 1 through 24 etc.The other command or script I run is upload_temps.sh. This will upload the graphs to this website, making them available in posts.
This is what my upload_temps.sh script looks like:
#!/bin/bash
sleep 30
lftp -u USER,PASSWORD SERVER <<EOF
cd /images/
lcd /home/thomas/happyfarming/
put log_h.png
put log_d.png
put log_w.png
put log_m.png
put log_y.png
quit 0
EOFusing FTP to upload the files.
-
Nov 4

The soil temperature sensor is now in the ground and measurements have been coming in for days now. I have placed the NSLU2 computer in the windowsill and laid an Ethernet cable out to the raised beds. The scripts for this logging functionality are available here:
owfs is used as interface to the 1-wire network.
As expected the soil temperature is changing slower than the air temperature. Sometimes the soil temperature continues to go up while the air temperature is dropping. Maybe the soil temperature is determined by the amount of sun reaching the ground and the air temperature follows the wind, but I don’t know.
I actually thought that the soil temperature would be more stable, like 7 deg. C +/- 2 (45 deg. F) or something, but that is not the case here. Until now it has been in the range 3 to 7 deg. C (37 to 45 deg. F) and it seems like it would easily go below 0 deg. C (32 deg. F) given enough hours with air temperature below -5 deg. C (23 deg. F). On a second thought it might be true that a few meters down the soil temperature would be rather stable. But then it’s not soil anymore, right?
Anyway, it’s time to plant some garlic. We have some Chinese ones in the kitchen. They’ve traveled about 7000 km (4300 miles) … Geez, what were we thinking?
-
Oct 27

This is my new homemade soil temperature sensor with a DS18S20 IC. The sensor is in the top of the picture. The left cable is coming from the NSLU2 computer and the right cable continues up to the air temperature sensor, which is also a DS18S20 IC. So now there are two IC’s on my 1-wire network using Cat5e Ethernet cable. The black tube on the left cable is just a collection of unused wires coming from the computer. These are required for other IC’s which will be added to the network later. The DS18S20 is glued onto a 20 x 20 cm (8 x 8 inch) aluminium plate to get good thermal contact to the soil.
-
Oct 16

I got my small NSLU2 computer up and running and it’s generating graphs from the garden. At the moment only the air temperature near the house is logged. The spikes in the graphs I believe is due to direct sunlight hitting the temperature sensor. I will build a shield over the sensor to prevent this. The sensor needs to be moved away from the house to get a more accurate reading.
The NSLU2 is running Debian on a 4 GB USB flash memory. I’m using a 1-wire system for the sensors together with the owfs software. rrdtool is used for generating graphs.
Here’s a script for generating the rrdtool database:
make_temps.shand a script for generating graphs:
update_temp.shAre you building your own temperature logging system? Using the NSLU2 computer, or owfs? Please leave a comment and tell a little about what your are working on.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
4 Responses to “Garden Air Temperature”
-
Very impressive work! I am the author of owfs — can I feature your work on our website as an example application?
-
Thomas said on October 17th, 2008 at 12:35 pm
@Paul: Sure, that would be great, thanks! I must say that owfs is easy to use once you know what to do. I’m looking forward to adding more 1-wire devices. I’m adding a soil temperature sensor, a moisture sensor and a rain collector to the system. I need to know when to plant them potatoes
-
Tuomas said on September 13th, 2009 at 11:32 am
Hi!
I have some difficulties to installa OWFS to my NSLU2 running debian lenny. Apt-get won’t find owfs and I’m not familiar to update packets list. Any ideas how to install OWFS?
-
@Tuomas: I think you have to download the source and compile it: http://sourceforge.net/projects/owfs/
Leave a Reply
-
Subscribe in RSS reader
Subscribe to email newsletter
About
-
Are you ready to grow your own food? Take a tour through my archives and learn how I did it!

Recent Articles
Popular Articles
- How To Install Debian On NSLU2
- Building A Better Bean Trellis
- How To Build A Bumble Bee Nest
- Choosing The Right Type Of Composting Box
- Soil Moisture Sensor Circuit Explained
- How To Prune Black Currant
- Pruning Red Currants
- 31 Things You Need To Know About Peaches Before You Start Digging
- Still No Peach Leaf Curl
- Peach Tree


