Raspberry Pi 4 จะเป็น PLC ได้แค่ไหน? SLM-RP4 เพิ่ม Industrial I/O ได้ถึง 128 จุด
Raspberry Pi 4 รัน Linux, ต่อ Network และเขียน Python ได้อยู่แล้ว แต่พอจะเอาไปควบคุมเครื่องจักรจริง ปัญหาไม่ได้อยู่แค่ว่า CPU แรงพอไหม
หน้างาน Automation ต้องรับสัญญาณ 24 V, Relay, 0–10 V, 4–20 mA, Thermocouple และต้องมีวิธีจัดการ I/O ที่เป็นระบบกว่าการต่อ Jumper เข้ากับ GPIO
Synergy Logic SLM-RP4 จึงเอา Raspberry Pi 4 มาเป็น Compute Platform แล้วเพิ่ม 24 V Power, DIN Rail, Hardware Watchdog และ SPI-based Modular I/O Backplane ที่ต่อได้สูงสุด 8 Module หรือสูงสุด 128 I/O Points ตาม Configuration
- SLM-RP4 ใช้ Raspberry Pi 4 เป็น Compute Platform
- รับไฟหลัก 24 VDC และติดตั้งบน DIN Rail 35 mm
- SPI Backplane รองรับสูงสุด 8 SLM Modules
- Synergy Logic ระบุสูงสุด 128 I/O Points ตาม Module Configuration
- รองรับ Digital, Relay, Analog และ Thermocouple Modules
- มี OpenPLC Runtime และ Python/C++ Libraries ติดตั้งมาให้
- Backplane Scan ตั้งได้ 1–1000 ms แต่ไม่ได้หมายถึง I/O Response 1 ms ทุก Configuration
- OpenPLC กับ Python/C++ ห้ามเข้าถึง Backplane พร้อมกัน
Synergy Logic SLM-RP4 คืออะไร?
SLM-RP4 เป็น Industrial Controller ที่ใช้ Raspberry Pi 4 เป็นฐานประมวลผล และเพิ่ม Hardware รอบตัว เพื่อให้เหมาะกับ Automation, Machine Control, Data Acquisition และ IIoT มากขึ้น
| รายการ | ข้อมูลจาก Source |
|---|---|
| Compute | Raspberry Pi 4 Model B |
| RAM | 2 GB ตาม Main Source |
| Storage | 16 GB microSD ตาม Main Source |
| Main Power | 24 VDC Class 2, ±25% ตาม Main Source |
| Ethernet | Gigabit Ethernet |
| Wireless | Dual-band Wi-Fi 5 + Bluetooth 5.0/BLE |
| USB | 2 × USB 3.0 + 2 × USB 2.0 |
| Display | 2 × micro-HDMI |
| Mount | 35 mm DIN Rail |
| Cooling | Fanless / Convection |
| Weight | 289 g ตาม Main Source |
Raspberry Pi 4 กลายเป็น Industrial Controller ได้ยังไง?
Architecture แบบย่อ
Raspberry Pi OS
หรือ Python / C++
Backplane
I/O Modules
Raspberry Pi รับหน้าที่ด้าน Application และ PLC Logic ส่วน Base Controller / Backplane เชื่อม Software เข้ากับ Modular Industrial I/O
จุดต่างจากการใช้ Raspberry Pi แบบต่อ GPIO ตรง คือ SLM-RP4 มี I/O Module สำหรับ Signal Level ที่พบในงาน Automation จริง รวมถึง 24 V, Relay, Analog Voltage/Current และ Thermocouple
SPI Backplane คือหัวใจของระบบ
Base
Slot Address ถูกกำหนดจากตำแหน่งจริงบน Rail: Module ที่อยู่ติดกับ Base ทางขวา คือ Slot 1 แล้วไล่ไปจนถึง Slot 8
ไม่ควรถอดหรือเพิ่ม Module ขณะที่ระบบยังจ่ายไฟอยู่ ต้อง Shutdown และตัด 24 VDC ตาม Hardware Documentation ก่อนเปลี่ยน Module
8 Module กับ 128 I/O หมายถึงอะไร?
Synergy Logic ระบุว่า SLM-RP4 รองรับสูงสุด 8 Expansion Modules และสูงสุด 128 I/O Points
แต่ 128 Points ไม่ได้หมายความว่า ทุก Module Configuration จะมี 128 Channel เท่ากัน
หากใช้ Module 16 Channel หลายชุด จำนวน Point จะสูง ขณะที่ Analog หรือ Thermocouple Module มี Channel Count ต่างออกไป
มี I/O Module แบบไหนบ้าง?
Current Official Module Catalog ระบุ SLM Module ที่รองรับ จำนวน 18 Models
| กลุ่ม | ตัวอย่าง Capability |
|---|---|
| Discrete Input | 12–24 VDC, 24 VAC/VDC และ 100–240 VAC ตาม Module |
| Input Simulator | 8-channel Toggle Switch Module |
| Discrete Output | Sourcing / Sinking DC Output |
| Relay | 8-channel หรือ 16-channel Relay Module ตามรุ่น |
| Analog Input | 0–10 V หรือ 0–20 mA ตาม Module |
| Analog Output | 0–10 V หรือ 4–20 mA ตาม Module |
| Combined Analog I/O | Input และ Output รวมใน Module เดียวตามรุ่น |
| Thermocouple | รองรับ Thermocouple หลาย Type และ millivolt input ตาม Module |
Analog Input 13-bit / Output 12-bit ต่างกันยังไง?
| Analog Function | Resolution | Raw Range |
|---|---|---|
| Analog Input | 13-bit | 0–8191 |
| Analog Output | 12-bit | 0–4095 |
ใน OpenPLC Configuration ผู้ใช้สามารถทำงานกับ Raw Count หรือ Engineering Unit ตาม Module เช่น V, mA หรือ °C ได้
จุดนี้ทำให้ I/O Layer ต่างจากการอ่าน ADC บน Development Board ตรง ๆ เพราะ Module และ HAL จัดการ Mapping เข้าสู่ PLC Workflow ไว้ให้แล้ว
Thermocouple Burnout Detection มีไว้ทำอะไร?
Thermocouple Module รองรับ Sensor Type เช่น:
- J
- E
- K
- R
- S
- T
- B
- N
- C
Backplane Configuration ยังมี Burnout Detection สำหรับตรวจ Open-circuit Condition ของ Thermocouple
ถ้า Sensor ขาด PLC Logic ไม่ควรตีความค่าที่ผิด ว่าเป็นอุณหภูมิจริง การกำหนด Burnout Behaviour ช่วยให้ระบบจัดการ Fault ได้เป็นระเบียบขึ้น
OpenPLC เปลี่ยน Raspberry Pi ให้เขียน Ladder ได้ยังไง?
SLM-RP4 มาพร้อม OpenPLC Runtime และ Synergy Logic มี Hardware Support Package สำหรับ OpenPLC Editor
Official Documentation ระบุ OpenPLC Editor 4.3.1 หรือใหม่กว่า
Programming Language ที่ Documentation ระบุ ได้แก่:
- Ladder Diagram (LD)
- Structured Text (ST)
- Function Block Diagram (FBD)
- Instruction List (IL)
- Python Blocks
- C++ Blocks
เอกสารระบุ “4.3.1 or newer” ดังนั้นควรตรวจ Release ปัจจุบัน และ Compatibility ของ SLM-RP4 Support Package ก่อนเริ่ม Project
Backplane Configuration และ I/O Mapping
Configurator ช่วยกำหนด:
- Module ที่อยู่ในแต่ละ Slot
- IEC Address Mapping
- Analog Configuration
- Engineering Unit
- Backplane / HAL Settings
Configuration จึงต้องตรง กับ Module Stack ที่ติดตั้งจริง ไม่ใช่เลือก Module ใน Software โดยไม่สนตำแหน่งบน Rail
Bus Scan 1–1000 ms ไม่ใช่ PLC Task Time
HAL Settings ของ SLM-RP4 เปิดให้ตั้ง:
- Default Bus Scan Cycle: 10 ms
- Configurable Range: 1–1000 ms
สอง Timing ที่ต้องแยกออกจากกัน
Update I/O Image
Execute Logic
ถ้า PLC Logic รันทุก 5 ms แต่ Backplane Update ทุก 50 ms Logic สามารถ Execute หลายรอบ โดยยังอ่าน I/O Image ชุดเดิมอยู่
Minimum Cycle ที่ทำได้จริง ขึ้นกับจำนวนและประเภท Module หาก Scan ใช้เวลานานกว่าค่าที่ตั้ง อาจเกิด Cycle Overrun และ Bus Fault
Bus Fault และ Hardware Watchdog
HAL มี Bus Fault Detection เพื่อดู Consecutive Transfer Failure ใน Backplane
| Setting | Default ตาม Official Docs |
|---|---|
| Bus Fault Detection | Enabled |
| Fault Threshold | 10 consecutive cycles |
| Fault Action | Zero outputs and stop PLC |
Hardware Watchdog เป็นอีก Layer หนึ่ง: เมื่อ Program ไม่ Reset Timer ตามที่ควร Base Controller สามารถ Reset และ Drive Outputs เป็น Off/Zero โดยไม่ต้องพึ่ง Linux/Application Software
Watchdog และ Bus Fault Detection ไม่ใช่ Safety System
ทั้งสองช่วย Detect Software / Communication Failure บางประเภท แต่ไม่สามารถแทน Hardwired Safety Circuit, Emergency Stop หรือ Safety-rated Controller สำหรับ Hazardous Machinery ได้
Run/Stop Switch ไม่ใช่ Emergency Stop
Front Panel มี T/F Toggle Switch ซึ่ง OpenPLC สามารถใช้เป็น Run/Stop Input
แต่ Hardware Documentation อธิบายว่าจริง ๆ แล้ว Switch นี้เป็น General-purpose Input และความหมายของตำแหน่ง ขึ้นกับ Software ที่ใช้งาน
อย่าใช้ Toggle Switch นี้แทน E-stop
Emergency Stop ที่เกี่ยวข้องกับความปลอดภัย ควรออกแบบเป็น Hardwired Safety Function ตาม Requirement ของ Machine ไม่ควรพึ่ง Linux, PLC Runtime หรือ User Application เพียงอย่างเดียว
ใช้ OpenPLC หรือ Python/C++ ก็ได้ แต่ห้ามพร้อมกัน
SLM-RP4 มีสอง Programming Path หลัก:
OpenPLC
ใช้ IEC 61131-3 Logic และให้ Runtime ดูแล Backplane
Python
ใช้ synergy_logic
เพื่อ Access Backplane โดยตรง
C++
ใช้ Synergy
Library สำหรับ Direct Backplane Access
ทั้งสอง Path ใช้ Hardware ชุดเดียวกัน การรันพร้อมกันสามารถทำให้เกิด Bus Fault และ Invalid Reading ตาม Official Documentation
หากจะใช้ Python หรือ C++ กับ Backplane โดยตรง ต้อง Stop PLC หรือ Stop OpenPLC Runtime ก่อน
ลองอ่าน Module จาก Python
Official Python Quick Start ให้ตัวอย่างขั้นต่ำเพียง 3 บรรทัด สำหรับ Sign-on Backplane และแสดง Module ที่ตรวจพบ
เพื่อไม่ให้ Python และ OpenPLC เข้าถึง SPI Backplane พร้อมกัน
import synergy_logic
base = synergy_logic.Base()
base.print_modules()
FUXA เปลี่ยน Raspberry Pi PLC ให้มี Web HMI
Synergy Logic มี Official Integration Guide สำหรับ FUXA ซึ่งสามารถรันบน SLM-RP4 ตัวเดียวกันได้
OpenPLC + FUXA Flow
HMI Dashboard
HMI / SCADA
Runtime
I/O
ข้อดีคือไม่จำเป็นต้องมี HMI Panel แยก หรือ Cloud Service เพียงเพื่อแสดง Local Dashboard
Modbus TCP / HMI ต้องระวังอะไร?
FUXA และ Modbus TCP ใช้สำหรับเชื่อม HMI กับ Process Data ดังนั้น Network Exposure, Authentication, Writable Tags และ Firewall Policy ต้องถูกออกแบบให้เหมาะกับ Control System
ควรใช้กับ Hardware, Network และ System ที่ผู้ใช้เป็นเจ้าของหรือได้รับอนุญาตเท่านั้น และไม่ควรเปิด Control Interface ออก Internet โดยตรง เพียงเพื่อให้เข้าถึง Dashboard ได้ง่ายขึ้น
Writable Value จาก HMI ควรมี Validation ใน Control Logic แทนการเชื่อว่า Input จาก Dashboard จะอยู่ใน Safe Range เสมอ
24 V กับ USB-C ต่างกันอย่างไร?
| Power Input | หน้าที่ |
|---|---|
| 24 VDC Terminal | Main Power สำหรับ SLM-RP4 และ Backplane ตาม Hardware Architecture |
| USB-C 5 V / 3 A | Auxiliary Power สำหรับ Controller เท่านั้น ไม่ใช่ I/O Backplane |
หากใช้ Backplane และ Industrial I/O ต้องยึด Power Requirement จาก Official Hardware Documentation
microSD กับการตัด Power
SLM-RP4 รัน Raspberry Pi OS บน microSD ตาม Configuration ที่ Main Source ระบุ
หาก Linux Filesystem กำลังเขียนข้อมูล การตัด Power แบบไม่ Shutdown อาจทำให้ File หรือ Filesystem เสียหายได้
สำหรับการใช้งานจริง ควรวาง Shutdown / Power-loss Strategy ตาม Requirement ของระบบ และ Documentation ของผู้ผลิต
UL / CE ไม่ได้แปลว่าเป็น Safety PLC
Current Product Information และ Main Source ระบุข้อมูลด้านมาตรฐาน เช่น:
- UL 61010
- UL 61010-2-201 Listed
- CE Marking ตามข้อมูล Main Source
- EN 61131-2 และ EN 61010 ตามข้อมูล Main Source
แต่ Source ไม่ได้ระบุ SIL หรือ PL Rating
จึงไม่ควรเรียก SLM-RP4 ว่า Safety PLC, SIL-rated PLC หรือ Hard Real-time Safety Controller หากไม่มี Certification รองรับ Claim นั้น
Source ยังไม่ได้ให้ Deterministic Jitter Benchmark หรือ Hard Real-time Guarantee สำหรับ Raspberry Pi OS + OpenPLC Stack
SLM-RP4 เหมาะกับงานอะไร?
Machine Control
PLC Logic ร่วมกับ Modular Digital, Relay และ Analog I/O
Data Acquisition
อ่าน Analog, Temperature และ Process Signal แล้วประมวลผลบน Linux
IIoT Gateway
ใช้ Raspberry Pi OS เชื่อม Process Data กับ Network Application
Local HMI
ใช้ FUXA สร้าง Dashboard ที่เปิดผ่าน Browser
Python Automation
เขียน Custom Application ผ่าน Python โดยใช้ Direct Backplane Library
Hybrid PLC + Linux
ใช้ PLC Logic ร่วมกับ Ecosystem ของ Raspberry Pi OS ตาม Architecture ที่เหมาะสม
ดู Raspberry Pi PLC + Modbus I/O ทำงานจริง
Synergy Logic Modbus TCP I/O and Raspberry Pi PLC
สิ่งที่ Source ไม่ได้ระบุ
| ข้อมูล | สถานะ |
|---|---|
| Hard Real-time Jitter | Source ไม่ได้ให้ Benchmark |
| SIL Rating | Source ไม่ได้ระบุ |
| Performance Level (PL) | Source ไม่ได้ระบุ |
| Safety PLC Certification | Source ไม่ได้ระบุ |
| Guaranteed I/O Response 1 ms | ไม่มี Guarantee; Minimum Scan ขึ้นกับ Module Stack |
| Maximum Combined Backplane Current | บทความหลักที่ใช้ไม่ได้ให้ค่าครบสำหรับคำนวณเอง |
| Power-fail UPS Runtime | Source ไม่ได้ระบุ |
| Deterministic Network Latency ของ FUXA/Modbus | Source ไม่ได้ระบุ |
Documentation และ Resource
FAQ: SLM-RP4 Raspberry Pi PLC
1. SLM-RP4 ใช้ Raspberry Pi รุ่นไหน?
Main Source ระบุ Raspberry Pi 4 Model B พร้อม RAM 2 GB
2. ต่อ I/O Module ได้กี่ตัว?
สูงสุด 8 SLM Modules ทางด้านขวาของ Base Controller
3. 128 I/O Points ได้ทุก Configuration หรือไม่?
ไม่ จำนวน Point จริง ขึ้นกับประเภทและ Channel Count ของ Module ที่เลือก
4. Module Hot Swap ได้หรือไม่?
ไม่ Official Documentation ระบุว่า Backplane ไม่รองรับ Hot Swap
5. รองรับ OpenPLC หรือไม่?
รองรับ และ SLM-RP4 มาพร้อม OpenPLC Runtime
6. ใช้ OpenPLC Editor เวอร์ชันไหน?
Official Documentation ระบุ 4.3.1 หรือใหม่กว่า
7. เขียน Ladder Diagram ได้หรือไม่?
ได้ OpenPLC รองรับ Ladder Diagram พร้อมภาษา IEC 61131-3 อื่นที่ Documentation ระบุ
8. ใช้ Python แทน OpenPLC ได้หรือไม่?
ได้ โดยใช้
synergy_logic
สำหรับ Direct Backplane Access
9. เปิด OpenPLC และ Python คุม I/O พร้อมกันได้หรือไม่?
ไม่ Official Documentation ระบุว่าทั้งสองใช้ Hardware เดียวกัน และการใช้พร้อมกันอาจทำให้เกิด Bus Fault หรือ Invalid Reading
10. Backplane Scan เร็วสุด 1 ms ใช่หรือไม่?
HAL เปิดให้ตั้ง Range 1–1000 ms แต่ Minimum Cycle ที่ใช้งานได้จริง ขึ้นกับจำนวนและชนิด Module จึงไม่ใช่ Guarantee ว่าทุก Stack ทำงานได้ที่ 1 ms
11. Bus Scan กับ PLC Task Interval เหมือนกันหรือไม่?
ไม่ Bus Scan ใช้อัปเดต I/O Image ส่วน PLC Task Interval คือรอบที่ Logic Execute
12. มี Hardware Watchdog หรือไม่?
มี และ Official Docs ระบุว่า เมื่อ Watchdog Timeout Base Controller สามารถ Reset และ Drive Outputs เป็น Off/Zero
13. Toggle Switch ด้านหน้าเป็น Emergency Stop หรือไม่?
ไม่ เป็น General-purpose Input ที่ OpenPLC สามารถใช้เป็น Run/Stop แต่ไม่ใช่ Safety-rated E-stop
14. ทำ Web HMI ได้หรือไม่?
ได้ Synergy Logic มี Official Integration Guide สำหรับ FUXA ซึ่งสามารถรันบน SLM-RP4 เองได้
15. FUXA เชื่อม OpenPLC ยังไง?
ใช้ Modbus TCP ระหว่าง FUXA กับ Modbus Server ของ OpenPLC Runtime หรือ Custom Application
16. ใช้ USB-C จ่ายไฟให้ I/O Modules ได้หรือไม่?
ไม่ Main Source ระบุว่า 5 V / 3 A USB-C เป็น Auxiliary Power สำหรับ Controller ไม่ใช่ Backplane I/O Stack
17. SLM-RP4 เป็น Safety PLC หรือไม่?
Source ไม่ได้ระบุ SIL, PL หรือ Safety PLC Certification จึงไม่ควรเรียกว่า Safety PLC
18. ตัด 24 V ได้ทันทีเหมือน PLC ทั่วไปหรือไม่?
ระบบรัน Raspberry Pi OS บน microSD และ Official Docs เตือนเรื่อง Filesystem Corruption หากตัด Power ระหว่างการเขียนข้อมูล จึงควรใช้ Clean Shutdown / Power Strategy ที่เหมาะกับระบบ
สิ่งที่ทำให้ SLM-RP4 น่าสนใจไม่ใช่แค่มี Raspberry Pi อยู่ข้างใน
Raspberry Pi 4 ให้ Linux, Network, Python/C++ และ Ecosystem ที่ Developer คุ้นเคย
แต่สิ่งที่ทำให้ SLM-RP4 เปลี่ยนจาก SBC ไปเป็น Industrial Controller Platform คือ Backplane, 24 V Architecture, Modular I/O, HAL, Fault Detection, Watchdog และ OpenPLC Integration
Developer จึงเลือกได้ว่า จะทำงานแบบ PLC ผ่าน Ladder / Structured Text หรือใช้ Python/C++ สร้าง Application ที่เชื่อม Data Processing, Network และ Industrial I/O เข้าด้วยกัน
แต่ความยืดหยุ่นนี้ มาพร้อมข้อจำกัดที่ต้องเข้าใจ: Bus Scan ไม่ใช่ Hard Real-time Guarantee, Module ไม่ Hot-swap, OpenPLC กับ Direct Library ห้ามจับ Backplane พร้อมกัน และ Software Watchdog / Run-Stop Switch ไม่สามารถแทน Hardwired Safety System ได้
โปรเจกต์นี้มีหลายส่วน แนะนำอ่านต้นฉบับควบคู่กัน
References / แหล่งข้อมูลต้นฉบับ
- CNX Software — Synergy Logic SLM-RP4
- Synergy Logic — SLM-RP4 Product Page
- Synergy Logic — SLM-RP4 Documentation
- Synergy Logic — Backplane and Modules
- Synergy Logic — Module Catalog
- Synergy Logic — HAL Settings
- Synergy Logic — Shared Hardware Rules
- Synergy Logic — Python Quick Start
- Synergy Logic — FUXA Local HMI
- YouTube — Synergy Logic Modbus TCP I/O and Raspberry Pi PLC
กำลังทำ Raspberry Pi, PLC, IIoT หรือ Automation Project?
SLM-RP4 เป็นตัวอย่างที่ดี ของการนำ Raspberry Pi ไปเชื่อมกับ Industrial I/O, PLC Runtime, HMI และ Network Application ในระบบเดียว
หากกำลังเลือก Raspberry Pi, Development Board, Sensor, Module หรืออุปกรณ์สำหรับ Automation Project สามารถสอบถามทีม GlobalByte เรื่องบอร์ดหรืออุปกรณ์ ที่เหมาะกับ Requirement ได้