Composting might not be the geekiest thing at the moment – no iPhone apps currently exist for it from what I can determine. Nevertheless it has been happening on this planet since organisms started living here and it is still very important. 30% of our waste is organic material which could be composted but unfortunately isn’t.
There are two processes that take place during composting. First the organic matter undergoes aerobic decomposition, where bacteria and protozoa convert carbon and nitrogen into CO2 and cell structure, all the while generating a lot of heat in the process. Then as the oxygen is depleted in the compost pile anaerobic fermentation begins to take over. The living organisms now reduce nitrogen and carbon, without using oxygen, into organic acids, ammonia and methane. Heat is released but not as much as before, around 20 times less.
For urban composting, the anaerobic, smelly stage should best be avoided. This can be done by maximizing the time the aerobic stage has to decompose a pile. In addition if the aerobic process completes too quickly this might be an indication that something is not quite right with the pile. For example, there might be too much carbon in the mix, not enough nitrogen, or insufficient moisture. Or it could simply indicate that the pile needs to be turned so the aerobic stage can be restarted again.
This is what my hack is intended to do. It gives an indication of when the transition from aerobic to anaerobic happens and how long it takes. It does this by monitoring the temperature of the pile and turning on a led when the pile is aerobicly decomposing and turning it off when the decomposition ends.
By measuring the temperature change as the pile heats up, stabilizes, and then falls back down to a lower temperature, the transition point can be identified. Since a compost pile can vary in multiple ways including physical size, C:N ratio, moisture content, and particle size, the use of absolute temperature to identify the transition point is next to impossible without somehow gathering more information about the particular pile. Instead a localized edge detection algorithm is used which relies, not on absolute temperature, but on the change in temperature of the pile over time.
The temperature sensor I used for my circuit is a metal can transistor I pulled out of my junk box – an old neglected 2N2222A – which was then soldered to a long copper tube which serves as the temperature probe. The base and collector of the transistor are connected together while the emitter is grounded. A 10k resistor is connected from Vcc to this junction. The voltage across the transistor is measured using the AVR’s A-to-D converter to give a temperature observation.
As currently implemented this hack takes one temperature observation every ten minutes. By averaging the temperature changes over 16 observations and then calculating the second derivative, a curvature value for the temperature movement is calculated.
When aerobic decomposition begins, the curvature value initially becomes positive as the temperature of the pile increases. Once the curvature value passes a certain preset positive number which was determined experimentally, the aerobic process is considered to have begun and a led is turned on. As the decomposition continues and the pile temperatures reach their maximum the curvature value will turn negative. When the curvature becomes sufficiently negative, again experimentally determined, the hack now only needs to wait until the curvature value crosses over back to positive to consider the aerobic process done. Eventually the oxygen is exhausted and the pile temperature comes down. The moment the curvature becomes positive again, the inflection point separating the transition from aerobic to anaerobic is considered reached and the led is turned off.
The graph below represents one of these experiment I performed using hot water to simulate a composting. Here the curvature value is in blue and the A-to-D value (minus a constant and negated) is plotted in red. The lowest value of the state plot represents when the led is turned off and the two higher state values represent when the led is turned on.
Depending upon the type of transistor or temperature sensor used, the preset values in the source code will likely need to be changed. Since the measurement period and the number of observations to be averaged were also determined experimentally, a better sensor than a transistor might require less averaging or a shorter interval between observations, so these predefined values set in the source code would also need to be changed.
The ATmega328 based circuit I designed uses a 4MHz ceramic resonator for it’s clock. If you wish to use the internal oscillator instead, the code can easily be changed to accommodate this by changing the predefined values in the source. Please note, although there are two leds in the picture, only the red one is used by this hack – the green led should be ignored. To compile type “make MCU_TARGET=atmega328p compost.hex”.