The Raspberry Pi is an amazing device to complete projects, for people from all backgrounds. No matter the skill level, you are sure to make something great using the Raspberry Pi. That's why this project is centred around the Pi.
We've had a vegetable garden for a while now but it has also been used as a field to play in by our pets. So we really could've used a greenhouse of some kind to keep them out. And what better way to add some flavor to a project than to automate it completely!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Step 1: Gathering Tools and Supplies
For this project I used a number of tools. Not all of these are necessary but I had them laying around. I used the soldering iron to solder my components on to a prototyping board. This gives me a more final product with less chance for loose connections. However this is definitely not required as you could control the pump and fan just as well by just using a breadboard.
The zip ties is to hold everything in place and I used a multi-meter to test and troubleshoot during the process.
I ended up placing the electronics and plants in their own boxes and those together in a big box.
You can find the full bill of materials listed above.
I sampled the components from a variety of sources. Some items I got from local stores (D'Tron, Brico Plan-it) and other items I ordered online from Amazon. You could definitely order all these components from amazon also.
Step 2: Step 2: Testing the Pump and Fan
Before connecting anything I chose to test how to power the fan and the pump. The pump only has 2 wires to I connected them to the header of my 12 V adaptor and the pump turned on.
The Fan is a little trickier as it has 2 wires. It has a positive voltage, ground and a control pin. By testing I found out that by connecting just the + and GND pin is enough to turn on the fan on full speed. With the third connection you can adjust the speed but for this project this wasn't needed.
Now that I know that both the fan and the pump can be turned on by just providing 12 volts to the pins, I also know that all that is needed is for me to control a relay with the Raspberry Pi as the Pi can not provide 12 V itself.
Step 3: Step 3: Testing the Sensors
The next step in this process is to test reading in the sensors.
The temperature sensor I used is the DS18B20. This sensor is optimal for connecting via the 1-Wire protocol. The sensor has 3 wires. A VCC, a GND and a Data Wire. The wiring is really easy. You connect the GND pin from the sensor to one of the GND pins from the Raspberry Pi. The VCC pin goes to the 3V3 output and the Data Wire is connected to pin 7 of the Pi (GPIO 4)
The Moisture sensor a bit more complicated. Since the Raspberry Pi isn't capable of reading in analog input by itself we're need to use a analog to digital converter. The converter used is the MCP3008. The wiring for this can be found in the schematic below.
The test code is provided in this Instructable. This code will read in the sensors and print their value to the console of the Pi.
Step 4: Step 4: Combining Sensors and Actuators for a Test
Now that we are able to read the sensors and control the pump and fan it's time to combine these aspects. The full schematic for the project is provided in this step and so first thing to do is to connect everything up on a breadboard. Now we're able to control the relay based on the temperature. And the same thing with the pump.
The best thing to do here is to go through the schematic of the circuit and place wire by wire and scratch off any wires done.
It's not needed to connect the pump and fan to the relay just yet as the relay will give a clicking sound when it gets activated or deactivated (along with a led indicator).
The test code is also provided. This will read in the sensors, print their value and control the relay if the go above a threshold.
Step 5: Step 5: Soldering the Components
Now that the components are tested and we know they work. It is time to solder all of them to a prototyping board. Note that with a prototyping board the rows of pins are not connected yet unlike a breadboard so we have to connect these ourselves.
I recommend starting with the smallest components first as this reduces the chance of them falling out compared to later when bigger components are placed on the board.
I chose to not solder the MCP3008 and Raspberry Pi T cobbler directly onto the board but instead use an IC-socket and a PCB header. This allows for safer removal and insertion of the IC into the circuit. This also makes replacing the IC and Cobbler easier if they break.
Once the components are placed and soldered onto the board it's time to add the wiring. We follow the same schematic as before. This is where the multi-meter came in handy to test if the connections were good and didn't overlap and touch a pin next to it.
Step 6: Step 6: Placing the Components in the Case
I found a small box that was about the dimensions of my setup so I can store all of it into a box and run the wires out of it.
I marked off a hole for the temperature sensor, moisture sensor, Raspberry Pi power cable and a place to run out the cables to the fan and pump.
Next I used a small drill and a knife to cut and drill out the holes to run the cabling through.
Step 7: Step 7: Connecting the Water Reservoir to the Pump.
Now it's time to connect up the pump to the water reservoir.
I started by placing the connector onto the box to outline how big the hole has to be and mark off the center.
Next up I take a small drill bit and punch out the center of the hole, slowly increasing drill bit size until I drilled out the entire circle.
With a bit of sandpaper rolled up I shave off the last bit of shavings attached to the hole and smooth it all out.
I ended up with a small crack in my reservoir but nothing too big that couldn't be fixed with some glue. I started screwing in the connector and just before screwing it in all the way I add a bit more glue to make that connection water tight and durable.
The other end of the connectors feeds into the input opening of the pump.
Step 8: Step 8: Mounting the Fan Into the Wall
Just as in the pump installation I started by outlining what had to be cut out.
I used a knife to cut along the outline but found this to be very hard to do. I ended up sticking with this but caused a lot of cracks and if you have any recommendations on how to do this better, I'd love to hear it!
I heated up the edge of the knife just a bit and cut a small bit of the diameter, then reapplied some heat and continued in small steps like this.
Once the hole was cut out I used double sided tape to tape the corners to the case. Ensuring that it wasn't gonna move anymore.
Step 9: Step 9 Arranging Components in Big Box
Now it's time to arrange all the different sections of this project into the big box I will use as a greenhouse. The 2 power plugs (Raspberry Pi and 12 V external power supply) are plugged into a power strip so I only need to run 1 cable out of the greenhouse.
I cut out a hole into the box to run out the cable.
I used double sided tape to tape all the compartments into the final box. Start by cutting off a strip of tape and taping it down onto the floor. Then peel off the other end and place the box on top of it. Press down a bit and leave it rest. The tape I used was strong enough to hold everything together.
Step 10: Step 10: Water Pipe
To install the water pipe I drilled holes every few centimetres so water can drip down from it onto the flowers.
I found attachments I could place in the holes that widens the water spray but this is by no means necessary and would work just as well by drilling a few extra holes.
I created a path over the herbs and attached the corners of the pipes to the walls of the greenhouse with zip ties. Be careful here to not tie them too tights as this could cause the water to no be able to get past the kinks.
The end of the tube is folded double and cut off the water stream by tying it off with a zip tie. This is needed so the water goes through the holes and sprays the plants instead of just coming out of the end.
Step 11: Code and Contact
This is every step you need to start your own Herb Garden which controls itself completely automatically! Above this you can find the code to run the Raspberry Pi and also a file to run the website attached to this project locally from your Pi.
This let's you monitor the temperature, humidity and fan status while also controlling the pump manually if you feel the plants could use an extra spraying.
I wish you good luck with this project and definitely let me know how it went!
Any questions or want to check out more of my projects?
You can contact me at firstname.lastname@example.org
And you can check out my portfolio at http://student.howest.be/jasper.dar/portfolio/
Participated in the
Stick It! Contest