Skip to Content

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.

4variables controlled: humidity, CO2, temperature, light
2 PLCsArduino based Ethernet PLCs read sensors and drive actuators
I2Cbus with multiplexers for the climate sensors
MQTTbroker and Node-RED dashboard on a Raspberry Pi Panel PC

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.

01

Humidity

Relative humidity is measured at the climate station inside the greenhouse and acts on the fog or cooling systems.

02

Ventilation

Without proper ventilation, some areas would have different temperature and humidity, and the harvest would decrease.

03

CO2 level

CO2 application systems are controlled from the measurements of the CO2 content inside the greenhouse.

04

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.

Loop 1 · Humidity and temperature

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
Fog / coolingVentilation
70 %RH
24 °C
Out of range alert

Illustrative thresholds. The real set points of the installation are not published.

Loop 2 · CO2

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
CO2 application
800 ppm
Out of range alert

Illustrative thresholds. The real set points of the installation are not published.

Loop 3 · Light

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
00:0024:00Lights
12:00

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.

Greenhouse automation with two Arduino based PLCs and a Raspberry Pi Panel PCSUPERVISIONPanel PC (Raspberry Pi)MQTT broker · Node-RED dashboardalertsSENSORSClimate sensorshumidity · temperature · CO2I2C multiplexersDigital and analog sensorsPLC 1M-DuinoPLC 2M-DuinoArduino IDE sketchI2C busEthernet · MQTTACTUATORSPumps and valvesfog · cooling · CO2VentilationLightsschedule or manualoutputsSUPERVISIONPanel PC (Raspberry Pi)MQTT broker · Node-RED dashboardEthernet · MQTTPLC 1M-DuinoPLC 2M-DuinoArduino IDE sketchSENSORSACTUATORSClimate sensorsI2C busI2C multiplexersDigital and analog sensorsPumps and valvesVentilationLightsschedule or manual
Sensor inputEthernet · MQTTActuator output
Signal list
SignalDirectionTypePurpose
Climate sensorsSensor → PLCI2C bus with multiplexersHumidity, temperature and CO2 of each space
Other sensorsSensor → PLCDigital and analogComplete the measurement of the installation
Pumps and valvesPLC → actuatorPLC outputFog, cooling and CO2 application
VentilationPLC → actuatorPLC outputKeeps temperature and humidity even
LightsPLC → actuatorPLC outputLighting by schedule or manual command
Process dataPLC → Panel PCEthernet · MQTTValues of the two PLCs sent to the broker
Dashboard and alertsPanel PC → userNode-REDRemote 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 PLC based on Arduino

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.

TouchBerry Pi Panel PC 10.1 with Raspberry Pi

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