ARMAC Fire Defence System - Technical Notes Part C

Electronics and Control Systems

This section describes the electronic control systems that operate the ARMAC fire defence system.

Pump-shed electronic sub-system

The pump shed contains three main electronic modules:

  1. The Relay Module (AR2) - Controls all relays that operate valves and the pump
  2. The Autonomous Module (AR3) - Makes automated decisions based on sensor inputs
  3. The Pump Control Module - Commercial unit with LTE connectivity

Attach:armacc_image1.png Δ

The Relay Module

The Relay Module (AR2) is an Arduino Mega 2560 that controls all the relays in the system. It receives commands from either:

  • The Remote Control Module (AR1) in the house via RS485
  • The Autonomous Module (AR3) directly when in autonomous mode

Arduino AR2 Pin Assignments:

PinFunctionConnection
D2-D13Relay outputsTo relay board inputs
A0-A7Spare analog inputsReserved for expansion
TX1/RX1RS485 communicationTo house module AR1
TX2/RX2Inter-module commsTo autonomous module AR3

Attach:armacc_image2.png Δ

The Autonomous Module

The Autonomous Module (AR3) is an Arduino Mega 2560 that monitors sensors and makes automated decisions when:

  • Communication with the house is lost
  • Manual control is unavailable
  • Pre-programmed autonomous mode is activated
  • Sensor thresholds are exceeded

Attach:armacc_image3.png Δ

Arduino AR3 pin assignments

PinFunctionSensor/Device
A0External temperatureDS18B20 temperature sensor
A1Internal temperatureDS18B20 temperature sensor
A2Battery voltageVoltage divider circuit
A3Flow sensorHall effect flow meter
A4Tank levelUltrasonic distance sensor
A5Ember trap 1Thermal sensor
A6Ember trap 2Thermal sensor
A7Flame sensorIR flame detector (720nm)
D2Ember trap 3Digital input
D3Ember trap 4Digital input
D11TestSys indicatorReserved for test mode
TX2/RX2Inter-module commsTo relay module AR2

Attach:armacc_image4.png Δ

The Relay Module Details

The relay module controls:

Pump Control Relays (Hardware Interlocked):

  • Relay 1: Pump START (momentary)
  • Relay 2: Pump STOP (momentary)
  • These use Songe latching relays with hardware interlock

Valve Control Relays:

  • Relay 3: Low/High pressure 3-way motorised valve
  • Relay 4: Spray/Recirculation 3-way motorised valve
  • Relay 5: Shed cooling solenoid valve (NC)
  • Relay 6: Gel injection valve

Spare Relays:

  • Relays 7-12: Reserved for future expansion

Attach:armacc_image5.png Δ

Relays and the Arduino reset

A critical issue with Arduino-controlled relays is that when the Arduino resets (power-on or watchdog reset), all digital pins briefly go to their default state. This can cause unintended relay activation.

Solutions implemented:

  1. Hardware interlocks on pump START/STOP relays
  2. Pull-down resistors on all relay control lines
  3. Software initialization that sets safe states within 50ms of boot
  4. Watchdog timer to detect and recover from hangs

Attach:armacc_image6.png Δ

Logic Table for Hardware Interlocked Songe Latch Relays (Pump Control)

START SignalSTOP SignalPump StateNotes
LOWLOWMaintainedNo change
HIGHLOWSTARTINGPulse applied
LOWHIGHSTOPPINGPulse applied
HIGHHIGHBLOCKEDHardware interlock prevents

The hardware interlock uses diodes and resistors to ensure that if both START and STOP signals are accidentally HIGH simultaneously, neither relay activates. This prevents damage to the pump control module.

Attach:armacc_image7.png Δ

Key Hardware Behaviors

  1. Power-on Reset: Arduino pins default to INPUT (high impedance). Pull-down resistors ensure relays remain OFF during the ~50ms boot time.
  2. Watchdog Reset: If the program hangs, the watchdog timer triggers a reset. The system returns to a safe state.
  3. Communication Loss: If RS485 communication from the house is lost for > 30 seconds, the autonomous module takes over.
  4. Sensor Failure: If a critical sensor fails, the system uses fallback logic (see Sensor Failure Fallback section).

Relay setting programming notes

Key points from the relay control code:

  • All relay states are tracked in a state variable array
  • Changes to relay states are logged to SD card with timestamp
  • Before activating a valve relay, the code checks that sufficient time has elapsed since the last change (motorised valves need ~15 seconds to complete travel)
  • Pump START/STOP commands are momentary pulses (200ms)
  • Gel injection valve has a flow totalizer to prevent over-dosing

Example code structure:

void setRelay(int relayNum, boolean state) {
  if (relayState[relayNum] != state) {
    digitalWrite(relayPin[relayNum], state);
    relayState[relayNum] = state;
    logRelayChange(relayNum, state);
  }
}

Relay setting wiring notes

The relay board connections:

  • Power: 12V supply from battery via fuse
  • Control: Optoisolated inputs from Arduino pins
  • Outputs: Relay contacts rated 10A at 240VAC
  • LED indicators: Each relay has an LED showing state
  • Protection: Snubber diodes across inductive loads

Attach:armacc_image8.png Δ

Wiring color code:

  • Red: +12V power
  • Black: Ground
  • Yellow: Control signals from Arduino
  • Blue: Valve control outputs
  • Green: Pump control outputs

Tank Water Level Sensor installation

Attach:armacc_image9.png Δ

The tank water level sensor is an ultrasonic distance sensor (HC-SR04 style) mounted at the top of the tank. It measures the distance to the water surface and calculates the water level.

Specifications:

  • Range: 2cm to 400cm
  • Accuracy: ±3mm
  • Update rate: 1 reading per second
  • Power: 5V from Arduino
  • Output: Pulse width proportional to distance

Mounting:

  • Sensor mounted in weatherproof enclosure
  • Cable: 4-wire shielded cable
  • Entry: Through sealed gland in tank roof
  • Calibration: Zero level set at tank bottom

Attach:armacc_image10.png Δ

The sensor reading is converted to litres using:

litres = PI * (radius^2) * (tankHeight - measuredDistance)

where radius = 1.75m and tankHeight = 3.1m for our 30.3kL tank.

System response to Ember attack

When an ember trap is triggered, the autonomous module follows this logic:

  1. Immediate: Activate shed cooling (if not already on)
  2. Within 30 seconds: Start pump if not running
  3. Within 60 seconds: Switch to low volume spray mode
  4. Monitor: External temperature and rate of rise
  5. Adjust: Switch to high volume if temp > 65°C or rate > 10°C/min
  6. Cycle: Enter intermittent mode if no further ember detections for 10 minutes

Attach:armacc_image11.png Δ

Attach:armacc_image12.png Δ

Inter-Module Communication

Communication between the house module (AR1) and pump shed modules (AR2, AR3) uses RS485 serial protocol over a 2-wire twisted pair cable.

RS485 Advantages:

  • Differential signaling (immune to electrical noise)
  • Long distance capable (>100m, we use 10m)
  • Multiple devices on same bus
  • Robust in harsh environments

Attach:armacc_image13.png Δ

Protocol:

  • Baud rate: 9600 bps
  • Data format: 8N1 (8 data bits, no parity, 1 stop bit)
  • Message format: STX + Command + Data + Checksum + ETX
  • Timeout: 5 seconds
  • Retry: 3 attempts before failover to autonomous

Message Types:

CommandDirectionPurpose
PUMP_STARTHouse -> ShedStart the pump
PUMP_STOPHouse -> ShedStop the pump
SET_MODEHouse -> ShedChange spray mode
GET_STATUSHouse -> ShedRequest sensor readings
STATUS_DATAShed -> HouseSensor data response
EMERGENCYHouse -> ShedEmergency activation
HEARTBEATHouse <-> ShedCommunication check

Attach:armacc_image14.png Δ

The heartbeat message is sent every 10 seconds. If 3 consecutive heartbeats are missed, the system assumes communication failure and the autonomous module takes over.

Criteria for Automatic actions in the Autonomous mode

The autonomous module makes decisions based on a decision matrix:

ConditionPump ActionModeNotes
Ember trap triggeredSTARTLow volumeImmediate response
External temp > 65°CMaintain ONHigh volumeFire front approaching
Temp rise > 10°C/minMaintain ONHigh volumeRapid approach
Temp 45-65°CSTARTLow volumeModerate threat
Temp < 45°C, no embers 10minIntermittentRecirculationConserve water
Battery < 12.0VMaintain stateValve switch onlyPreserve battery
Tank < 2000LSTOPNoneProtect pump
Manual overrideAs commandedAs commandedDashboard takes priority

Attach:armacc_image15.png Δ

The autonomous module also implements hysteresis to prevent rapid switching:

  • Temperature must drop 5°C below threshold before downgrading mode
  • Ember trap must be clear for 10 minutes before reducing spray
  • Mode changes are rate-limited to once per 5 minutes

Sensor Failure Fallback

If sensors fail, the system uses these fallback strategies:

Failed SensorFallback Strategy
External temperatureUse internal temp + 20°C estimate
Internal temperatureAssume 50°C if pump running
Flow sensorUse mode-based flow estimate
Tank levelAssume 50% capacity
Battery voltageAssume 12.5V, disable pump cycling
All ember trapsRely on temperature sensors only
CameraContinue with other sensors

Attach:armacc_image16.png Δ

Multiple sensor failures trigger a warning message (if communication available) and the system defaults to a conservative strategy: low volume spray with recirculation cycling.

System Testing: The TestSys Module

A dedicated test system is implemented to verify correct operation without actually spraying water:

  1. Test Mode Activation: GPIO pin 11 on AR3 jumpered to ground
  2. LED Indicator: Shows system is in test mode
  3. Relay Monitoring: All relay commands logged but not executed
  4. Sensor Simulation: Can inject simulated sensor values
  5. Communication Test: Verifies RS485 links
  6. Valve Position: Displays intended positions without moving

Attach:armacc_image17.png Δ

Test scenarios include:

  • Ember trap activation sequence
  • Temperature rise simulation
  • Communication failure
  • Low battery response
  • Tank low level
  • Sensor failures

Voltage surge circuit protection

The electronics are protected against voltage surges using:

  1. TVS Diodes: Bidirectional transient voltage suppressors on all sensor inputs
  2. Varistors: Metal oxide varistors on power supply inputs
  3. Fuses: Inline fuses on all power feeds
  4. Optoisolators: Isolate Arduino outputs from relay coils
  5. Common mode chokes: On RS485 communication lines

Attach:armacc_image18.png Δ

These protections are essential because:

  • Pump starting creates voltage spikes
  • Solenoid valves generate back-EMF
  • Lightning strikes can induce voltages in long cables
  • The shed is partially a Faraday cage (can build up static)

Parallel circuit protection

Where multiple sensors or devices share power or signal lines, protection includes:

  1. Individual fuses: Each device has its own fuse
  2. Isolation diodes: Prevent one failed device affecting others
  3. Pull-up/pull-down resistors: Ensure defined states
  4. Bypass capacitors: Filter local noise

Attach:armacc_image19.png Δ

LCD DISPLAY in shed of key parameters in real time

A 20x4 character LCD display mounted in the pump shed shows real-time system status:

Line 1: Pump state, Mode, Battery voltage Line 2: External temp, Internal temp, Flow rate Line 3: Tank level (%), Ember traps status Line 4: Communication status, Autonomous/Manual mode

Example display:

PUMP:ON HI-V  12.8V
ExtT:58C In:42C 145L
Tank:67% Emb:-- -- 
WiFi:OK  MANUAL    

Attach:armacc_image20.png Δ

The display updates every 2 seconds and provides valuable local monitoring without needing to access the dashboard.

Protection against voltage surge and spikes

Additional protection measures beyond those already mentioned:

  1. Input filtering: RC low-pass filters on all analog inputs
  2. Ground plane: PCB with solid ground plane
  3. Star grounding: Single point ground for all electronics
  4. Shielded cables: For sensors exposed to electromagnetic interference
  5. Ferrite beads: On power and communication cables

Attach:armacc_image21.png Δ

Protection of electronic components from water spray incident

Although the pump shed is designed to be cooled by water spray, the electronics must be protected:

  1. Waterproof enclosures: IP65 rated boxes for all electronics
  2. Cable glands: Sealed entries for all cables
  3. Elevated mounting: Electronics mounted high in the shed
  4. Drainage: Enclosures have drain holes at bottom
  5. Desiccant packs: Inside enclosures to absorb moisture
  6. Conformal coating: PCBs coated with protective lacquer

Attach:armacc_image22.png Δ

The Arduino modules are in separate enclosures from the high-voltage relay boards to minimize risk.

Pump Control Module setup

The commercial pump control module (from pump supplier) includes:

  • LTE modem (G4) with SIM card
  • Relay outputs for remote START/STOP
  • SMS command interface
  • Input terminals for external control
  • Battery voltage monitoring
  • Run-time hour meter

Attach:armacc_image23.png Δ

Integration with our system:

  • Our relay module (AR2) connects to the external control terminals
  • Pump status is read back via a voltage sense line
  • SMS commands provide backup control if RS485 fails
  • Hour meter data is logged for maintenance scheduling

SMS Commands:

  • START - Starts the pump
  • STOP - Stops the pump
  • STATUS - Returns pump state, runtime, battery voltage

Electronically controlled Valves

The system uses two types of electronically controlled valves:

Motorised 3-way Valves (2 units):

  • Type: Ball valve with electric actuator
  • Power: 240VAC (via relay)
  • Travel time: 15 seconds
  • Positions: A-AB-B (3 positions)
  • Feedback: Limit switches at each end position
  • Used for: Low/High pressure, Spray/Recirculation

Solenoid Valves (1 unit):

  • Type: Normally Closed (NC)
  • Power: 12VDC (via relay)
  • Response time: <1 second
  • Used for: Shed cooling spray

Attach:armacc_image24.png Δ

The motorised valves have internal limit switches that cut power when the valve reaches the commanded position. This prevents overdriving the motor.

Sensors

The system employs multiple sensor types:

SensorTypeRangeAccuracy
External tempDS18B20-55 to 125°C±0.5°C
Internal tempDS18B20-55 to 125°C±0.5°C
Battery voltageResistor divider0-15V±0.1V
Flow rateHall effect1-100 L/min±2%
Tank levelUltrasonic0-4m±3mm
Ember trapThermistor0-300°C±5°C
FlameIR photodiode720nm1m range

All sensors are read by Arduino AR3 and the data is sent to AR1 for dashboard display and to AR2 for relay decision logic.

Motorised 3-way (and 2-way on/off) valves

The motorised valves are controlled by applying 240VAC to the motor for the duration needed to move the valve to the desired position.

Valve 1: Low/High Pressure

  • Position A: Low pressure (180 kPa) - bypass restrictor
  • Position B: High pressure (420 kPa) - through restrictor

Valve 2: Spray/Recirculation

  • Position A: Spray to sprinklers
  • Position B: Recirculate to tank

The Arduino tracks the current position and only activates the relay if a change is needed. Travel time is 15 seconds, so the code waits 20 seconds between commands to the same valve.

Switching the Valves using a single Songe 2-way relay

Each motorised valve requires reversing polarity to switch direction. This is accomplished using a DPDT relay configuration:

Relay OFF: Motor + to L, Motor - to N  (Position A)
Relay ON:  Motor + to N, Motor - to L  (Position B)

The limit switches in the valve cut power when the valve reaches the end of travel, so the relay can remain energized without damaging the motor.

Programming the microcomputers

All three Arduino modules (AR1, AR2, AR3) are programmed in C++ using the Arduino IDE. The programs include:

AR1 - Remote Control Module (House):

  • Blynk library for dashboard
  • RS485 communication library
  • Watchdog timer
  • ~1800 lines of code

AR2 - Relay Module (Shed):

  • Relay control functions
  • Inter-module communication
  • SD card logging
  • ~1300 lines of code

AR3 - Autonomous Module (Shed):

  • Sensor reading and filtering
  • Decision logic
  • Failover handling
  • ~2100 lines of code

Key libraries used:

  • OneWire and DallasTemperature (for DS18B20 sensors)
  • SoftwareSerial or HardwareSerial (for RS485)
  • SD (for logging)
  • Blynk (for AR1 dashboard)

Example sensor reading code:

// Read external temperature
sensors.requestTemperatures();
float extTemp = sensors.getTempCByIndex(0);

// Apply simple averaging filter
extTempFiltered = (extTempFiltered * 0.9) + (extTemp * 0.1);

Bench Testing the Programmes

Before installation, all programmes were extensively tested on a bench setup:

  1. Hardware simulation: Potentiometers to simulate sensors
  2. LED indicators: Show relay states without connecting valves
  3. Serial monitor: Display all variables and logic states
  4. Simulated inputs: Inject test conditions (high temp, low battery, etc.)
  5. Communication test: Two Arduinos connected via RS485

Test scenarios validated:

  • Normal operation sequences
  • Sensor failure detection
  • Communication loss and recovery
  • Autonomous mode activation
  • Battery low response
  • Emergency shutdown
  • Mode transitions

Only after passing all bench tests was the code deployed to the actual hardware in the shed.


Return to: Part A? | Part B | Main Index?


Page last modified on February 09, 2026, at 12:41 pm