Every family produces some waste that is suitable for composting. Our family uses a Biolan fast composting unit to convert that stuff eventually to soil. This is very easy to do during summertime, but in winter when the temperature drops below -15 °C it becomes a much harder job. Too many times have I found myself witnessing the unit in condition where inside temperature is near zero or even below it. After that it is very hard to get it working again before warm spring days come to fix the situation.
To provide some tools to avoid this I figured that it might be a good idea to put a temperature monitoring device into the composting unit. Ideally this would be a small device with radio, batteries and temperature sensor in waterproof box that I could throw into unit. Based on these requirements, Texas Instruments MSP430 CPU seemed like an obvious choice.
I really didn’t have much knowledge about MSP430 before this project so I ordered ez430-RF2500 development kit, which contains two MSP430F2270 boards with 2.4Ghz radio and internal temperature sensor. I used these boards to develop a port of Pico]OS for MSP430 and to test Simpliciti (a Texas Instruments radio stack). Creating Pico]OS port for the cpu was remarkably easy as the architecture is not at all too complex. Simpliciti stack required some work, because I had chosen a free mspgcc (Gnu GCC port for this cpu) as my compiler. Luckily there were some patches floating around in the net for this.
ez430-RF2500 was handy for initial work, but I soon found out that it would be unsuitable for final deployment: 2.4Ghz radio didn’t work for the distance I had, the signal just got too weak. After some googling I found a perfect card for this: Olimex MSP430-CCRF. The card has CC340F5137 CPU with integrated sub-Ghz radio and costs less than 23€. I also knew the card would be ok quality-wise as I had used Olimex cards before.
CC430F5137 was a more modern cpu than MSP430F2274 so I had to do some work to get Pico]OS running on this card also. Also, simpliciti sources needed further work to use frequency in 868 Mhz band that would be legal in Finland. Luckily, Texas Instruments provides SmartRF tool to generate suitable register settings. I settled for 869.525 Mhz, which allows 500 mW radio power when transmitter is used less than 10% of time (board doesn’t output 500 mW. Datasheet says that maximum output power is +12 dBm which is about 15 mW). To provide maximum range I also selected low link speed (1 kBit/s). If you are using this project in another country you must review radio register settings.
The sensor inside the composting unit is powered by two AAA-size lithium batteries. The board uses noticeable amount of power only when it is transmitting. For most of the time, system just sleeps, consuming only a few microamps. Today, the system has been running for about six months with same batteries.
The receiver (or “access point”) is connected to my database server with handy sparkfun USB cable containing FTDI serial converter. Cable works at 3.3V level so it can be connected directly to UART pins of MSP430 chip. It also provides power to MSP430.
The temperature sensor in CC430F5137 is supposed to be calibrated at factory, but there has been a batch of chips which have wrong calibration data. My chips were from that batch, of course. I solved the problem by calibrating the sensor at room temperature (about 20 °C) and at sauna temperature (about 60 °C) and calculated correct calibration values from those measurements.
After that the system was ready to be deployed in our composting unit. I had a somewhat waterproof case for sensor unit and ordinary plastic case for receiver. Just to be sure I placed the sensor unit inside two plastic bags also.
There were some problems however. First problem was battery age, it wasn’t close to anything I was expecting – batteries were emptied in a few weeks. Second problem was moisture. As the temperature inside compost goes up and down the pressure inside the sensor unit varies, effectively pumping moist air inside the case. Moisture then condensed as water inside the case, causing short circut to cpu board.
First problem was caused by erroneous initialization of unused GPIO inputs in cpu: internal pull-up resistors were enabled and outputs were programmed to zeroes, causing resistors to use battery power all the time. This was easy to fix.
Second problem was more difficult. I first tried putting some silica bags inside the case, but that didn’t fix the problem completely, it only gave some more time before the system stopped because of condensed water. Eventually, I didn’t have any other choice than sealing the box with silicone.
After these initial problems, the system has been working very well. If you are interested how our composting unit works, check out this report.
Source code is available at Github in sensor-node, sensor-ap and simpliciti projects.