Raspberry Pi. How to connect 150 Sensors and 58 Relays. Not enough GPIO pins

Hi

I am having a rewire done at the moment, so I thought I’d put in wired automation.

I have run in 150 sensors & push buttons across the house, plus 58 Relays.

Due to space being tight I have the relays in 3 different places. So i’m thinking about 3 instances of HA. Trialled 2 and seemed to work well.

I’d like to do most things wired if possible, excluding my 21 lights which are Fibaro.

Any suggestions on the best way to read/monitor the sensors and push buttons? There’s not enough pins on my 3 pi’s.

I thought about usb’d arduino’s on each pi, but the “Arduino Sensors” component only seems to accept the use of analog pins and I’ve only tried digital push to make in HA. If I where to use the analog pins, how would I configure say 6 buttons on one pin using different resistors?

Or if anyone has a better idea for connecting all these wired inputs I’d love to here it. Please don’t say WIFI.

Thanks

1 Like

Perhaps a hat like this would help? Apparently, you can stack them to get more inputs, but I can see that getting unwieldy if you have 10 of them.
http://raspihats.com/product/di16/

You could use several arduino mega (3) to publish the switch state change to an mqtt broker and an additional arduino to control the relay state, again through mqtt.
This would required to use an ethernet shield for each arduino.

If you’re ready to involve more electronic their is certainly better / more cost effective solution, but they are not as much "off the shelf ".

You could also use only 1 ethernet interface, 1 master arduino mega and 3 slave arduino mega with this method:

Thanks for you’re help guys. I already have 3 mega2560’s and 1 ethernet shield, so may be swayed towards that option. That being said I’ll look into both in detail and report back at various point of the build.

what kind of relay you are using to control your mains? have you done it?

You could just use some shift registers. https://learn.sparkfun.com/tutorials/shift-registers

Check this guide out:


Its working fine for light switching.