This is the story of the standalone, coin-cell-powered, BLE plant monitoring system.
This project started out as an ESP8266-based plant monitoring system that measured soil moisture, humidity, air quality, temperature and time, that then pushed all that data up to My Device's Cayenne.
The system was cobbled, crowded and inefficient. It didn't make sense to add a WiFi-capable board to each plant to be able to move them around and away from each other. To monitor the plants from one ESP8266, additional hardware was needed to accommodate the extra IO.
Long wires were no good either.
The project was tabled until a wireless, standalone and streamlined solution could be worked on - basically an issue with time, money and fortitude.
Mort is currently attending CU Boulder and is slated to get his Masters in Embedded Systems this fall. He finished a course called "IoT Firmware Design," which focused on Bluetooth Low Energy. The Blue Gecko Bluetooth Kit for EFR32 was used in the class and has built-in sensors, a mobile app with app builder, and my favorite features - Simplicity Studio IDE and an energy profiler for milli to micro amp current monitoring.
The final project in the class was focused on a BLE software solution that included the BGXXX (two different SoCs) microcontrollers, a few sensors, and implementation of security features, MITM, energy optimization, persistent storage, etc. He proposed an adaptation of the original "Internet of Plants" project, which was accepted. Mort was able to quickly adapt software written on the dev board for the soil moisture sensor. We decided on using the BG13.
We designed a BLE soil moisture sensor with the ultra-low-power bells and whistles needed to monitor plants (we had to scrap the air quality sensor since it is not low power). The data can be picked up using any smart device. We used both the mobile app that comes with the kit and also a Raspberry Pi to decode the data and push it all up to Cayenne. This project in currently in Rev 2, moving the SWD connector to the back and fixing what is going on with that jumper wire, but it works! Powering the module (no smoke) and witnessing the Bluetooth device pop-up on my cell phone was an immensely rewarding experience, especially since it was a first prototype and entirely home-brewed.
The necessary circuitry from the Blue Gecko module like the antenna, radio interface and power management were placed on the soil moisture sensor, along with the low-power sensors. We added an analog switch to turn off the sensors when not being read to extend the life of the battery. Of course we ordered protos from OSH Park; we hand-assembled the board using a stencil from OSH Stencils and used the desktop reflow oven T-962. We also used Nick Poole's Buzzard tool to get that adorable bear on the board.
And that's it for now - we took a mess of wires and hardware and turned it into a wireless, independent, low-power plant monitoring system. It will be interesting to see where this product goes.
Wow, that is crazy low power wireless. Great project!
Great project!
I noticed that the BG13 satisfies one of my "hot buttons", and has an on-board RTCC.
One question comes to mind: How frequently is your device taking measurements?
I presume that somewhere in the full system is the ability to set off an alarm that the plant needs to be watered -- I've been known to have cactii die because I forgot to water them often enough! (Fortunately my cat serves as her own alarm to let me know when her water dispenser is out...)
I don't see a need to take measurements more than once an hour. The most interesting times to take more measurements are at sunrise and sunset. Every reading can change enough to make the graphs less boring.
The alarms are set in Cayenne. It's easier set up a text alert from the My Device's platform than try to build it into the app. Though it could be easy enough to do it with a python script if you are using a Raspberry Pi to read the data. I haven't used an Alexa or Echo - I bet you could ask Alexa to sound an alarm under some conditions.
I also noticed a typo in the blog post - when taking powering the sensor and reading the data the current is 152uA not 152mA.
I'll admit that I'm not familiar with Cayenne. In my experience, there can be outlier readings (often referred to as "flyers") with any sensor. (I often deal with that problem by taking 6 [or 10] readings, adding them up, subtract out the "high" and "low" value, and divide by 4 [or 8] to get the result [note that division by a power of 2 is trivial at the machine level].) I'd be disinclined to "sound the alarm" for this based on one reading -- maybe 3 or 4 consecutive readings "outside range", at least on the moisture. The other thing that I might do is to "repeat the alarm" if the condition is still true after, say, 24 hours. Just "thinking out loud" there...
Also, I suspect that the reading only takes a fraction of a second. Even if it's 1 second, that's a "duty cycle" of only 0.03% (with hourly readings), so even if it were 152mA a factor of 1000 is only going to make a difference of about 30% on the life of the battery, but given that it may be more like 100mS (or less), it would only be about 3% on the battery life.
You can take a reading as often as you'd like from all or specific sensors on board and set up the alarms how they make sense to you. It's part of what we were going for.
We were optimizing energy - With three sensors on board and powering the microcontroller every energy savings we could take we did. If we had seen mA anywhere in our measurements we would have considered our experiment a failure by our own standards.
It's not hard to do a moisture sensor using a four layer board, with the sensor copper on layers 2 and 3, such that the sensor never actually contacts the dirt, which eliminates the corrosion issues.
Not hard at all. We just intermittently power the device for a second or so 24 times a day. This also drastically reduces corrosion. Maybe something to consider for the next round.
Create a capacitor with copper on the inner layers, interdigitated fingers. Use an I/O pin to charge this capacitor through a resistor, sensing the cap charge with another I/O pin. When you hit a high, then discharge till you get a low. Repeat. Count the cycles over a given amount of time, and you get a number. Done right, this will sense a single drop of water on a 4 inch square sensing area, and you can watch the drop evaporate. Moist vs dry soil has a different dielectric constant, so the value of your capacitor changes as the moisture changes. I implemented this on an AVR very easily.
I bet a loop of direct burial insulated wire would work well and be immune to corrosion. The capacitance of the wire will change relative the environmental moisture. We had a project involving transmitting I2C signals underwater. It worked great on the surface but as soon as it went under, the additional capacitive load caused the clock to skew and the code to lock up. We unintentionally created a water sensor. But that was salt water so it may not work here.