Control System Integration Using the Digital I/O Pins
The SMART Controller features a block of assignable, Digital I/O (DIO) pins. You can control these pins with a simple script to signal the states of up to four alarms in response to detected bat activity.

The DIO pins are located on the same face of the SMART Controller as the four USB ports. The SMART Controller ships with a 10-pin connector block with screw terminals you can use to make connections to these pins.
Digital I/O Pin Configuration
The DIO block consists of four input pins, four output pins, a ground pin, and a power input pin. Because these pins are optically isolated from the rest of the SMART Controller's motherboard, you must supply 9-36 V DC power to Pin 1, separate from the SMART Controller's main power supply.

| Pin Number | Function |
|---|---|
| 1 | Power In (9-36 V DC) |
| 2 | Out 1 |
| 3 | Out 2 |
| 4 | Out 3 |
| 5 | Out 4 |
| 6 | In 1 |
| 7 | In 2 |
| 8 | In 3 |
| 9 | In 4 |
| 10 | Ground |
The four output pins, pins 2-5, can be used to signal the states of up to four alarms to an external SCADA interface.
Bat Activity Alarm Hook Script
Any time an alarm raises or lowers, the SMART System will execute a "hook" script if one exists with the file path /var/www/storage/smart-scada-hook.sh. You can use this script to perform any task, you would like, such as sending an email or updating a log file. It can also be used to set the state of the four DIO output pins.
The script smart-scada-hook.sh is invoked by the smart-scada service with the following arguments, in order:
- $1 - Alarm number
- Integer between 1 and 8.
- $2 - Alarm type
- String with the value "pass" or "pulse".
- $3 - Alarm status
- 1 for active, 0 for inactive.
Example: Using a Hook Script to Signal Alarms via the DIO Pins
In this example, the script assigns the states of four alarms to the four DIO output pins:
| Alarm | Pin Number | Output Number |
|---|---|---|
| Pulse Alarm 1 | Pin 2 | Out 1 |
| Pulse Alarm 2 | Pin 3 | Out 2 |
| Pass Alarm 1 | Pin 4 | Out 3 |
| Pass Alarm 2 | Pin 5 | Out 4 |
#!/bin/bash
#
# smart-scada-hook.sh
#
#
# On Karbon 300, we have 4 DIO outputs OUT1, OUT2, OUT3, and OUT4.
# We make the following mappings here:
#
# Pulse Alarm #1: OUT1
# Pulse Alarm #2: OUT2
# Pass Alarm #3: OUT3
# Pass Alarm #4: OUT4
#
ALARM="$1"
TYPE="$2"
STATUS="$3"
if [[ $ALARM == "1" && $TYPE == "pulse" ]]
then
/usr/local/bin/karbon-300-controller set-do $STATUS"---"
elif [[ $ALARM == "2" && $TYPE == "pulse" ]]
then
/usr/local/bin/karbon-300-controller set-do "-"$STATUS"--"
elif [[ $ALARM == "3" && $TYPE == "pass" ]]
then
/usr/local/bin/karbon-300-controller set-do "--"$STATUS"-"
elif [[ $ALARM == "4" && $TYPE == "pass" ]]
then
/usr/local/bin/karbon-300-controller set-do "---"$STATUS
fi
