Wazazoski's Daisy-Chain DIN-Mount I2C IO Modules Vastly Expand the Raspberry Pi's Capabilities

Based around the MCP23017 expander and PCA9517, the boards include status LEDs for each input and output in the chain.

When you need more input/output (IO) than your microcontroller or single-board computer can offer, an expander is an obvious choice — and if you're looking to build a home or office automation system, something like Reddit user Wazazoski's daisy-chainable modular system offers considerable expansion opportunity.

"[A] few months ago I was asked to make some IO modules for my friend's automation which used Raspberry Pi as a main controller," Wazazoski writes. "Modules had to meet his specifications: 24VDC powered; 8 relay outputs; 8 optoisolated inputs; DIN rail mounted; Daisy chainable; I2C bus connected (3.3V AND 5V tolerant); some sort of 'interrupt signals' from inputs present, from all connected modules

"I came up with a design based on [the Microchip] MCP23017 chip: [A] 16 port, I2C port expander. It has 2 groups of IO , 8 ports each, with interrupt line for each group ( it can be configured to indicate a state change in each group). [A] switch mode voltage regulator was used to step 24V to 3.3V required by MCP expander. Each module has a bank of 3 dip switches for setting its I2C address."

To support long cabling with both 3.3V and 5V tolerance, an extra part was needed: The NXP PCA9517 I2C repeater, which includes level translation. "Each module uses this chip on its input," Wazazoski explains. "This way it stays 'isolated' from each previous module in the chain and allows for 3.3 and 5V controller to be connected."

The finished design is split into two boards: A motherboard includes the power supply with all IO circuitry, while the daughterboard has two IDC connectors at each end, the PCA9517 repeater, and LED indicators showing the status of each input and output individually.

"Each connector has all interrupt signals (for inputs) from all modules in the chain. This way, the controller doesn't need to poll every input on every module to checks its state," Wazazoski continues. "As soon as there is a state change on a input, controller gets an interrupt signal corresponding to the module that input was triggered and then can run a routine to check which input it was and what state its in."

Finally, each module is housed in a CP-Z-101-F-PS DIN-mount enclosure, modified to provide connectivity to the IDC connectors and to mark each input/output status LED as it shines through the translucent casing. A further design tweak improved the specification, switching to 12 outputs and four inputs per board.

More information on the project, which has not had any design files released publicly, can be found on the Raspberry Pi subreddit.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Related articles
Sponsored articles
Related articles