Open Source IoT Sensor Network
Plant Friends is a plant environmental monitor system. It monitors the soil moisture, air temperature, and air humidity of your indoor plant(s) and will alert you via email when your plants are thirsty. The system is battery operated, wireless, Arduino and Raspberry Pi based and comes with an Android app. The app enables you to look at the real-time and historical data (temperature, humidity, soil moisture) on your phone. This is what it looks like:
Here is a diagram to show how Plant Friends operate:
The sensor nodes consists of a Moteino (an Arduino clone with an RF transceiver), a soil moisture sensor, a humidity sensor, temperature sensor and a battery meter. Once the sensor node collects the sensor readings, it transmits the data via the transceiver over the 915mhz ISM band to the base station. One system can have over 100 sensor nodes.
The base station houses another Moteino, which acts as a gateway to receive the RF signals, and a Raspberry Pi where the data is logged into a MySQL database and serves the data to the Plant Friends mobile app. The Plant Friends app is an Android app written in Processing that displays the sensor node data in a pretty way. :)
AWESOME! This tutorial is aimed at users slightly above the beginner level. I'll assume you have some basic experience with Arduino hardware and Arduino IDE (like making LEDs blink, installing libraries, etc.), basic knowledge of the Raspberry Pi (install Raspbian OS, etc.), and you know how to handle a soldering iron!
Before I send you off on a shopping spree, lets outline some goals for the system as it will dictate how the system operates. For my Plant Friends system, I wanted the following things:
1. Remind me to water my plants. Alert me via email and/or SMS.
2. Be able to monitor multiple plants. I have plants in different rooms in my home so I'd like to be able to monitor all of them at once.
3. I like to shuffle my plants around so the system needs to move freely. This means minimal wires and reasonable size. To do that, the system needs to run on batteries which leads to my next point.
4. The system needs to be low power. I want the system to run on a set of batteries as long as possible so I don't have change them out often. Because, lazy. I feel 4 – 6 months between each battery swap is reasonable.
5. Android app. Because even bathroom scales have one nowadays. I'm kind of a stats junkie so being able to look at the data from my phone is a plus.
7. Low maintenance! Again, lazy.
8. Some sort of enclosure to organize and protect the electronics.
For this project, we will not be using the official Arduino boards (ie. UNO, etc). Instead, we are using an Arduino clone called the Moteino.
The Moteino is made by Felix at lowpowerlab.com. It uses the same ATmega 328p chip as the official Arduino UNO boards, works the same way but with a few big advantages: It comes with an optional radio transceiver allowing us to transmit and receive data wirelessly, the board measures at a small 1.3 x0.9 inch, and the whole system runs on 3.3 volts which means compact size, low power and long battery life. The transceiver can expand to support 256 nodes in 256 possible networks!
Go ahead and get a little familiar with the Moteino. http://lowpowerlab.com/moteino
The following is a list of parts that you will need for this project.
The Plant Friends enclosures are constructed out of laser cut bamboo. I designed it so all the pieces snap together and does not require any glue. The sensor node enclosure houses the Moteino, the sensors and the batteries. The base station enclosure houses the Raspberry Pi and gateway Moteino. You can get the design over at my Github page: https://github.com/dicksondickson/PlantFriends
You are welcome to use any enclosure that you like.
SENSOR NODE ENCLOSURE
1 x Plant Friends Sensor Node Circuit Board
This is my custom designed circuit board for the Plant Friends sensor nodes. Everything uses easy-to-solder through-hole parts with proper through-holes to accommodate a Moteino. All the sensors for the sensor node will sit on this board. If you prefer a more DIY solution, scroll down for the protoboard.
You can get the PCB at my shop. Ships internationally: http://dickson.bigcartel.com/
1 x Protoboard 3cm x 7cm
For those of you that prefer a DIY solution, these 3cm x 7cm green protoboards for work well for the sensor nodes. The components that make up the sensor node, including the Moteino, will sit on this board. Get it on eBay.
1 x Plant Friends Soil Probe
This is my custom designed soil probe for Plant Friends. It is gold plated and LEAD FREE so it's safe to use with any plant including those grown for food. The length is 82mm / 3.25 inches so it is perfect for deep planting pots. The gold plating will resist corrosion much better than other types of metal plating and last much longer! You can use two nails if you wish but getting this will simplify things.
You can get these probes at my shop. Ships internationally: http://dickson.bigcartel.com/
Alternative Soil Probe
This is an alternative soil probe that you can get on eBay. But be warned, these probes might contain LEAD. If you are growing food, I suggest you use my custom designed probes listed above or use two nails as the probe. I won't be covering the nail method in this article, so Google is your friend! Get it on eBay.
2 x Moteino with RF Transceiver
I am using an earlier version of Moteino with the RFM12B - 915mhz transceiver. You'll need at least two of these for Plant Friends. One will be the sensor node, the other will reside with the Pi which will act as a gateway. If you want to make more sensor nodes, buy more. Lowpowerlab.com Store
NOTE: Felix released new Moteinos that has the option to use the newer, higher power RFM69HW transceiver. The newer transceiver will give you longer range but at the cost of higher power consumption. I highly recommend using the new latest Moteino with the RFM69HW radios.
1 x USB to Serial TTL FTDI Adapter.
1 x Raspberry Pi Model B
We are going to use a USB WiFi adapter for this project so either model A or B will work fine. I recommend the B because it has more RAM and the Ethernet port will give you some flexibility. Adafruit
1 x 8+ gig SD Card for The Pi
Take your pick. I use a Sandisk SD cards. As of the time of this writing, 8gig and 16 cards are about $10-$15. 16gb size ones seem to hit a sweet spot so get that. Get it on Amazon.
1 x USB WiFi Adapter for The Pi
I'm using this one from Adafruit and works very well. Adafruit
1 x 5V 1 Amp Power Adapter for The Pi.
1 amp minimum power adapter is required for stable operation. Make sure to get a good, LONG micro USB cable while you are at it. I recommend a length of 6 feet / 1.8 meters so you have some flexibility on where to locate the base station. Adafruit
1 x DHT11 Humidity and Temperature Sensor.
This is an air temperature sensor and air humidity sensor in one. You'll need one for each sensor node. If you are making multiple sensor nodes, get more. Adafruit
1 x AA Battery Holder (holds 4 AA batteries)
The Plant Friends sensor nodes uses 4 AA batteries in series configuration. I am using this type. You'll need one for each sensor node. Get it on eBay.
4 x AA Rechargeable Batteries
I recommend using rechargeable batteries because it is better for the environment. Sanyo/Panasonic Eneloops win hands down. Get it on Amazon.
2 x LEDs, Any Color, 5mm Size
I personally like white LEDs but you can pick any colour. We'll need two, one for the sensor node and one for the gateway. Get it on eBay.
1 x PN2222 NPN Transistor
In our effort to optimize battery life, we will use this to turn on/off the humidity sensor. 1 per sensor node.
If you don't have a resistor kit already, eBay is good place to get multi-value resistor kits for CHEAP.
100 ohm resistors – 1 for each node.
10k ohm resistors – 3 for each node.
56k ohm resistors – 1 for each node.
220 ohm resistors – 2. One for each node and one for the basestation.
2.54mm Male and Female Pin Headers
We'll need this for the sensor node. The moteino will have the male headers and the protoboard will have the female headers. Guess what happens next. Get it on eBay.
Use whatever you have. I salvaged an old mangled CAT 5 cable for the wires inside.
Android Phone / Tablet to Run The Plant Friends Android app.
I am using a Nexus 4 so anything equivalent or greater in CPU power will work well.
1x Ethernet Cable for Initial Setup of The Pi.
No keyboard or monitor needed. We will setup everything via SSH. The Pi will run headless and wireless once we have everything setup.
To make this build more manageable, we'll break the system down into three parts: the sensor node(s), the base station, and the mobile app. We will concentrate on building each section and then bring everything together into a working system.
1. Intro & BOM