Introduction: Environment Control System
In this project I show the construction of an Evironment Control System which is controlled with a Raspberry Pi.
This was for my eighth-grade STLP (Student Technology Leadership Program) project. More information about Kentucky's STLP program is available at their website, which is:
Currently, I can use it to control a small table-top sized demonstration greenhouse. The system can scale to be much larger, however, since it uses relay boards to switch 120v outlets.
My goal was to develop an environment that would be optimal for a food-producing plant so that food and sustenance could be obtained in extremely urban areas, in places with rapidly changing climate, or even on other planets, such as Mars. The ECS system could also be used to grow plants in areas too far away from the optimal growing area to ship. I will do this by controlling three variables: temperature, moisture, and light.
I used temperature and moisture sensors to relay information to the Raspberry Pi computer, which uses the information to decide when to turn on a water pump or a heating device. I also drive an LED grow-light in a computer controlled day-night cycle. In order to show progress as the plants grow, I use a computer controlled camera mounted within the dark enclosure to track the progress of the plants.
Step 1: Building the 4-gang Switched Outlet Part1
In order to switch greenhouse heat, lights, water pump, and ventilation fan, I assembled a 4-gang switched outlet.
It is viewable on the right in the picture above.
Step 2: Building the 4-gang Switched Outlet Part2
A standard US outlet has two receptacles, and normally they are wired all together. Since I wanted to switch four outlets and I wanted to do it in the smallest space possible, I chose to break one of the tabs between each pair of receptacles. In this case, I chose to break the "neutral" side. You can see that in the two photos above. In the second picture, note that there are two neutral wires for each outlet pair, for a total of 4 neutral wires. It is these 4 wires that will be switched when the relays are in operation.
Step 3: Lay Heat Tape and Build Support for LED Grow Light
Early on in the development stages of my project, I realized that the heat lamp I planned on using to heat the enclosure would greatly interfere with the day-night cycle, as well as heating the air too much, while heating the dirt too little. So I scrapped that idea, and decided to use heat-tape instead. I could put a heat-coil under the dirt, which would heat the roots of the plant most importantly, and due to the rising of its heat it would warm the air quickly and easily.
In the first picture above you can see the heat tape held down with insulated staples.
After getting the heat tape fastened down, I made a support for the LED grow light I had bought. As you can see in the second picture, this is just a simple wood frame held together with screws. I used coat hanger wire to attach the light to the support. In the third picture the frame and support are on their side so you can see the bottom surface of the grow light. That's a lot of LEDs.
Step 4: Make and Use the Planter Tray
The planter tray shown above had to fit a very specific small greenhouse I had, so I had to make the tray. I used the bottom of a cardboard box, cut it to size, and water proofed it with layers of plastic wrap and aluminum foil.
Then, as seen in the first two photos above, I planted my demonstration plants. In this case, I chose lettuce.
After planting I put the planter tray into the bottom of the greenhouse, and put the house in place on the heater and directly under the LED grow light.
Step 5: Construct Water System
For this demonstration greenhouse, I chose a small submersible pump. With this, I can use a bucket as water reservoir. To distribute the water into the platter tray, I used tee and a circle of tubing. I drilled 1/64 holes into the bottom side of the tubing. Then, I placed the dribble hose into the planter tray. Before use I attached a piece of tubing between the outlet of the pump and the tee fitting on the dribble hose.
Step 6: Wiring the Control System
A very important step was to wire the wires from the gang outlet to the relay side of the relay board. The second picture shows the power, ground, and control wires on the input side of the relay board. The last picture shows how the breakout board looks after I wired my 2 inputs (soil temperature sensor and soil moisture sensor) and 4 outputs (the relay controls) to the Raspberry Pi. It looks complicated but it isn't really.
Step 7: Sensors
My temperature sensor is a 3 wire device which looks like a transistor, but it's much more. I'm using the DS18B20 from Dallas Semiconductors. This device is directly supported by the Raspberry Pi. After hooking it to power, ground, a signal pin, and running very simple setup, the operating system reads the temperature and puts the result in a file. Can't get much simpler that that.
During the construction of the greenhouse, I realized that the soil temperature sensor wasn’t water proof, so to protect it from moisture, I encapsulated it in heat-shrink tubing, and sealed it with epoxy. The first picture shows three temperature sensors in various stages of preparation. On the left, the leads have been soldered to wires and heat shrink tubing applied to each lead individually. The center sensor has an added layer of shrink-wrap tubing over all the wires and the end of the sensor. The rightmost sensor has all that done, and epoxy applied to each end of the shrunken package to seal out any water or moisture.
In the second picture you can see the soil temperature sensor and soil moisture sensors being placed in the soil.
Step 8: Programming and Running
I built a series of small programs to:
- Turn lights on
- Turn lights off
- Turn heat on
- Turn heat off
- Turn on water pump for 15 seconds
- Take picture with Raspbery Pi Camera
- Read soil temperature
- Read soil moisture
Many of those programs are included here.