I have plenty of thriving plant babies around the house that I like taking care of. But much like regular children; I am more fond of my 3D printers and gaming hobbies and often forget to water them. So I sought to create a simple project to monitor the health of my houseplants with the following qualifications:
- Low cost: I don't want to spend a large amount of money to monitor a cheap plant.
- Low power consumption: And if I can't remember to water a plant I probably won't remember to charge a battery.
- Easy to develop, deploy, and monitor remotely.
- Avoid cords/cables if possible.
Keeping all that in mind I decided to use my Particle Mesh hardware that I preordered from Particle to build In-Plants.
What is Particle Mesh Hardware?For those who are unfamiliar with Mesh networking, the idea is simple. Instead of having multiple devices that all speak to your home router directly you have one "gateway" device that speaks to the router and the other devices, or nodes, in the network speak through each other to send data to that gateway device. This way each node of a mesh network talks with each other and amplifies the signal, which ends up creating strong wireless coverage.
In the Particle Mesh topography the Argon acts as a gateway between my router and the rest of the network which lets each mesh device have its own IP address. The remaining Xenons connect to the internet through the Argon; allowing them to publish things directly to the internet without being directly connected to my router.
It's important to explain this because using mesh networked devices allows me to fulfill a large portion of my requirements. While the Particle Argon device has to maintain a solid connection to my router for internet traffic to pass through, the Xenons do not. This will allow me to place any or all of my Xenon's into a sleep state and have them only periodically wake up a few times a day to connect to my Argon and transmit the appropriate data. By entering a low power sleep state I can conserve a lot of battery power for a majority of my In-plant monitors. Plus it helps that Particle devices are cheap and relatively easy to use because of the large community support system.
First things first, let's take some time to print all the enclosures. We are going to want to start these prints first because it will take approximately 2 hours to get the rest of the project setup. You are going to need one full set for every plant you want to monitor, and it took my printer setup approximately 45 minutes - 1 hour to print all the necessary parts for one setup. You can find the hosted Enclosure files on Thingiverse.
After beginning the prints we are going to go ahead and start to register our Argon device. To reiterate, the Argon acts as the gateway device for the rest of the Mesh network. Meaning that the Argon connects directly to your wireless connection and the Xenon's will connect to it. It's important to set up the Argon first and correctly so you will have an easy time setting up the remaining Xenon devices.For this portion of the setup I'm going to direct you to Brandon Roberts' guide on how to setup an Argon Mesh device. He did a wonderful job putting the sets together and his guide helped me get my network up and running. You can also feel free to use the quickstart guide that comes with the Particle Argon. If you are having any issues check out Team Particle's video on how to add an Argon to your network.
The last step in setting up the Argon allows you to name your network, I named mine particle-plants, but feel free to name both your network and your devices anything you want.
If you are just wanting to monitor a single plant then you won't need to setup any Xenon devices. However, if you want to create the mesh network pick up a Xenon and let's get started. For this portion of the setup I'm again going to be redirecting you to Brandon Robert's guide on how to set up Xenon Mesh devices. It is very similar to the Argon article, just follow the dialog prompts on the Particle app and you should be able to set up your Xenon devices. Each device takes approximately 5-10 minutes to completely setup. If you are having any issues check out Team Particle's video on how to add a Xenon to an existing Mesh network.
Now that your Mesh network is connected to the internet they can now proceed to initiate Over the Air (OTA) updates. OTA updates happen automatically and take around 5 - 10 minutes for each device. This step is important because you will need the latest firmware version, 0.9.0 (Gen 3), for the software to run correctly. You will know that the device is currently doing a firmware update by the LED indicator on the top of the device. If your Xenon is blinking magenta (red and blue at the same time), it is currently loading an app or updating its firmware, this happened for me after connecting to the Mesh network for the first time and again after I programmed my Mesh network devices..
During this process, you won't be able to program any device in the Mesh network, so just sit back for a bit while we wait to program the devices with our In-Plant software.
Program the Mesh NetworkOnce everything is connected and updated we can head on over to the Web IDE and let's flash our devices! Feel free to start with either the inplants-argon or inplants-xenon code that can be found in the In-Plants repo on Github.
Simply copy the code from the *.ino file and paste it into the Web IDE code editor.
Then go to the Devices sub-menu (indicated by the Crosshair icon) and select which device you would like to flash by clicking on the star next to the device.
Next, go ahead and click the lightning bolt symbol in the top left corner of the Web IDE to flash that device. Repeat that process for all the Mesh network devices and you're ready to move on to installing the hardware into the In-Plant device enclosures.
First let's start by gathering all the materials that we are going to need including our particle mesh hardware, lipo batteries, connector cables, 3D printed enclosure, and screws.
Our goal is to solder everything inside our enclosure, so we are going to have to cut and solder a few things in order for it to look like the following circuit diagram.
First, we are going to cut the Capacitive Soil Moisture Sensors' connector cables so that we can solder them directly to the Particle hardware. I simply cut mine in half, leaving about 4" on either side.
Next, we are going to want to cut the header pins off of our particle devices. This is in order to make sure the particle device fits snugly into the In-Plants enclosure.
Now we are ready to begin soldering! Heat up your soldering iron and connect the capacitive moisture sensor cable red/black/yellow wires to 3.3V/GND/A1 on the particle board.
Then you will want to go ahead and solder the switch and battery cables together. This step is going to be a little difficult because the soldering may need to be done inside the enclosure depending on cable length.
Finally, you are ready to place the particle inside the enclosure, using the bolts to secure everything in place and plug in the power source and turn it on by sliding the slide switch.
Great job soldering and setting up the hardware! You should now have fully functioning In-Plant devices so let's go ahead and turn them on and see what happens.
First things first, make sure your In-Plant device with the Argon (the one with the wifi antenna) is turned on. Then go ahead and turn on the remaining In-Plant devices. You will know the In-Plant is properly connected when you see a slow beating Cyan light on the front cover. If you see a slow beating Green light multiple minutes after turning the device on you may have internet connectivity issues which could resolve in you having to go back through and setup the Particle Mesh device again.
Next, we want to make sure that we can see the data coming in from the In-Plant devices. So go ahead and place your In-Plant device in a plant pot and go to the Particle Web Console. From here we should see a live update of the plant sensor data and voltage levels of the various devices in your In-Plant network. The devices are currently setup to report their values every 6 hours. The Xenon devices are placed in a sleep state in between reads to drastically improve battery life. The Argon is kept awake the entire time and reports once every 60 seconds. This is because the Argon needs to maintain a connection to the router to transmit traffic to the Particle Cloud. Because the Argon needs to stay awake, its important that you connect the In-Plant device with an Argon to a power source. A worthy sacrifice in order to keep the rest of the mesh network battery efficient.
So we've ensured that our sensor data is actually being sent to our Particle Cloud, but reading data values this way isn't easy and quick to digest, so I quickly pieced together a frontend to visualize the data coming in.
I found a bunch of different services online to visualize this data, including thingsboard.io and freeboard.io but in the end, I settled for something both free and easy to setup for this prototype. I ended up going to Thingspeak.com and utilizing their free visualization tools. They aren't anything super fancy, but they get the job done, so here is a quick tutorial about how to use them. If you want to utilize a different frontend architecture or design your own (like I intend to do in the future), feel free to skip this section, but you're also free to imitate my setup as seen in the images below:
First, you are going to want to head over to the ThingSpeak website and create an account. After successfully logging in, you are going to want to create your first channel. Give it a name, description, and set a field for each of your In-Plant sensors. For my first channel, I am going to only monitor the soil humidity levels of all my In-Plant sensors.
Afterward, click on the API Keys and note your Write API Key
Next, you are going to want to create webhooks using the Particle Console to request your In-Plant sensor data from. To do this navigate to the Integrations Menu by clicking on the Icon in the Particle Console.
Click on "New Integration and then Click Webhooks. You can then click on Custom Template.
Replace the code block in the Custom Template page with the following codeblock. Make sure to replace the <WRITE_API_KEY> field with your ThingSpeak Write API Key from the previous step.
{
"event": "plantStatus_percentage",
"deviceID": "<DEVICE_ID>",
"url": "https://api.thingspeak.com/update",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": true,
"form": {
"api_key": "<WRITE_API_KEY>",
"field6": "{{{PARTICLE_EVENT_VALUE}}}"
}
}
Finally, go back to the Webhook builder screen and select a specific device you would like this webhook to target.
Repeat the "Creating a Particle Webhook" step for every device in your In-Plant network whose humidity you would like to track. If so you will have a webhook for every device in your In-Plant network.
After doing so we can go back to our ThingSpeak channel to view the humidity levels of our entire network.
If you also want to monitor the voltage levels of all the devices in your In-Plant network repeat the "Create a ThingSpeak Channel" and "Creating a Particle Webhook" step but this time using the following code block in your Custom Template for your voltage readings.
{
"event":"plantStatus_voltage",
"deviceID":"<DEVICE_ID>",
"url": "https://api.thingspeak.com/update",
"requestType":"POST",
"noDefaults": true,
"rejectUnauthorized":true,
"form": {
"api_key":"<WRITE_API_KEY>",
"field6":"{{{PARTICLE_EVENT_VALUE}}}"
}
}
Currently, that's all I have to show for In-Plants. It's my first step into mesh networking and there are tons of improvements that I would like to see with this project including but not limited to:
- My own frontend that is hosted locally. ThingSpeak is alright for now but it is definitely a little limiting. Would like something that allows the user to input what type of plant they have (fern, succulent, etc.) and have the appropriate humidity level scale appear.
- Figure out a way to incorporate a sunlight sensor on the device, to tell how much sunlight my plants and receiving.
- Solar power? If I could recharge using solar that would save me some time from going around and recharging my In-Plant devices manually.
- Some sort of pump to automatically water the dirt if the plant humidity level falls below a certain threshold.
🌱🌱🌱 Please hit me up if you have any questions or would like to collaborate on any portion of this project, I'd love to talk! 🌱🌱🌱
Comments