loading

Introduction

This is a tutorial on building a Compost Temperature monitoring system. It details how to build a web connected wireless sensor network and shows one possible way it could be constructed.

A Medium level of knowledge and skills are required. Basic knowledge of soldering and breadboarding will be very useful. I will assume that you know enough Arduino code to understand what a Function is, how a Library is useful, and why Serial Communication is important. And you will need to know enough electronics to understand what I mean with terms like Voltage, Current, Resistance, etc. A (very) basic knowledge of how radio works would also be useful for understanding the concepts, but not essential for following along. This is not advanced by any means and I will attempt to always reference materials that will cover these concepts in greater detail.

This tutorial is not about building a polished final product. I am going to assume that you are accompanied by some basic fabrication skills and are capable of doing some problem solving in this area. I will show an example of my project at the end, but I will not be talking extensively on housing design or fabrication. This will be purely about the code and electronics to get up and running with the various communication types, sensors, and data storage. That being said, by the end of this tutorial you will have a web connected sensor network working on your breadboard. Putting it into a housing will be easy after that.

Why Measure the Temperature of Compost?

"Composting is the biological decomposition of organic matter under aerobic conditions." Micro-organisms consume organic material and oxygen and create heat as a waste product. By measuring this heat you can predict decomposition rate, oxygen content (loosely), and the overall health and efficiency of your composting operation. It helps to predict when the pile needs to be turned to introduce more oxygen, when the pile is finished with its hot cook cycle, and if you have effectively killed any pathogens or weed seeds that might be present in the feed stocks. Monitoring is an important aspect to streamlining and creating a stable process and workflow to get a predictable and consistent result through each cook, improving the overall efficiency in the operation.

Technologies

This project uses short range Radio and Cellular communication to get sensor data from individual probes in the compost to an online database. The hardware will be built on the Arduino platform using the Moteino wireless boards. We will be using thermistors for our temperature sensing, an Adafruit FONA cellular module for our cellular communication and the Sparkfun Data Service for our online database.

Parts List

Note: You will need an ftdi board to upload code to the Moteino's.

Sensor Node (per node):

Cellular Gateway

  • Moteino w/RFM69HW
    • This should be the same part as the Sensor nodes.
  • FONA GSM Board
    • You will also need an antennae, depending on which type of FONA board you get, either will work. I like the low profile antennae. Just make sure the Antenna you get matches the connector on the FONA you have.
  • Lithium Ion Battery
    • This can be a big or small battery depending on your design. Also might be worth considering solar charging. Voltaic Systems makes nice stuff. I used one of their products in my system.
  • SIM Card
  • Breadboard

Resources

Take a look at these before starting off.

Step 1: The Sensor Node

Building the Sensor Node

We're going to start this project off by building our Sensor Node. We'll put together the Temperature Sensor first, and then once we've tested that and it's working we'll incorporate the wireless communication. The First step is to make sure you have the all the Libraries installed.

The two you need are here:

Install those and make sure you have an FTDI adapter and the drivers are correctly installed.

Once that is done you should read this quick start guide to the Moteino, there is some helpful information there.

Once that is done, solder the header pins onto the Moteino board because we will be plugging it directly into a breadboard, and cut a piece of wire 6.83 in (743mm) long to use as our antenna. Solder it to the antenna hole on the Moteino. See the images on this page and the Moteino website for reference. Once those are soldered and you've successfully interfaced with the Moteino (try uploading the Blink sketch with the LED pin set to 9), plug it into the breadboard, connect the power and ground to the breadboard buses and we can get started sensing.

Sensing

Please reference sender-temp.ino file which has the code for this part

For the temperature sensor, we are using a Thermistor. It is a simple, inexpensive and fairly accurate piece of solid state hardware. We are going to be sticking this sensor into a hot, humid, and fairly caustic environment so it is important that it is able to withstand these environmental factors.

The sensor we are using is a 10kOhm Epoxy sealed Thermistor from Adafruit, which they have excellent documentation for. The code I am using is a slightly modified version of theirs. There is no point in re-inventing the wheel, so please read through their documentation in addition to this tutorial for more information about this sensor.

The Hookup is super simple, see the schematic and images attached to this page. We'll be using Analog Input 0.

The code itself consists mostly of math that you don't need to worry about. The math part is cordoned off in its own function because it's better not to look at it. The code takes 5 readings from the Analog Input over a short amount of time and averages them to get a more stable reading (these sensors can be noisy). It then does some magic to convert that resistance into temperature which we print out the Serial Monitor.

Radio Communication

Please reference sender-node.ino which has the code for this part.

Once your temperatures are reading correctly, we will need a way of sending them to the Receiver. To do that, we are using the RFM69 Radio module, that green thing soldered to the back of your Moteino. First thing, make sure you have an antenna soldered to the antenna port of the Moteino board. Without the antenna, the range of this radio is a few inches instead of a few hundred meters. Information about the Antenna's and range can be found on the Moteino Site. All of the connections are already made for us, so we can just initialize the Library and start using it. To get started, I would suggest looking at Andy Sigler's excellent code for some super simple send/receive examples.

Getting Started

In the code so far, we sensing the temperature. What we need to do is to take the sensor value and send it across to another Moteino which will be listening for radio messages. We do that by bundling up this piece of data in a little packet and passing it over the air. This packet is called 'payload'. Once the 'payload' reaches the Receiver, the Receiver will send a quick message back saying "Got your packet, everything looks OK". This is called an acknowledgment (shorthanded to ACK in the code). If an acknowledgment isn't received by the Sender, it will wait a little while and try sending it again. If it tries 5 times and fails, it will give up. This is a really important way of creating stability and accountability in our wireless communication because we need to know if our messages are being received.

Powering it

To power the Moteino without the computer we will be using a 9 volt battery attached to the VIN pin of the Moteino. This pin sends power to the voltage regulator, which steps it down to 3.3v for use on the board.

Power Consumption

Because these sensor nodes are battery powered, power consumption is a really important factor to take into consideration. This is a a bit beyond the scope of this tutorial, but I am going to discuss broadly here. The existing circuit, as you will see should work fine as is, but there is room for optimizations. Each different component consumes some amount of power. I did some current measurements really quickly with a 9V battery powering the Moteino.

  • a blank sketch:
    • 24mA * 9V = 0.216 watts
  • with the microcontroller sleeping (and the radio on):
    • 16mA * 9V = 0.144 watts
  • with the radio sleeping (and the µC on):
    • 7.5mA * 9V = 0.0675 watts
  • with both radio and µC sleeping:
    • 4µA * 9V = 0.036 milliwatts
  • with both sleeping and the thermistor plugged in:
    • 0.16mA * 9V = 1.44 milliwatts

You can see here that the biggest hogs of power are the microcontroller and the radio (obviously). Both of those we can put to sleep and reduce the power consumption dramatically. We are unfortunately stuck with the Thermistor consumption without some more advanced circuitry. We use the library made by jeelabs which has a great function called Sleepy. I use it so much I extracted it and made my own library so that I can use just that one function without any of the other stuff. It is here in my github. Sleepy basically just replaces the delay() function.

In the end we are left with a circuit which consumes a nominal ~ 1.5 mW at 9v. A typical 9 volt battery alkaline battery has a capacity of 565mAh, which is 5 watt hours. Our sensor consumes at a rate of 0.0015 watt hours. A good rule of thumb with batteries is that only 50% of their rated capacity is actually usable. That leaves us with 2.5 watt hours of available capacity. From these estimates, we should expect a lifespan of about 1600 hours, or about 2 months, which is completely reasonable for the scope of this project. This, of course, is not taking into consideration the self-discharge rate of the battery.

Now that we have a sensor that can live on its own for a length of time, it's time to build something that receives its messages.

<p>I ran a summer program at a detention center for adjudicated youth. We had a great deal of compost from the huge garden and grounds. When we piled it in similar sized piles and in similar areas and composed of similar materials, we found they acted similarly. We used pvc pipe, permanently capped on the compost end and closed off on the top end with a threaded plug. There was a eye screw placed on the inside of the plug. We attached a string to that eye screw long enough to suspend a candy thermometer near the bottom end of the pipe. The pipe was placed in the pile not unlike how you would use a meat thermometer on a turkey. To monitor the temperature we opened the threaded end, pulled the string, and directly read the candy thermometer. It is a very low tech version of your excellent solution, but that was all we were able to manage. The temperatures amazed the junior prison residents. It was cool, jacket kind of weather, outside yet the pile temperatures were quite high, around 150 plus. Just thought some of your readers might like the &quot;Compost Temperatures for Dummies&quot; verson for home use.</p>
<p>This is great. Thanks for sharing. This is a perfect example of how you don't need fancy technology to solve problems. While my solution has some distinct advantages for community sized composting operations, for home use a candy thermometer works just fine. Good temps, too! I've been to composting operations that run year round where winter temperatures regularly drop well below 0*F. If the pile is big enough it will not freeze. </p>
<p>thanks for spending the time to thoroughly document your efforts and include your references. this really helps as a jumping off point for both wireless networking sensors, pushing them to data.sparkfun.com and cellular GSM. outstanding work!</p>
<p>thanks! That was my exact intent. The code and tech I've put up here could easily be slightly modified to serve a multitude of purposes, not just compost. </p>
<p>Can i do it by using this <a href="http://megadepot.com/product/agratronix-07100-dht-1-portable-hay-tester-with-18in-probe" rel="nofollow">http://megadepot.com/product/agratronix-07100-dht-...</a> ?</p><p>Simple way )</p>
<p>You would have to travel to the compost site and take measurements at each measurement location, every 15 minutes, writing it all down (because it doesn't record), then enter all the data for the nice graphs...</p><p>Or for about the same amount of money, build this project, and <em>simply</em> monitor the graphs on your phone or computer (comfortably, anywhere) of the measurements that get automatically recorded every 15 minutes, 24 hours a day, </p>
<p>Nice project and realisation. Regarding the thermal sensor consuption, you could provide the current using a digital pin, so you wil be able to control when you power it or not. This would significantly reduce the overall consumption of your sensors. In cas more power is needed, this digital out could control a mosfet transistor as a switch.</p>
<p>I'd like to add my appreciation and praise for your having posted this in such detail. Great share! I'm curious, could you offer some estimated budget for the whole project? Materials and parts, only, would be very helpful.</p><p>Thanks!</p>
<p>This is a very interesting project. I may have missed something along the way, but what are you looking for in the data i.e. what would indicate it is time to turn?</p>
<p>You won't find anything in the data to indicate the turn time. You won't get a text message from your compost saying &quot;hey, turn me over and give some O2&quot;. This is just a less labor intensive way to do the monitoring that all composting operations already do. I have no interest in attempting to replace a skillful composter with an app, there are too many variables for that ever to work. This will just make a skilled composters job a little easier. </p>
<p>Oh I don't know about that! I believe anything is possible- if you make the payoff fun enough, interesting enough, or cool enough. Well done.</p><p>I personally feel that turning is (usually) always good- even to consistently finding progressively bigger drums to turn. As for the wetness factor, you can always make tea. I've been wanting to set up a scalable project here in Tampa- using Scientific method to determine the best way to control variables, but we still have single stream recycling, if that gives a clue!</p>
Thank you, this is most informative and greatly appreciated.<br><br>Kind regards,<br><br>Dean
Thanks. So what is the skilful composter looking for as they monitor? What particular point or pattern would they be trying to identify? I ask because I am genuinely interested in the process and want to understand a bit more about composting and how monitoring this way actually aids an already skilled individual ?
<p>Temperature is an indicator of biological activity, decomposition rate, and loosely of oxygen demand. By measuring temps that you can tailor your feedstock (the material you are composting) mix to fine tune the Carbon-Nitrogen balance. Without monitoring temps you're kind of flying blind. The sweet spot for temperature is between 110 and 130. To kill pathogens (really important if you're composting biosolids or mortalities) and weed seeds you need the pile to be above 131*F for a few days to a few weeks depending on the technique you're using. Above 160*F the good biology will die off and you'll get huge blooms of Actinomyces and strip the nutrients out of the compost. That, and the colder the pile is running, the longer it will take to produce a final product. </p><p>The moisture content is kind of an experiment on my part, but you want somewhere around 50%. More than 60% and you'll get liquid water buildup in the pores of the compost which will inhibit oxygen transfer, and below 40% it becomes dry enough where it inhibits the biological activity. I'm still working on how to calculate the percentage value from my sensor readings because I'm measuring air moisture in the soil not soil moisture directly. AND whether or not I'll be able to get accurate enough readings to be meaningful in such varying temperature environment is debatable. Temperature is really the important thing, which is why for the Instructable I didn't even bother trying with the moisture sensor. </p><p>I hope that helps.</p><p>The Rodale Composting Book is an excellent introduction on this subject: <a href="http://www.amazon.com/The-Rodale-Book-Composting-Gardener/dp/0878579915" rel="nofollow">http://www.amazon.com/The-Rodale-Book-Composting-G...</a></p><p>as well as Eliot Epstein's, The Science of Composting: <a href="http://www.amazon.com/gp/search?index=books&linkCode=qs&keywords=9781566764780" rel="nofollow">http://www.amazon.com/gp/search?index=books&amp;linkCo...</a></p><p>and Industrial Composting, as a look into how the bigger operations work: <a href="http://www.amazon.com/Industrial-Composting-Environmental-Engineering-Facilities-ebook/dp/B008J4RT94/ref=asap_bc?ie=UTF8" rel="nofollow">http://www.amazon.com/Industrial-Composting-Enviro...</a></p>
<p>Awesome project! I love that other people are giving the Moteinos some of the attention they deserve. I have some Moteino R2s with the old RFM12b modules, I just really wish I had the time to really do stuff with them. Great work building the new board with built-in batteries, I will have to ponder doing such a thing myself.</p>
<p>When this project is done I'll be collating and publishing all of my board designs for this project. I've used the 12B radio's too, the RFM69 is vastly superior in just about every way.</p>
<p>Nice job, Kina!</p>
<p>very interesting project. I particularly liked your heart beat graph on your web site to tell if the sensors are working.</p>
<p>this is an insanely cool project! i love it.</p>
<p>Who knew that compost could be so interesting! Thanks for sharing! </p>

About This Instructable

31,654views

406favorites

License:

More by kinasmith:How to Mill a circuit board with a Stepcraft Mill and EagleCAD Make a Tool Length sensor for Stepcraft 2 CNC Compost Sensor 
Add instructable to: