What is my project about?
I have a couple of compost heaps in my garden. To make good compost, the process needs the right balance of “green” and “brown” vegetable matter and the right amount of moisture. Monitoring the temperature gives good feedback on how well the composting process is proceeding. In the composting process, temperatures of around 65°C are needed to optimise micro-organism activity, accelerate organic matter breakdown and destroy pathogens. Low temperatures will allow anaerobic rotting to occur. If the core temperature is only around 35°C, composting will be very slow, so action should be taken such as mixing more "green" vegetable matter and/or aeration. The specific problem this project will solve is that, without poking around inside your compost heap, it is not obvious whether it is composting efficiently. With my idea (and the help of Bluetooth Low Energy), your green fingers won't become brown fingers!
I think this project falls into the Asset Monitoring category of this contest, although it could also qualify for the Smart Home category.
Why did I decide to make it?
I have had this idea for a while and my research found that, whilst there are some industrial compost temperature probes available, these are very expensive and require proprietary monitoring equipment. My proposal only needs a BLE and WiFi-enabled mobile phone or tablet, which would not need to be bought specifically for this purpose.
My device would be aimed at the home composter initially with the unique selling points of ease of use and low cost, compared with other commercial alternatives. If successful, this “use case” could lead to more efficient composting, which is of increasing importance for protecting the environment through recycling of household waste.
On a wider scale, the NFC tag could also allow the sensors located in different places to be marked and identified. I can see other applications of the RSL10-SENSE-DB-GEVK for horticulture, such as greenhouse temperature and humidity control.
Problem 1
The RSL10-SENSE-DB-GEVK already has a range of onboard sensors – including the BME680 temperature/humidity sensor but I discovered that you can’t just bury the RSL10-SENSE-DB-GEVK and expect get your data via Bluetooth. Firstly, the device itself needs to be protected from the very harsh environment that it is measuring – if it gets too humid or hot, it won’t work at all. Secondly, after putting the RSL10-SENSE-DB-GEVK into a watertight plastic container, I discovered that the BLE signals do not penetrate very far if you bury it! Even standing right next to the compost heap, if I buried the device more than about 2cm, the signal was lost.
Solution 1
The solution to this problem is to use a weatherproof external temperature sensor that can be buried a few inches into the compost to read the core temperature and connect it to the RSL10-SENSE-DB-GEVK via a weatherproof cable. The RSL10-SENSE-DB-GEVK itself will also need a weatherproof container.
Problem 2
The RSL10-SENSE-DB-GEVK kit comes configured to work with the On Semiconductor “Sense and Control” app. Unfortunately, the source code for this app does not seem to be available. This means that the app cannot be used with an external sensor, as there would be no way of reading the data from an external sensor.
Solution 2
I thought of two possible solutions to this problem. The first would be to develop my own BLE app to read the temperature from my external sensor. The second solution was to use a different app (if there is one). The first idea was feasible but would involve more work.
I discovered that (in October 2019), Atmosphere IoT development platform started to support the RSL10-SENSE-DB-GEVK. The platform is free for developers using up to 5 devices with 10MB data storage each, but commercial pricing is available for larger volumes/multiple users. As well as most of the onboard sensors, Atmosphere IoT already supported a few different temperature sensors, including the Microchip MCP9808 I2C digital temperature sensor. This is an accurate sensor which has a typical accuracy ±0.25°C from -40°C to +125°C. It uses the I2C bus and works over a 2.7V ~ 5.5V logic level voltage range. All of that seemed perfect for my application!
Prototyping
The MCP9808 sensor comes as a surface-mount component but you can buy a breakout board from Adafruit and others, which includes the necessary I2C pullup resistors, and “through the hole” connectors to make it easier to wire up. The Adafruit board is around $4 but, being a cheapskate, for my prototype I bought a cheap Chinese breakout board for about $1!
Hardware connections
Armed with the breakout board, it was just a matter of soldering on the supplied PCB pins to the RSL10-SENSE-DB-GEVK and also to the breakout board. The RSL10-SENSE-DB-GEVK breakout pins include one GPIO, plus the necessary VCC, GND, CLK and SDA connections. For my initial prototyping, I just used female-female jumper wires. Just four connections are needed. Following the markings on each of the boards, connect a wire between each of the pins of the same name.
Software Instructions
There is an easy-to-follow tutorial for the RSL10-SENSE-DB-GEVK on the Atmosphere IoT website (“Getting Started with RSL10-SENSE-GEVK”). That shows you how to get data from (most of) the onboard sensors, configure a mobile app to display the data in real time and also send the data to the Atmosphere IoT cloud (which then makes it available to be viewed from any Internet-enabled device).
After working through the tutorial, I was in a position to create my own mobile app and cloud dashboard using the MCP9808 temperature sensor instead of the onboard sensors.
I recommend that you work through the Atmosphere IoT tutorial first, so that my instructions make more sense.
First, create and name the project, then (in the RSL10-SENSE-GEVK tab of the Projects screen), drag and drop the elements in the screenshot below to the canvas by clicking them in the Element Toolbox. To get the MCP9808 element, you'll first need to click on the "Add element" button, scroll down until you see it on the list and import it. In case your are wondering, I added the DebugPrint element so I could see that the MCP9808 device sensor was sending data.
After you have dragged all the elements onto the canvas, working from the left hand side, click on each element (and the connections between them) in turn and make the settings as per the screenshots below. Notice that I have set the Interval element to fire every second. You can change this to a longer interval if you like.
Now, move to the Application tab and drag and drop the elements below onto your canvas. The two picture elements (RSL10 and Compost) are not necessary for the application to work, but just make the app's screen look more interesting. You can upload images from your PC or upload photos direct from your phone. Remember to configure the Layout to suit the screensize and aspect ratio of the device(s) you will be using (as per the Getting Started Guide).
After you have dragged all the required elements onto the canvas, configure each of the elements as follows (working from left to right as before).
That's the mobile app finished. Now it's time to configure the Cloud tab. Once again, drag the elements below onto the canvas.
Now configure each of them in turn (working from the left).
Once you have created your application, you then need to reprogram your RSL10-SENSE-DB-GEVK so that it runs your code, not the code it is supplied with. This is where the debugger comes into play.
Before you try and program the RSL10-SENSE-DB-GEVK, you need to install the latest Segger software and the Atmosphere IoT Agent (this sits on your PC and routes the cloud-compiled code to the Segger software). The instructions for this step are at the beginning of the aforementioned Atmosphere IoT “Getting Started with RSL10-SENSE-GEVK” guide.
That takes care of the mobile app configuration. One of the nice things about the Atmosphere IoT platform is that you can download the C source code after you have compiled the visual application. I have attached a link to the source code which is stored in my GitHub account.
If all has gone to plan, you should be able to connect to your device and see your data on the mobile device's screen.
When you first run the app on your mobile device, you have to let it find your device and then select it from the Devices screen on the mobile app. As you can see having a photo helps, if you have more than one device.
You might need to press the Reset button on the RSL10-SENSE-DB-GEVK (it will briefly flash the onboard LED). Then your mobile device will try and pair with the RSL10-SENSE-DB-GEVK (make sure you have Bluetooth turned on, on your mobile device). Once connected the first time, it should connect automatically in future when you run the app. Even if your lock-screen times out, the RSL10-SENSE-DB-GEVK should continue sending Bluetooth data to your mobile device and your mobile device should continue sending data onwards to the Atmosphere IoT cloud. This is where I found the Android app a bit buggy on my phone. The RSL10-SENSE-DB-GEVK stopped sending after a while. It might just be my phone because I found the same thing with the On Semiconductor “Sense and Control” app.
To view the cloud data remotely (e.g. on your PC), you can create a “Dashboard” to display your data on a browser.
I did find a few bugs in the Atmosphere IoT app software when it comes to configuring the Dashboard. Overall, the iOS app works better than the Android one (at least on my devices). On either version of the app, it is better to configure the web dashboard on your PC (or Mac) because the various menus and options don’t render properly on all mobile screens and I found I got stuck on a screen that I couldn’t get out of a few times.
So, on your PC or Mac, browse to your Atmosphere IoT Platform account and click on the “Dashboard” icon. If you haven’t used it before, it will say “You haven’t added any widgets”. On the very far right of the screen there is a Gearwheel, that you need to click on. That brings up the “Configure dashboard” menu.
For simplicity, choose “Data Gauge”. This will bring up an empty window. Click on the three dots and choose settings.
Before you go any further, scroll right down to the bottom and click on Data Source, Select. First, choose the device (I have two as below, so I picked the Compostable device).
This will bring up the data source that you configured when you developed the mobile app.
Click on it, and then choose the data to be displayed (Temperature (number)).
Now, you can configure the other fields in the “Configure Data Gauge” window.
Click Save, and enjoy your work.
There are lots of other graphs you can put on your dashboard, such as a time-series “Data Graph” but once you have the simple Data Gauge working, it’s pretty straightforward.
Having done all that, I had my working prototype (indoors).
Weatherproofing the device
As I mentioned, I am a cheapskate and, after all, this is just a prototype, so I looked around for a cheap way of mounting the MCP9808 so that it would withstand the harsh compost heap environment, and the RSL10-SENSE-DB-GEVK so that it would be weatherproof. You might have better ideas (especially if you have access to a 3D printer, which I don’t), but here’s what I used ...
For the temperature sensor, I considered a piece of copper piping (just because I happened to have a spare bit) but wasn’t sure how to seal the ends. Then I remembered I had saved the casing from a cheap USB power bank that had bitten the dust. It was just a matter of putting the sensor inside with a bit of foam padding to stop it rattling around, then sealing up the holes in the casing with hot glue. Whatever you use, you will find that the MCP9808 breakout board, although small, is not an ideal shape and means that your casing needs to have quite a large diameter. If you were going to produce these things commercially, you would do away with the breakout board and make your own, much smaller board that you could mount in a thin piece of stainless-steel tubing.
For the RSL10-SENSE-DB-GEVK, I looked around for something the right shape and size. Although it is quite small, the debug connector on the RSL10-SENSE-DB-GEVK version sticks up quite a lot. Once again, for commercial production, you would use the non-debug version of the board and program it using a TC2050 10-pin needle adaptor. Then you could make a much smaller case. I found a supplier of IP65 casings (OKW Enclosures) selling an excellent range of enclosures for around $10.
Having got the casing sorted out, it was then a matter of soldering wires direct to the two boards (in place of the PCB pins) and applying heat shrink to the connecting cable.
Here is the finished product!
How does it perform?
I found that the range of the Bluetooth radio in the RSL10-SENSE-DB-GEVK is around 10 metres with clear “line of sight”. This can’t be configured in software, but in a production environment, the RSL10 SIP could be built for a better antenna than the RSL10-SENSE-DB-GEVK board allows. With that constraint, the device worked well.
The Atmosphere IoT app also imposes a constraint (as does the On Semiconductor “Sense and Control” app), which is that you can’t collect Bluetooth data from two RSL10-SENSE-DB-GEVK devices at the same time. This would limit my application to the gardener who only has one compost heap (or doesn’t mind moving the temperature probe from one heap to another). There is a work-around, though – which is to collect data from multiple RSL10-SENSE-DB-GEVK devices via multiple phones/tablets. You could then monitor all your compost heaps in the same dashboard. Since I have two RSL10-SENSE-DB-GEVK devices, I tried this – with both devices configured for sending data from the onboard sensors to compare the readings.
The battery life of the RSL10-SENSE-DB-GEVK depends significantly on the data capture rate – in my prototype I was sending the data every second because it made it quicker to see what was going on. In practice, one or two readings a day would be quite sufficient. Having said that, my sensor is still working after several days just using the same coin cell battery. This could be extended to several weeks just by tweaking the software.
Other possibilities
There is nothing to stop you collecting data from the onboard environmental sensors on the RSL10-SENSE-DB-GEVK as well as from the MCP9808 probe. This would then allow you to monitor the general weather conditions as well as your compost heap temperature – and therefore the temperature differential. This would be important for fine-tuning your compost heap mixture.
Atmosphere IoT offers Amazon AWS integration, so you could send the data to AWS and integrate it with other AWS services.
A further modification would be to use a different power supply to give longer operating life, or a solar panel battery charging system, which would give indefinite operating life.
Summary
The RSL10-SENSE-DB-GEVK is a great little device and my project was successful – I built a prototype device that will allow me to measure and record the temperature of my compost heap remotely and collect the data in the cloud. My prototype device would cost less than $60 (for the RSL10-SENSE-GEVK non-debug version) but, in volume production, the cost would drop to a fraction of that. It would be relatively easy to develop a custom app that would enable the data from several sensors to be collected by a single handheld iOS or Android device.
This would lower the “cost of entry” to commercial compost heap monitoring solutions so that they affordable for anybody with a mobile phone.
I hope you have enjoyed reading about this project.
Comments