Arduino-based relay actuation: Difference between revisions
No edit summary |
No edit summary |
||
| Line 13: | Line 13: | ||
|} | |} | ||
The | The software provided as part of this project enables the device to act as fail-safe relay actuator. | ||
The Controllino operates as a "slave" device, receiving commands from the main control (running on Raspberry Pi via USB/Serial) and managing high-and low voltage physical devices like pumps, skimmer, heating, ventilation and feeder. | |||
== Communication Protocol == | |||
The device communicates via a serial USB connection using a custom, fixed-length message protocol. | The device communicates with the main control via a serial USB connection using a custom, fixed-length message protocol. | ||
Message Structure: Every command consists of a fixed packet size (8 bytes). | Message Structure: Every command consists of a fixed packet size (8 bytes). | ||
Data Integrity: The | Data Integrity: The software performs a checksum validation. | ||
It calculates a logical "signature" for incoming data to ensure the message wasn't corrupted during transmission. | |||
If a message is corrupt, the device rejects it and returns an error code; otherwise, it executes the command. | |||
Feedback: The device sends confirmation messages back to the controller, including current status data or error flags if a command is unrecognized. | Feedback: The device sends confirmation messages back to the controller, including current status data or error flags if a command is unrecognized. | ||
== Core control functionality == | |||
The | The software allows the main control to manipulate the hardware in several ways: | ||
Relay Switching: Direct commands to turn specific relays ON (Set) or OFF (Unset). | Relay Switching: Direct commands to turn specific relays ON (Set) or OFF (Unset). | ||
Status Reporting: The device can query the internal state of all 16 relays and return a bitmap indicating exactly which devices are currently running. | Status Reporting: The device can query the internal state of all 16 relays and return a bitmap indicating exactly which devices are currently running. | ||
== Safety functionality === | |||
The software implements three safety functions. | |||
=== "Dead Man's Switch" (Silence Watchdog) === | |||
The | The software monitors the connection with the main control. | ||
Heartbeat Monitoring: It expects regular valid messages (heartbeats or commands). | Heartbeat Monitoring: It expects regular valid messages (heartbeats or commands). | ||
If the device detects "silence" (no valid messages received) for a specific threshold (set to 3 minutes), it assumes the master controller has crashed or disconnected. | |||
Safe State: Upon triggering, the device immediately resets all relays to a default "OFF" state to prevent equipment from running indefinitely without supervision. | Safe State: Upon triggering, the device immediately resets all relays to a default "OFF" state to prevent equipment from running indefinitely without supervision. | ||
=== Run-Time Limiters (Runaway Prevention) === | |||
To prevent specific critical equipment from getting stuck in the "ON" state, the code tracks how long relays have been active. | To prevent specific critical equipment from getting stuck in the "ON" state, the code tracks how long relays have been active. | ||
Targeted Monitoring: Two specific relays (designated for the | Targeted Monitoring: Two specific relays (designated for the refill pump and the feeder) are monitored. | ||
Automatic Cut-off: If either of these devices remains ON for longer than a hard-coded safety limit (1 minute), the firmware overrides the command and forces them OFF. This prevents a stuck command from | Automatic Cut-off: If either of these devices remains ON for longer than a hard-coded safety limit (1 minute), the firmware overrides the command and forces them OFF. This prevents a stuck command from overflowing the main tank or dumping too much food. | ||
=== Soft-Start initialisation === | |||
When the device powers up or resets: | When the device powers up or resets: | ||
Revision as of 17:05, 31 December 2025
Using an additional device, the aquarium control can actuate a set of relays.
One such device is the Controllino from Boot & Work Corp, S.L..
According to their website, the Controllino is an industry-grade PLC based on open source software. It is not affiliated to Arduino and is a derivative product. Tech support for Controllino needs to be directed to the above mentioned manufacturer.
|
Note: This project is NOT affiliated with neither Controllino nor Arduino. |
The software provided as part of this project enables the device to act as fail-safe relay actuator. The Controllino operates as a "slave" device, receiving commands from the main control (running on Raspberry Pi via USB/Serial) and managing high-and low voltage physical devices like pumps, skimmer, heating, ventilation and feeder.
Communication Protocol
The device communicates with the main control via a serial USB connection using a custom, fixed-length message protocol.
Message Structure: Every command consists of a fixed packet size (8 bytes).
Data Integrity: The software performs a checksum validation. It calculates a logical "signature" for incoming data to ensure the message wasn't corrupted during transmission.
If a message is corrupt, the device rejects it and returns an error code; otherwise, it executes the command.
Feedback: The device sends confirmation messages back to the controller, including current status data or error flags if a command is unrecognized.
Core control functionality
The software allows the main control to manipulate the hardware in several ways:
Relay Switching: Direct commands to turn specific relays ON (Set) or OFF (Unset).
Status Reporting: The device can query the internal state of all 16 relays and return a bitmap indicating exactly which devices are currently running.
Safety functionality =
The software implements three safety functions.
"Dead Man's Switch" (Silence Watchdog)
The software monitors the connection with the main control.
Heartbeat Monitoring: It expects regular valid messages (heartbeats or commands).
If the device detects "silence" (no valid messages received) for a specific threshold (set to 3 minutes), it assumes the master controller has crashed or disconnected.
Safe State: Upon triggering, the device immediately resets all relays to a default "OFF" state to prevent equipment from running indefinitely without supervision.
Run-Time Limiters (Runaway Prevention)
To prevent specific critical equipment from getting stuck in the "ON" state, the code tracks how long relays have been active.
Targeted Monitoring: Two specific relays (designated for the refill pump and the feeder) are monitored.
Automatic Cut-off: If either of these devices remains ON for longer than a hard-coded safety limit (1 minute), the firmware overrides the command and forces them OFF. This prevents a stuck command from overflowing the main tank or dumping too much food.
Soft-Start initialisation
When the device powers up or resets:
It ensures all relays start in the OFF state.
It initializes the pins sequentially with a slight delay between each. This prevents a sudden power surge (inrush current) that might occur if all electrical devices were turned on simultaneously.