The Raspberry Pi takes over a greenhouse

Raspberries Out Back

Martin Mohr

Keeping up with a garden is a lot of work. Luckily, with a Raspberry Pi, you can automate your greenhouse.

Professional gardening operations are known to employ modern technology, but you can also put technology to work to automate a small greenhouse in your backyard. With the use of a Raspberry Pi, a variety of sensors, and a few actuators, the yields from your plants will increase, and you will save time.

The greenhouse project described in Raspberry Pi Geek issue 7 [1] has been in operation for a year now, which is long enough to show its strengths and weaknesses. The update described here for the greenhouse automation project provides additional capabilities and eliminates some of the weaknesses observed in the original design.

A number of good reasons for redoing the project presented themselves. The first problem is that the housing for the electrical components is too small. This makes it difficult to expand the design. Moreover, the components are crowded together in the housing, so changing out a defective part requires dismantling most of the setup. The Raspberry Pi also has reached the limits of its capacity as a control center. In particular, it lacks an analog input on the GPIO needed for collecting data from the environment.

New Hardware

To compensate for a lack of space in the current control box, the control electronics can simply be moved to a more generously sized box. An electrical control box is a weatherproof piece of equipment made from metal. The box I use is large, at 30x40x21cm (~12x16x8 inches), and weighs in at a hefty 9kg (~20 lb). Therefore, the mounting apparatus has to be suitably robust.

The apparatus is made from two wooden posts, each with a diameter of 80mm (~3 inches), and a wooden base to which the electrical control box can be mounted using M8 machine screws. This robust construction should make it through both hot summer temperatures and the cold of winter without suffering damage (Figure 1).

Figure 1: A sturdy electrical control box serves as the new home for the Raspberry Pi gardener.

All of the wires run from the interior of the housing through watertight cable connections to the outside; a terminal block makes for fast and easy exchange. The box has plenty of room inside to lay a wire harness. These modifications contribute to a more flexible design for the entire greenhouse control apparatus and make it possible to expand the design.

The Raspberry Pi is still used as the brains of the operation, but with several improvements. The most important of these is the migration of communication that occurs from the Rasp Pi, the actuators, and the sensors to an I2C bus. This project was easy to accomplish, and was made inexpensive and convenient thanks to the many semiconductors available on the market.

At this point, all of the limitations imposed by the GPIO on the project fall away – specifically, the restricted number of I/O ports and the lack of an analog interface. All of the control components, including the Raspberry Pi, the power supply, and I/O and measurement modules, each sit on one board connected to the backplane. With this flexibility in putting the switches together, it is easy to change out components that fail.

At first glance, this way of installing components might seem more complicated. However, you will find that the work is worth it when it is time to perform maintenance. To start, I will take a look at all of the components and introduce them in detail. You can find all of the circuit diagrams referred to in this article online [2].

New Construction

The expression "backplane" might sound complicated at first, but it is really just a breadboard on which each individual connection for a pluggable connector is linked to all other pluggable connectors. This means, for example, that a wire on pin 1 of the first connector leads to all of the other pin 1s in the rest of the connector locations. Figure 2 shows a finished backplane for the greenhouse control that was made from a simple 160x100mm (~6x4-inch) Eurocard [3].

Figure 2: The simple and economical backplane built for the greenhouse control makes it easy to perform maintenance on the project.

Another unique feature of the backplane used in this project is that all of the pins are linked in a row. This means 25 lines are available for communication with peripherals from the 50 pin connections of each plug. The current construction uses just a fraction of the pins. Therefore, the project has ample room for expansion. Table 1 shows the current pin assignments on the bus from top to bottom.

Table 1

Pin Allocation

Pin

Assignment

1

+5V

2

+3.3V

3

I2C SDA

4

I2C SCL

5-24

Unassigned

25

0V (GND)

The main advantage of the design is price. The components are available in any electronics store for very little money. The two-row plugin connectors make the entire construction considerably more stable than would be the case with the one-row alternative. Bus systems that have been prepared with an eye to all possible details are expensive by comparison and would increase the project cost.