How to use more than 1 MCP23xxx?

I want to use 2 MCP23008 extenders on the same Pi. One has an address 0x20 (A0,A1,A2 to GND). I have that already installed and up and running. The 2nd MCP23008 I set the address to 0x21 (A0 to 3.3V, ,A1, A2 to GND). I2C tools verified the addresses.
My guess for this to work on Cayenne with the same Pi do I need to modify the init.py file? If so, how. Or what do I need to do the use both. I know I could just get rid of both I.C.'s and go with a MCP23017 but I wouldn’t learn from doing that.
(I also have an PCA9685 (0x40) on the I2C running OK.)

let me check how you can do add multiple MCP23008 with cayenne agent. It should add it once detected.
Are you familiar with python then you can use GitHub - myDevicesIoT/Cayenne-MQTT-Python: Python Library for Cayenne MQTT API to send data to cayenne and add the code to read multiple MCP23008 data to it.

1 Like

I’ll look into that. I am not a coder but a hardware person willing to learn. Cayenne didn’t detect the 2nd address using the same chip type.

Thank you for all your help.

if you want to start with it, then first follow this tutorial and get the MCP23008 working with raspberry pi. Using the library | MCP230xx GPIO Expander on the Raspberry Pi | Adafruit Learning System
then we can move to cayenne code.

I started to look though that last week and saw that there was a notice that it was no longer supported and took Adafruits suggested link which took me the their circuitpython which that wasn’t too helpful for this.
I will go back the the ‘no longer supported’ link and stay with that.

Thank you again.

yes, you follow the circuit-python tutorial and add the mcp23008 to raspberry pi