The Secret Date Between PLC and Arduino: How Two Platforms Collaborate for Home Automation
Hello everyone, I am Lao Liu, a veteran in the industrial control industry. Today, let’s discuss an interesting topic: how to combine industrial-grade PLCs with DIY Arduino to create some home automation gadgets.
This all started with my balcony vegetable growing system that I modified last year. At that time, I had a small, idle PLC (Siemens LOGO!) and a few Arduino boards. Using just the PLC would be a waste; using only Arduino would not be stable enough. So I thought, can these two “date”?
Why Let Them “Date”?
First, let’s talk about their respective advantages and disadvantages:
Advantages of PLC:
- Super stable, can run continuously for years without issues
- Strong anti-interference capability, resistant to electromagnetic waves and voltage fluctuations
- Industrial-grade input and output interfaces, safe and reliable
Advantages of Arduino:
- Cheap, a board costs only a few dozen yuan
- Various sensor modules are complete and inexpensive
- Networking and Bluetooth are easy to implement
- Open-source code, with plenty of tutorials available online
I thought: if we could combine the stability of PLC with the flexibility of Arduino, wouldn’t that be the best of both worlds?
How to Make Them “Hold Hands”?
Communication is key! I used the simplest method: connect the digital output of Arduino to the digital input of PLC, and connect the output of PLC to the input of Arduino.
Wiring Diagram:
Arduino D2 ----> PLC I0.0 (Arduino sends commands to PLC)
Arduino D3 ----> PLC I0.1
PLC Q0.0 ----> Arduino A0 (PLC sends status back to Arduino)
PLC Q0.1 ----> Arduino A1
Common Ground GND -----> GND
A Simple Collaboration Example
My balcony vegetable growing system works like this:
- Arduino is connected to a DHT22 temperature and humidity sensor, a light sensor, and a WiFi module, responsible for monitoring the environment and providing remote control via mobile phone
- PLC controls the water pump, fan, and supplementary light, responsible for precise timing and stable control
Arduino Code Snippet:
// When the temperature exceeds 30 degrees
if (temperature > 30) {
digitalWrite(2, HIGH); // Send signal to PLC to turn on the fan
}
else {
digitalWrite(2, LOW); // Send signal to PLC to turn off the fan
}
// Read PLC status feedback
int pumpStatus = analogRead(A0);
if (pumpStatus > 500) { // Water pump is working
sendToApp("The water pump has started, watering");
}
PLC Ladder Logic:
// Receive signal from Arduino to turn on the fan
|--[I0.0]--|---(Q0.0 Fan)---|
// Watering at a scheduled time every day
|--[Timer 8:00AM]--|---(Q0.1 Water Pump)---|---(Q0.2 Feedback to Arduino)---|
How is the Actual Effect?
To be honest, this “mixed” system has been running stably for over a year. Arduino acts as the “eyes” and “mouth” (sensing and communication), while PLC acts as the “hands and feet” (precise control). I can see the condition of my vegetable garden at home using my phone while lying in the office, and I can also remotely adjust the irrigation schedule.
The best part is that this system is quite cost-effective—rather than using an expensive industrial control screen, I achieved visualization with Arduino and a mobile app; and I don’t have to worry about stability issues like in a pure Arduino solution.
Some Tips for Friends Who Want to Try
- Make sure to do proper opto-isolation for signal interconnection to protect both devices
- The protocol should be simple; using high and low levels or pulse signals is the most reliable
- Test communication on a breadboard before formal installation
- PLC should handle core control, while Arduino should manage peripheral functions; do not reverse the roles
Alright, that’s all for now. Friends who are interested can try this “cross-border date”; it’s actually quite fun! Next time, I will share some other DIY insights.