Sunday, January 24, 2016

Automated Worm Bin Progress: Part 2

See Part 1 of my notes for the first steps.

I have nearly completed building my worm bin.  The temperatures have been too cold to get glue to dry to finish some details. Meanwhile, I will work on the technical portion of the worm bin's temperature monitoring.

nearly complete worm bin with heater rack in foreground

I have the soil temperature part working well.  The soil sensor is collecting the temperature and displaying it on the graph on the bin's home page.

The soil temp line is brown on the graph but shows as grey with the other color settings being a little transparent.  You can see on the far left, I had the probe on an ice pack to help me see that it was there (otherwise it would be almost the same temp at the air).  Near the very end (right), there is a blip up where I held it in my hand for a couple of seconds.

I had to edit a few of the step 1 and step 2 files to get the second sensor working with the others.

I modified the step 1 python script ( to include some of python code from step 2:

You will need to edit the line:
soil_temp_sensor = '/sys/bus/w1/devices/28-000006c3a429/w1_slave'
To match your sensor's id see the step 2 tutorial link.

I also edited the public/index.html file to handle the new sensor info:

Be sure to restart everything (the web server or Raspberry Pi) to make sure it all works.

Now would be a good time to make a backup disk image if you are following along.

Measuring Soil Moisture

I now would like to measure the soil moisture.  This seems to be a bit trickier to find a sensor that will work with Raspberry Pi and Python.  There are some tutorials on Arduino moisture sensor ideas.  This project uses both Aruino and Raspberry Pi for monitoring crops.

So far, this combined temp and soil moisture sensor might work (a bit pricey):
Seems to work with Arduino but not sure about a Python.  I did find python library for it which might work :

There are also some projects that show other options that look interesting:

This Instructable looks really interesting because it gets into many more elements beyond just monitoring and looks at reacting to conditions.

I have a few other related projects to work on.  I'll take a break on the technical part of my worm project for now and think about the moisture sensing a little more.   I need to finish my worm bin construction, put some worms in it, and install on outdoor wireless access  point to connect to the the Raspberry Pi from the comfort of my house (200 feet away).

I hope what I have done so far gets you started.  If you have any improvements or other ideas please let me know.

Friday, January 22, 2016

Make a Rasperry Pi Worm Bin Monitoring System

I have 10 horses generating manure every day, so I am curious about using that for feeding my earthworms.  I will be exploring other feedstocks too.

I am building this OSCR flow through bin pictured, and I want to get email or text alerts when things are not ideal so I do not kill my worms and I have the most efficient system possible.

I also want to know how well the bin design functions.  For example, does the insulation work well in summer and winter or does it work less well in summer?  If I add some frozen water bottles in the heat of summer how much will it impact soil temp?

unfinished OSCR worm
Incidentally, my bin now is painted and has insulation panels inside as well as  a heating tray for under the soil.  I'll post more on that later.

Building the Monitor

Monitoring web page charts worm bin exterior temperature and percentage humidity after step 1 below.

There are many ways to do the tech part of things to setup a worm monitoring system.  You can choose from Raspberry Pi, Arduino, and other micro controller boards to get started.  I chose Raspberry Pi because I am comfortable with Linux and can cobble together a little Python code.  Additionally, there seems to be plenty of libraries for the various sensors available.

I basically I want version 1 of my monitor to tell me my outdoor temp, soil temperature, and soil moisture level.  PH might be nice too.  I am very experienced with technology in general and much less experienced with worms and Raspberry Pi and sensors.

Eventually I may want to automate feeding or watering but I must take baby steps.

This is not a finished tutorial, but rather a document of what I am currently exploring.  It's purpose is to help me remember my steps.  You might find some inspiration to get started making your own monitoring solution.  I may not have technical answers to your Raspberry Pi or sensor questions but it does not hurt to ask :-)

What you might want to buy:

Raspberry Pi board.  Raspberry Pi is much different than an Arduino.  A Raspberry Pi can run a full operating system cheaply (including Windows 10).  I use an older Raspberry Pi B+ but would prefer new faster model 2.   Get a  power supply for it too.

There are many temperature sensors out there.  My favorite place to browse for them is Adafruit, but some of the prices on Amazon are better.  Adafruit has a nice looking sensor for soil temp and moisture for around $50.

Other things to consider...
HINT: You may want to save yourself some grief and periodically make a backup image file of your work.  (Like after step 1).  Just use the same software you used to transfer your raspian operating system to the card from step 1.

Basic Steps 

Keep in mind that I just started this project so I will modify this post or add more posts as I make progress.

Step 1 Adding Air Temperature/Humidity Sensor

You can follow this home automation tutorial to get the basics up and running with ambient temperature sensor first.  I did not need the humidity functionality but decided to use it anyway.

The Raspberry Pi B+ board has more GPIO pins than the original Raspberry Pi so I am always looking them up with this image:

After step 1 my setup looks like this
The Raspberry Pi is on the left (green) and a breadboard is on the right (white).  The breadboard just helps you attach wires, sensors, and resistors to the Raspberry Pi.

The white box on the lower left of the breadboard is the air temperature sensor- less than $9 on Amazon.  The larger black box to the right (orange light) is my wifi antennae attached to USB hub (not necessary).  The other cables coming into the board on left are mostly unnecessary too because they are just to setup the operating system until I have a network connection  (USB mouse and keyboard and HDMI for video)

Step 2 Adding soil sensor

A different tutorial explains how to setup the soil sensor.
Because I am already using pin 4 for the first sensor, I decided to use pin 17 for the second sensor.

where instructions say to edit /boot/config.txt
and add:
I also add the new pin info (since the device defaults to using the pin I am already using for the air temperature sensor in step 1)

So far, I now have the soil sensor working.  I am now about to begin the python programming.  In an future blog post I will look at the script from step 1 and see how I will incorporate the second sensor into the monitoring script I already have so it's results will be included in the graph on the web page.

The circled up black cable is the added waterproof soil sensor. 

In general, if you are not very technical, start out with very small steps.  Do some basic Raspberry Pi tutorials first.  The when comfortable, try reading your room temperature, and move on from there.

Part 2: Adding the soil temperature sensor.