Home Automation Card for Raspberry Pi
User's Guide Version 3.0
General Description
The Home Automation Card is a stackable expansion card designed for the Raspberry Pi. It is compatible with all Raspberry Pi versions from Zero to 4, providing a comprehensive solution for home automation projects. The card features analog inputs for reading temperatures in up to 8 zones, 8 onboard relays for controlling heating, cooling, sprinklers, or high-voltage appliances, and 8 optically isolated digital inputs suitable for security systems. It also includes a hardware watchdog timer to ensure system recovery from software hangs by monitoring and power cycling the Raspberry Pi. Additionally, it offers four PWM open-drain outputs for controlling light systems (requiring external power up to 24V) and four 0-10V outputs for controlling light dimmers.
Image Description: A photograph shows the Home Automation Card mounted on a Raspberry Pi. The card is green with numerous blue relay modules, each with a status LED. It features multiple rows of green screw terminals for connecting external wires. The card has a stackable design, indicated by headers on top.
Features
- Eight relays with status LEDs and pluggable connectors
- Eight-layer stackable design
- Eight 12-bit Analog-to-Digital (A/D) inputs
- Four 13-bit Digital-to-Analog (DAC) outputs (0-10V dimmers)
- Four PWM 24V/4A open-drain outputs
- Eight optically isolated digital inputs
- Contact closure/Event counters up to 100 Hz
- Four Quadrature Encoder inputs
- 30 General Purpose Input/Output (GPIO) pins (26 from Raspberry Pi + 4 new)
- Pluggable connectors supporting 26-16 AWG wire
- On-board hardware watchdog timer
- On-board resettable fuse
- Reverse power supply protection
- 32-bit STM processor running at 48MHz
- Command-line interface
- Python Library support
- Node-Red Nodes
- Domoticz Plugin
- OpenPLC example integration
- Firmware Update capability
- Includes all mounting hardware: brass stand-offs, screws, and nuts
- Hardware self-test with loop-back cable
- Open source hardware and schematics
Up to eight Home Automation Cards can be stacked on top of a single Raspberry Pi. Each card is equipped with a 32-bit STM processor running at 48MHz. The cards communicate via a serial I2C bus, utilizing only two of the Raspberry Pi's GPIO pins, leaving the remaining 24 GPIOs available for the user. The DAC outputs can control 0-10V dimmers using the on-board 12V power supply. The Open Drain Outputs can control analog or digital loads up to 24V and 4A.
What is in Your Kit
- Home Automation Card for Raspberry Pi
- Mounting hardware, including:
- Nine 5-pin 3.5mm pitch connector plugs for relays and I/O's
- One 2-pin 3.5mm pitch connector plug for power
- Four M2.5x18mm male-female brass standoffs
- Four M2.5x5mm brass screws
- Four M2.5 brass nuts
- Two jumpers for the stack level
Image Description: Two images are shown. The first is of the Home Automation Card itself. The second image displays the mounting hardware: several brass standoffs, screws, nuts, and two small plastic jumpers. It also shows multiple green screw terminal connector plugs of different pin counts.
Quick Start-Up Guide
- Plug the Home Automation Card onto your Raspberry Pi and power up the system.
- Enable I2C communication on your Raspberry Pi using the `raspi-config` tool.
- Install the software from GitHub:
- Navigate to your desired directory and run:
~$ git clone https://github.com/SequentMicrosystems/ioplus-rpi.git
- Change directory into the cloned repository:
~$ cd /home/pi/ioplus-rpi
- Install the software:
~/ioplus-rpi$ sudo make install
- Navigate to your desired directory and run:
- Run the main program:
~/ioplus-rpi$ ioplus
The program will respond with a list of available commands. Type `iopls -h` for online help.
Board Layout
The Home Automation Card is designed for easy connection and identification of its various functions. Up to eight cards can be stacked on a single Raspberry Pi. Eight LEDs, labeled R1 through R8, indicate the status of their corresponding relays; an LED illuminates when its relay is energized.
Diagram Description: A top-down view of the Home Automation Card illustrates the placement of components and connectors. Key areas are labeled: Raspberry Pi 3 GPIO Header, Push Button, GPIO (for N-O Relays and Opto-Inputs), N-O Relays (Relay-1 through Relay-8), Stack Level Jumpers, 0-3.3V Analog Inputs (AD1-AD8), PWR, 0-10V Outputs (DA1-DA4), and Open Drain Outputs (OD1-OD4). The diagram also shows the pinouts for each section, including GND, +5V, and 3.3V connections.
Stack Level Jumpers
The Home Automation Card is controlled via the I2C interface, occupying the address space 0x28 - 0x2F. The local address for each card in a stack can be configured using Stack Level Jumpers. Two jumpers are provided for convenience, and a maximum stack of eight cards requires a total of 12 jumpers. The 3-position jumper located in the middle of the card selects the stack level, ranging from 0 to 7.
Diagram Description: A visual representation shows a 3-position jumper block labeled 'ID JUMPER' with positions 'ID2', 'ID1', and 'ID0'. Below this, a table or series of indicators shows how placing the jumper in different positions corresponds to a 'STACK LEVEL' from 0 to 7. For example, with all jumpers in the '0' position, the stack level is 0; with the 'ID1' jumper in the '1' position and others in '0', the stack level is 1, and so on.
Power Requirements
The Home Automation Card requires a +5V power supply, which can be provided either through the Raspberry Pi's expansion bus or via its dedicated power connector. The onboard relays are powered by this +5V supply, while a local 3.3V regulator powers the rest of the card's circuits.
- Raspberry Pi current consumption: 250 mA @ +5V (can be as high as 2A)
- Home Automation current consumption: 50 mA @ +5V (all relays OFF), 750 mA @ +5V (all relays ON)
The power connector supports up to 8A and is protected by a 3A resettable fuse. It is recommended to use a 5V regulated power supply rated at 4A or higher. The power connector includes reverse polarity protection; incorrect connection will prevent operation but will not damage the board.
The card supports stacking up to eight levels. In a multi-stack configuration, power can be supplied from any card. An eight-card stack requires approximately 400 mA for its electronic circuits, leaving 2.5A available for the relays. It is estimated that no more than 24 relays can be activated simultaneously.
For applications requiring more relays to be active concurrently, a power supply rated 5A or higher, possibly with a split cable to power multiple cards, is recommended.
Hardware Watchdog
The Home Automation Card features a built-in hardware watchdog timer designed to ensure that mission-critical projects can recover and continue running even if the Raspberry Pi's software hangs. The watchdog is disabled upon power-up and becomes active after receiving its first reset signal. The default timeout period is 120 seconds. If the watchdog does not receive a subsequent reset command from the Raspberry Pi within this 2-minute window, it will cut power to the system and restore it after a 10-second delay.
The Raspberry Pi must issue a reset command on the I2C port before the watchdog timer expires. The timer's period after power-up and its active period can be configured via the command line. Detailed information on watchdog commands is available through the system's online help function.
GPIO Inputs/Outputs
The GPIO outputs are directly connected to the local processor and include 51 Ohm resistors. These pins can be used to set or read 0-3.3V digital signals.
Note: Due to global semiconductor shortages, release 3.0 of the Home Automation Card uses the STM32G030C8T6 processor. This processor does not allow the reset pin to be used as a GPIO. Consequently, this version of the card provides only 3 GPIO pins, labeled GP1, GP2, and GP4.
Diagram Description: Two diagrams illustrate the General Purpose Input/Output (GPIO) configurations. The 'General Purpose Inputs Configuration' shows connections for external inputs with a maximum of 2.5V @10mA, mapping to pins GP1, GP2, GP4, and GND. The 'General Purpose Outputs Configuration' shows connections for external outputs with a maximum of 3.3V, also mapping to GP1, GP2, GP4, and GND. Both diagrams depict a '+' and '-' terminal for signal and ground connections.
Normal-Open Relays
The card is equipped with eight onboard relays, grouped in fours and connected to two connectors. Each connector provides a common port and four normal-open (N-O) relay contacts. Due to trace width and gap limitations, the relay contacts are rated for a maximum of 24VAC/DC and 4A. The current limit applies to the sum of all loads connected to each 4-relay connector. Therefore, a single connector can support one 4A load, two 2A loads, or four 1A loads.
Diagram Description: Two diagrams illustrate the wiring for the relays. The 'RELAYS 1-4 CONFIGURATION' shows connections for 4 loads (LOAD1-LOAD4) to relay contacts RL1-RL4 and a common (COM) terminal, powered by an external AC/DC supply (24V AC/DC @4A MAX). The 'RELAYS 5-8 CONFIGURATION' shows a similar setup for relays RL5-RL8, also connected to an external AC/DC power supply (24V AC/DC @4A MAX).
Optically Isolated Inputs
The card features 8 optically isolated inputs, each with a 1K series resistor connected to the 5V power supply. These inputs can detect contact closures, open collector/open drain circuits, or quadrature encoders. The Home Automation board can count contact closure signals on either the rising or falling edge of the signal, with a maximum frequency of 100 Hz.
Diagram Description: Three diagrams illustrate the configurations for the Optically Isolated Inputs. The 'CONTACT CLOSURE CONFIGURATION' shows how to connect simple switches or sensors to IN1-IN4 (and implicitly IN5-IN8) and GND. The 'OPEN-DRAIN/OPEN-COLLECTOR CONFIGURATION' shows how to connect devices with open-drain or open-collector outputs. The 'QUADRATURE ENCODER CONFIGURATION' depicts the connection of a quadrature encoder (with outputs A and B) to the input pins. All diagrams show the input pins (IN1-IN4) and GND, with corresponding terminal blocks.
0-3.3V Analog Inputs
The Home Automation Card is capable of measuring eight analog input signals, ranging from 0 to 3.3V. These analog inputs can be utilized to measure temperatures by connecting external thermistors, with a recommended value of 10Kohms.
Diagram Description: Three diagrams illustrate analog input configurations. The 'ANALOG INPUTS CONFIGURATION' shows how to connect external analog signals (0-3.3V MAX) to AD1-AD8 pins and GND. The 'TEMPERATURE MEASUREMENT CONFIGURATION (4 OF 8 CHANNELS)' specifically shows the connection of 10K Ohm thermistors to AD1-AD4 (and implicitly AD5-AD8) and GND, with a 15K Ohm pull-up resistor shown for each channel.
Temperature Measurement Using Lower Resistance Thermistors
For using thermistors with lower resistance values, an additional pull-up resistor can be installed in parallel with the onboard 15Kohms resistor. Each input has an uninstalled 0805 resistor footprint available for this purpose.
Image Description: A close-up image of a section of the Home Automation Card's PCB shows several unpopulated 0805-sized resistor footprints. These footprints are labeled with numbers like '1', '2', and '5', indicating their intended resistance values for use as pull-up resistors in thermistor configurations.
When reading analog signals, the board reports the signal value in volts. The corresponding temperature must be computed using a table provided by the thermistor manufacturer. For example, to use a 1Kohm thermistor, install 2Kohm 0805 resistors on the desired channels. This results in a combined pull-up resistance of approximately 1.76Kohms (2K || 15K). At ambient temperature, the voltage reading will be approximately half scale.
0-10V Outputs/Light Dimmers
The card supports two standards for 0-10V dimmers: IEC standard 60929 Annex E (current sink controls) and ESTA E1.3 standard (current source controls). Both standards require a maximum current of 2mA per channel. The Home Automation Card includes an onboard 12V power supply and supports both standards.
Each of the four DAC outputs can supply up to 10mA, allowing for the connection of up to five Dimmer Controllers per channel, totaling 20 dimmable lights.
Diagram Description: A diagram labeled 'LIGHT DIMMERS CONFIGURATION' shows the four DAC outputs (DA1-DA4) and GND. Each DAC output is connected to a control input (CTRL1-CTRL4) of a dimmer controller. The diagram indicates '0-10V/10mA EACH'.
The Home Automation Card can control any four industrial control devices that require 0-10V input and draw less than 10mA per channel.
Open Drain Outputs with PWM
This configuration allows powering loads up to 4A. An external power supply of up to 24V must be provided. The command system can be used to turn outputs on/off or for proportional control using Pulse Width Modulation (PWM). The PWM frequency is 48KHz, and the duty cycle (fill factor) can be adjusted from 0% to 100%. The external power supply must be capable of delivering the total current required by all four loads.
Diagram Description: A diagram labeled 'OPEN DRAIN OUTPUTS CONFIGURATION' shows the four Open Drain outputs (OD1-OD4) and GND. Each output is connected to a load (LOAD1-LOAD4). An external power supply (+/- terminals) is shown providing power to these loads. The diagram indicates '24V/4A MAX'.
Specifications
Feature | Specification |
---|---|
On Board Resettable Fuse | 3A |
Open Drain Outputs | Maximum output current: 4A Maximum output voltage: 24V PWM frequency: 48KHz |
Analog Inputs | Maximum input voltage: 3.3V Input Impedance: 50 KΩ Resolution: 12 bits Sample rate: 250 samples/sec. |
GPIO Lines | Directly from the on-board STM32F030 microprocessor under control of the software |
DAC Outputs | Resistive load: Minimum 1 KΩ Accuracy: ±1% |
Opto-Isolated Inputs | Pull-up Resistor: 1K @ 5V Isolation Resistance: Minimum 1012 Ω |
Relay Outputs | Maximum current/voltage: 5A/48V |
Power Consumption | 50 mA @ +5V (all relays OFF) 750 mA @ +5V (all relays ON) |
For detailed information on connecting to the various inputs and outputs, users should refer to the provided schematics and the data sheets for specific devices used with the inputs or outputs (e.g., TLP-29104 data sheet for Opto-Isolated Inputs). It is the user's responsibility to ensure that input and output voltages and currents remain within the ranges specified by the manufacturer's documentation.
Mechanical Specifications
The Home Automation Card and compatible add-on cards can be mounted in any order. It is also possible to intermix cards from different vendors, provided they do not use the same I2C address (refer to the 'STACK LEVEL JUMPERS' section on page 6). It is recommended to power both the Raspberry Pi and the Home Automation Cards from the same power supply, and to ensure the card closest to the Raspberry Pi is the one receiving power.
Diagram Description: A diagram illustrates the physical dimensions of the Home Automation Card. Key measurements are provided: 96.5 mm (length), 58.0 mm (width of the main board section), 28.5 mm (width of the connector section), 49.0 mm (height of the main board section), and 56.0 mm (height of the connector section). Mounting hole locations are also indicated.
Software Setup
- Ensure your Raspberry Pi is running the latest Operating System (OS).
- Enable I2C communication:
- Run the command:
~$ sudo raspi-config
- Navigate to 'Interfacing Options' (usually option 5).
- Select 'I2C' and choose 'Yes' to enable it.
- Exit `raspi-config`.
- Run the command:
- Install the Home Automation software from GitHub:
- Clone the repository:
~$ git clone https://github.com/SequentMicrosystems/ioplus-rpi.git
- Change to the cloned directory:
~$ cd /home/pi/ioplus-rpi
- Install the software:
~/ioplus-rpi$ sudo make install
- Clone the repository:
- Run the main program:
~/ioplus-rpi$ ioplus
The program will display a list of available commands. For detailed help, type `iopls -h`.
To update the software to the latest version after installation, use the following commands:
- Navigate to the directory:
~$ cd /home/pi/ioplus-rpi
- Pull the latest changes:
~/ioplus-rpi$ git pull
- Reinstall:
~/ioplus-rpi$ sudo make install
Analog Inputs/Outputs Calibration
All analog inputs and outputs are factory calibrated to within ±1%. However, firmware commands allow for recalibration to better suit specific requirements. Each input is calibrated at two points, with the internal software interpolating the voltage linearly between them. Calibration data is stored in the on-board Flash ROM. For optimal accuracy, select calibration points near the low and high ends of the expected input or output range.
To calibrate inputs, an accurate DC voltage must be provided (e.g., an adjustable power supply for 0-3.3V inputs). For calibrating outputs, issue a command to set a desired output value, measure the actual result, and then use the calibration command to store this value.
Calibration data is stored in flash, and the input curve is assumed to be linear. If an error occurs during calibration (e.g., incorrect command entry), a 'RESET' command can be used to revert all channels in a group to factory values. Calibration can then be restarted.
Calibration can be performed without an external voltage reference by first calibrating the outputs and then routing them to the corresponding inputs. The following commands are available for calibration:
- Calibrate Analog Inputs to Low Limit: Apply 0.1V to Analog Inputs. Command:
ioplus <stack> cuin <channel> 0.1
- Calibrate Analog Inputs to High Limit: Apply 3.2V to Analog Inputs. Command:
ioplus <stack> cuin <channel> 3.2
- Reset Calibration of Analog Inputs: Command:
ioplus <stack> rcuin
- Set 0-10V Outputs to Low Limit: Command:
ioplus <stack> uout <channel> 0.5
- Calibrate 0-10V Low Limit: Command:
ioplus <stack> cuout <channel> <actual_value>
- Set 0-10V Outputs to High Limit: Command:
ioplus <stack> uout <channel> 9.5
- Calibrate 0-10V High Limit: Command:
ioplus <stack> cuout <channel> <actual_value>
- Reset Calibration of 0-10V Outputs: Command:
ioplus <stack> rcuout
Home Automation Card Self Test
The firmware provides two commands for self-testing the card. These tests should be performed after power-up, with all I/O connectors removed.
Self Testing the Relays
Run the command:
iopls <stack> reltest
This command will sequentially turn all relays on at a 150ms interval, and then turn them off with the same frequency. The command continues until stopped manually from the keyboard. You can audibly confirm relay closures and visually monitor the corresponding LEDs.
Self Testing with the Loopback Cable
All inputs, outputs, and relay contacts can be tested using a 3-connector loopback cable. This cable can be purchased or constructed using three of the nine provided connector plugs (if not all are needed for inputs and outputs).
Image Description: An image shows a Home Automation Card with a loopback cable connected. The cable has three wires (red, yellow, blue) and connects to a terminal block on the card, demonstrating a typical setup for testing.
Insert the loopback cable into the IO Connector of the Home Automation Card and run the command:
iopls <stack> iotest <test>
The optional `<test>` parameter specifies the test number. If omitted, the software attempts to detect the cable and perform the appropriate test. Valid values for `<test>` are 1, 2, or 3.
Test 1: GPIOs and Opto-Isolated Inputs 1-4
Self-tests the GPIOs and Opto-isolated Inputs 1-4 using Relays 1-4. Insert the cable as shown. Connectors can be plugged into the Home Automation Card in any order. Run the command:
iopls <stack> iotest 1
Image Description: A Home Automation Card is shown with a loopback cable connected, illustrating the setup for Test 1. The cable connects specific pins, likely corresponding to GPIOs and opto-inputs, to relay terminals.
Test 2: Analog Inputs using Analog Outputs
Self-tests the Analog Inputs using the Analog Outputs. Insert the cable as shown. Connectors can be plugged in any order. Run the command:
iopls <stack> iotest 2
Image Description: A Home Automation Card is shown with a loopback cable connected, demonstrating the setup for Test 2. This test involves connecting analog input pins to analog output pins via the loopback cable.
Test 3: Open Drain Outputs and Opto-Inputs 5-8
Self-tests the Open Drain outputs and Opto-Inputs 5-8 using Relays 5-8. Insert the cable as shown in any order and run the command:
iopls <stack> iotest 3
Image Description: A Home Automation Card is shown with a loopback cable connected, illustrating the setup for Test 3. This test connects open drain output pins and opto-input pins 5-8 to relay terminals 5-8.