Case study · Greenhouse automation · Arduino PLC + Raspberry Pi
Humidity, CO2, temperature and light. Two Arduino PLCs run the greenhouse.
How a greenhouse manager built an open control system with Industrial Shields equipment: two Ethernet PLCs read the sensors and drive the actuators, and a Raspberry Pi Panel PC with MQTT and Node-RED gives remote control and alerts.
A turnkey controller would have set the limits.
The customer wanted an open system with no limits on options.
The customer, in charge of managing a greenhouse, was looking for an open source solution to implement all the technical specifications he wanted. He chose Industrial Shields equipment for the cost savings, the easy wiring with screwless connectors and the possibility to program in several languages or with free tools such as the Arduino IDE.
The challenge
Control every space of the greenhouse remotely, and know when something goes out of range.
The greenhouse is made of several spaces. Each one needed remote control of humidity, CO2, temperature and lighting, plus a system to alert the customer when any variable is out of range.
Humidity
Relative humidity is measured at the climate station inside the greenhouse and acts on the fog or cooling systems.
Ventilation
Without proper ventilation, some areas would have different temperature and humidity, and the harvest would decrease.
CO2 level
CO2 application systems are controlled from the measurements of the CO2 content inside the greenhouse.
Light
Lights follow a time schedule and can also be set manually. Controlling the lighting avoids burns on plant leaves.
A base project to scale up
The customer started the project as a test, with the aim of defining the hardware and software that would later be scaled up to other installations he owns.
How it works
Automatic climate, scheduled light, one screen.
Each phase has its own control logic in an Arduino IDE sketch: the PLC reads the sensor, compares it with its range and decides on the actuators. Move the controls to see the logic of each one.
Fog, cooling and ventilation
The PLC reads humidity and temperature from the climate sensors and decides on the fog or cooling systems and on the ventilation, so all the areas of a space stay at the same conditions.
- Inputs: humidity and temperature sensors on the I2C bus
- Logic: ranges in the Arduino IDE sketch
- Outputs: pumps, valves and ventilation
Illustrative thresholds. The real set points of the installation are not published.
CO2 application from measurement
The CO2 content inside the greenhouse is measured and the PLC controls the CO2 application systems from that measurement.
- Input: CO2 level
- Logic: range in the PLC
- Output: CO2 application system
Illustrative thresholds. The real set points of the installation are not published.
Lights by schedule, with manual override
While humidity, CO2 and air are controlled automatically, the lights follow the time of day. They can also be set manually from the Panel PC.
- Input: time schedule
- Override: manual command from the dashboard
- Output: greenhouse lights
Illustrative thresholds. The real set points of the installation are not published.
System architecture
From the sensor bus to the dashboard.
The architecture of the installation, redrawn from the project description. Sensors on the left, the two PLCs in the middle, actuators on the right and the Panel PC on top.
| Signal | Direction | Type | Purpose |
|---|---|---|---|
| Climate sensors | Sensor → PLC | I2C bus with multiplexers | Humidity, temperature and CO2 of each space |
| Other sensors | Sensor → PLC | Digital and analog | Complete the measurement of the installation |
| Pumps and valves | PLC → actuator | PLC output | Fog, cooling and CO2 application |
| Ventilation | PLC → actuator | PLC output | Keeps temperature and humidity even |
| Lights | PLC → actuator | PLC output | Lighting by schedule or manual command |
| Process data | PLC → Panel PC | Ethernet · MQTT | Values of the two PLCs sent to the broker |
| Dashboard and alerts | Panel PC → user | Node-RED | Remote control and out of range alerts |
Why open hardware
Industrial hardware, open software.
No turnkey limits
An open source solution let the customer implement all the specifications he wanted, with unlimited options.
Easy to wire
Screwless connectors make the wiring of sensors and actuators faster.
Your choice of tools
The PLCs are programmed with the Arduino IDE and the dashboard with Node-RED, both free tools.
Hardware used
Two PLCs on the DIN rail, one Panel PC on the wall.
M-Duino Ethernet PLCs
Two Arduino based Ethernet PLCs of the M-Duino family read the sensors and run the control sketch of each phase.
- Role
- Sensor reading and actuator control
- Sensors
- I2C bus, digital and analog
- Programming
- Arduino IDE
- Link
- Ethernet to the Panel PC
The case does not publish the exact M-Duino model. The image shows the M-Duino Ethernet 21.
Panel PC with Raspberry Pi
An Industrial Shields Panel PC with a built-in Raspberry Pi hosts the MQTT broker and the Node-RED dashboard.
- Role
- Supervision and remote control
- Software
- MQTT broker, Node-RED
- Link
- Ethernet to both PLCs
Questions about this case
Which variables does the system control?
Humidity, CO2 level, temperature with the ventilation, and lighting in the different spaces of the greenhouse, with an alert when any of them is out of range.
How are the sensors connected?
The climate sensors are connected to the PLCs over an I2C bus, with I2C multiplexers to cover the whole installation. Digital and analog sensors are also used.
Why two PLCs?
The customer needed two Arduino based Ethernet PLCs to control the entire installation.
How does the data reach the Panel PC?
Over Ethernet. An MQTT broker on the Panel PC handles the requests, and Node-RED manages the communication between the PLCs and the Panel PC.
Are the lights automatic?
Humidity, CO2 and air are controlled automatically. The lights follow the time of day and can also be set manually.
Can the project be replicated?
Yes. It started as a test to define a hardware and software base that the customer could scale up to other installations.
Download the case study
4-page PDF with the challenge, the logic, the architecture and the hardware. No form required.
Similar project?
Tell us your crop and your variables. An engineer will answer.
Greenhouses, vertical farms or climate rooms: describe what you need to measure, control and supervise, and we will tell you which controllers fit.
- Answer from our technical team
- Hardware sizing for your I/O list
- Arduino, ESP32 or Raspberry Pi based PLCs