I2C relays. How to set the address with jumpers?


I bought a 32 relays board on ControlEverything: https://shop.controleverything.com/products/32-channel-relay-controller-i2c

It works great but I needed 8 more relays, so I bought https://shop.controleverything.com/collections/relay-controller/products/8-channel-relay-controller-i2c

My particle is on the 32 relays and it’s connected to the 8 relays board with I2C connectors. But how can I set up the address of the 8 relays board ? I don’t understand how address jumpers work.

I’m using the library MCP23008-I2C.h is it ok ?

Thanks for helping


I2C addresses on many devices come in 2 parts,the first 4 bits are fixed by the manufacturer (your base address) then 3 more bits can be set by the user, in this case with jumpers labelled A0 A1 A2, if you put a link on one or several of those, that card will then have a different address to the other one. Don’t have one of these boards but I would try a link on A0 which I would expect would mean you could address it as 1.

Thanks for your answer. What do you mean by “if you put a link” ? What’s a link ?

Basically a piece of wire, normally on header (pins) like those you get special links (called jumpers) with a plastic shroud on that might look like this: http://bright-components.co.uk/WebRoot/Namesco/Shops/950004269/5356/DE63/A97E/3EF6/FC69/C0A8/1909/DD10/black_pull_jumper.jpg that make this easy to do

Thanks. I have set the wire as you said on A1 so the address should be 2 but still not working. Maybe it’s the code ?

#include <Adafruit_MCP23008.h>


Adafruit_MCP23008 relays;

void setup()


As with most things @rickkas7 has a good tutorial on I2C here https://github.com/rickkas7/particle-i2c-tutorial. You might find the I2C scanner useful to double check the address is as you expect, the Adafruit library adds 20 to any address you send it so if the scanner says 21 you would write relays.begin(1).
There are 2 simple examples included with the library, your code is missing a critical step, you haven’t told the MCP chip that pin is an output

relays.pinMode(7, OUTPUT); before setting its state.