Posts: 18
Joined: Wed May 08, 2013 8:13 am

how to achieve large amounts (120+) I/Os?

Sat Sep 14, 2013 11:25 pm

i'm working on a larger scale home-automation project.

one relatively affordable option would be to use regular digital pushbuttons, which also have LED feedback and are grouped in 6 buttons and leds per unit.

since i need around 20 of these units, i'm looking at at least 120 in- and outputs to handle!
at the moment, the idea would be to concentrate these at 2 locations, running one raspi each.
those are manual buttons, so the events / load should be a piece of cake for the raspi to handle. the question is rather, how to best hook up so many inputs (through cat 5 or 6 cable, voltage tbd) and also drive that many leds?

it's actually almost an arduino task except for some flexibility required on getting events onto the network / messaging. interrupts would then trigger the central control/command unit (loxone).

anyone done something like this already?

Posts: 3974
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: how to achieve large amounts (120+) I/Os?

Sun Sep 15, 2013 3:24 am

Maybe you could use CanOpen

There is a nice book about it!
Embedded Networking with CAN and CANopen
from Copperhill Technologies Corporation

It is available on

Microchip has the PIC18LFXXK80 series which could be ideal for your project.

Circuit Cellar (no 238 and 239) had a nice article about A CanBus thermostat system using the old PIC18F258.
( For a few buck you could get the article from them).

Title: Intelligent energy solutions from Stefan Siegel.
This was on the May and June 2010 issues. (June is about the pic18f258 and May is about the overall).
Really nice article.

The source code is available from their ftp site. ...

His code was based on a source forge project

This is the author webpage

Everything is in C using the microchip MPLAD IDE and C18 compiler. The source code, at the article time, was for the PICF258 but it will be easy to modify and get the LFXXK80 or pic18fXX80 series to work. Some registers change their names and some hardware functions change bit position.

The CanOpen protocol is maybe overkill for you but CANBUS has been made for exactly that purpose (distribute i/o).

Plug one at the end of the bus and use it has a master which communicates via I2c or serial to the RPi
P.S. some projects use the Rpi to access CANBUS.

Anyway this one option.

Best Regards,

Posts: 18
Joined: Wed May 08, 2013 8:13 am

Re: how to achieve large amounts (120+) I/Os?

Sun Sep 15, 2013 9:29 am

thanks for the pointer,

as i'm dealing with quite a few sub-projects and several different buses already at the same time, getting in another bus / many distributed pcb's and various software modules is not quite what i'm looking for.
having one or two large concentrator boards and one or two single bridges (raspi or arduino) is a lot easier to keep track, maintain and develop.

if i go for the digital pushbuttons, i'd use one or two ethernet cables per unit but simply to wire each button and led to one or two central locations. there, i imagine having a single large pcb that handles the I/O.
should also be more convenient to drive the leds from there.

Posts: 2829
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK

Re: how to achieve large amounts (120+) I/Os?

Sun Sep 15, 2013 10:48 am

Use a few cheap port expander chips :

- the chips are just £1 each
- using I2C so only the 2 I2C pins used on the PI
- 16 inputs per chip
- up to 8 chips on same I2C bus (for MCP23017) - 128 inputs (in addition to the remaining 15 Pi pins...)

..and here's how to connect/control them on Pi: ... pi-part-1/

Posts: 18
Joined: Wed May 08, 2013 8:13 am

Re: how to achieve large amounts (120+) I/Os?

Sun Sep 15, 2013 12:09 pm

very cool,

exactly what i needed :-)
i'm a newbie to the electronics side of things, coming from software.
so the learning curve there will be steep.
but the task i want to achieve sounds quite simple, most complicated aspect will be scaling the whole setup (power etc...)

Return to “Automation, sensing and robotics”