[SOLVED] Brainstorming on using an MCP23S17 Portexpander with OpenHab2

Dear all,

before I even had a raspberry pi with openhab2 on it I made a connection diagram of an optocoupler board using a MCP23S17 as a port expander. At the end I would like to trigger several relais via openhab2. My first idea was to write a Pythonscript to do so but since I found the MCP23017-Binding I am wondering if more efficient ways to use a MCP23S17 exist.

So I would like to ask you for ideas how to use a MCP23S17 with openhab2.

Thanks a lot in advance and good start today


If you’re thinking of a wired system instead of WiFi based one, it is imho the best thing you can have. You’re limited in some ways (no PWM) - but gets do job done, and you don’t have to worry about wireless signal issues… The price you pay for this DIY system is 10 times less than anything you can buy.

The thing is, it’s hard to connect/wire it as either you have all lights in your home set up in a star configuration (meaning you have 2 wires of every light is connected to separate fuses) or you build your house pulling 2/4/6 extra signal + 24V wires to the relay behind your wall switch (like I did).

I’ve made some PCB’s to control 24V relays with it instead of 5V. Added optocuplers to it to get some safety for RPi if something goes terribly wrong. It’s been a year since it works flawlessly.

This is my system.
It needs two things - DIN rails and some proper housing for the PCB’s and a proper cable arrangement.

Thanks a lot for the fast reply.

This is what we did in our house :slight_smile: Every switch works with 24V to trigger a relais like you described it. Even our jalousies works with relais. I am a little bit proud of it xD

As far as I understand you use the MCP23017 (Uses I2C) instead of a MCP23S17 (Uses SPI). Do you use the MCP23017-Binding? How stable does it work?

Nevertheless I am still looking for a way to make it work with the MCP23S17 Port Expander. Just because I do not want to make my PCB-Schedul again :wink:

Yes, I’m using it. Never had problems with it except with version 2.5, because of some issues - which I have to check if they’re fixed.

There are no delays in switching, and the “programming” part is simple - so it’s quite great.

Except the actual problem with OH1.5 it sounds great I decided to use it. But I still have one question left:

Is it possible to set a pin for a specific time to high (output) or the other way around to count how long a singnal comes in (input). I want to use it for blinds and dimmer relais. I was not able to find anything about it in the documentation.

Thanks a lot!

If you define your own rules, and use timers to calculate how long it was pressed you could.

Thanks, that was what I wanted to know before I started to put work on it. I started a test and have several questions, which I will raise in a new thread.