- Raspberry Pi 3 (Recommended) or Pi 2 Model B (Supported) - Buy on Element14 - Pi 3 or Pi 2.
- MATRIX Creator
- Micro-USB power supply for Raspberry Pi - 2.5A 5V power supply recommended
- Portable Power Supply
- Greenhouse Kit
- 3D-Printed Case for the Creator
- Micro SD Card
- Internet connection (WiFi / mobile hotspot)
- Personal Computer (Windows, Linux, or Mac)
- PVC Pipes/Connectors/Extenders/Adapters
This project blog post is for an automated greenhouse called EcoHub, after a local hackathon group, which can also be voice controlled using a Snips.ai assistant named Amingo, after the Capcom video game character.The Build
The first step I took in creating EcoHub was to get the hardware out of the way before working on any code, so as to know what I would have to work with. I began by getting a cheap two-foot greenhouse kit from amazon to use as my base for holding the plants.
After assembling the kit, I made a few adjustments to fit my ideas. In theory, EcoHub is meant to water two sets of plants, each on a different level of the greenhouse; this was so it could adapt itself to watering plants with different water cycles (e.g. a set of cacti and agaves would be on a different level than a set of Bella Donna lilies and irises).
After rearranging the levels on the greenhouse, I drilled holes through the plastic pieces connecting the stands and put the PVC pipes through the hole so they could be easily supported; before fixing the PVC pipes, I drilled holes through them and capped them at one end. Then I attached valves at the end of the pipes passing through the holes, and then connected them as shown below.
This was the old design, however, and I changed it to make it easier to work with the servos, connect the hose, and make sure that any electronic equipment wasn't in danger of getting wet. Unfortunately, in this iteration of EcoHub, the two-plant-set idea was discarded, but I'll eventually add it with further editions.
The next step was to connect the hose and start the code. I used a hose to 1/2 inch PVC pipe adapter to connect the top PVC pipe and added the servos to each valve. Since I didn't have a 3D printer at the time, I had to use other PVC supplies to create the holsters for the servos; they were also made so that you could replace or remove the servos whenever you wanted, by just pulling the pipes out or pulling the holsters up.
For those who haven't used Snips.ai yet, it's a a software used to create voice assistants such as the one in this project. Aside from being automated, I also wanted the EcoHub to be voice controlled in case someone wanted to manually water plants, keep track of the plants they have, and get the state of the greenhouse's average temperature and humidity.
Here, I created the Amingo assistant and added an app to operate the greenhouse. Inside of the app, I added an intent with slots for each thing Amingo was supposed to control. As you can see, Snips has a hierarchical system for its assistants: an assistant contains apps which contain intents which contain slots. Intents and slots are what actually interact with the code and the device you're using. An intent creates an MQTT channel for sending data about what the assistant has heard, and slots are the way of categorizing this data.
Once I made the Snips assistant and trained it on some commands, I deployed it to the Raspberry Pi with the Creator.
assistant.js:this file gets the intent from Snips and responds to the commands accordingly
servo.js:controls the servos, automatically waters the plants, and gathers data about the greenhouse's temperature, humidity, plants, and watering cycle.
plantobject holding all known plants and their preferred watering cycle.
In assistant.js, the MATRIX Creator subscribes to the MQTT topics of wakeword, session-end, and the intent created. Depending on which topic the Creator hears, the command following the
case statement will run. The basic commands it's able to understand are:
- Water the garden
- Add/remove a plant from the list of plants in the greenhouse
- Get the current and average temperature and humidity
- Name the current plants
It's able to do this by including the servo.js file.
servo.js contains an object full of functions to control the servos and get the sensor data. It also periodically checks the list of current plants and gets the average watering cycle, and waters the plants accordingly. The water cycle could be often (around every 18 hours), regularly (around every 36 hours), or sparsely (around every 72 hours). Since plants don't benefit from a consistent watering cycle, I randomly added/removed an extra hour or two. servo.js also writes the data to a text file.
The Finished Project
plantData.js simply has an object with a list of plants and their water cycles.
So, that's the current state of EcoHub. I had a lot of ideas in mind about how to make it look nicer and more efficient, but currently I'm satisfied with at least a working version. Overall, this was a project I had a lot of fun making, though it didn't turn out as expected; I had always wanted a garden and so it was interesting trying to automate it.Future Additions
- Two levels for different sets of plants
- An interactive website for controlling the greenhouse remotely
- Replacing the handmade parts with nicer, 3D-printed pieces
- Soil data