Arduino-based relay actuation: Difference between revisions

From Aquarium-Control
Jump to navigation Jump to search
(Created page with "Using an additional device, the aquarium control can actuate a set of relays. According to their website, <ref>The CONTROLLINO is an industry-grade PLC based on open source software.</ref>")
 
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Using an additional device, the aquarium control can actuate a set of relays.
Using an additional device, the aquarium control can actuate a set of relays.


According to their website, <ref>The CONTROLLINO is an industry-grade PLC based on open source software.</ref>
One such device is the [https://www.controllino.com 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.
 
 
{| style="width: 100%; border: 1px solid #aaa; background-color: #f9f9f9; padding: 5px;"
|
'''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 outputs ON (Set) or OFF (Unset).
 
Note: The logic if an output of the Controllino switches on or off a device depends on the design of the control cabinet: If further relays are used in combination with the internal relays of the Controllino.
 
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 outputs 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.

Latest revision as of 17:14, 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 outputs ON (Set) or OFF (Unset).

Note: The logic if an output of the Controllino switches on or off a device depends on the design of the control cabinet: If further relays are used in combination with the internal relays of the Controllino.

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 outputs 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.