0

I want to use more than 3 MCP23017-E/SP DIP28 chips so I can use many digital pins. I use Adafruit-MCP23017-Arduino-Library. I tried this solution but only device address with 0x00 is working.

The question is what device address should I use for additional chip? enter image description here

#include "Adafruit_MCP23017.h" 
Adafruit_MCP23017 mcp1; 
#define addr1 0 // tested 1,2,3,4,5, 0x01, 0x02, 0x20, 0x21 but only 0 and 0x00 is working.
void setup() 
 {
 mcp1.begin(addr1); 
 mcp1.pinMode(0, INPUT); //pin 21 on chip
 Serial.begin(9600); 
 } 
 void loop()
 { 
 if(mcp1.digitalRead(0)== HIGH )
 Serial.println("HIGH"); 
 }
asked Nov 5, 2016 at 1:57

1 Answer 1

0

I share my solution with 7 MCP23017 chip , 7x14 pins=98 pins using adafruit library.

Connections:

addr 0 = A2 low , A1 low , A0 low 000
addr 1 = A2 low , A1 low , A0 high 001
addr 2 = A2 low , A1 high , A0 low 010
addr 3 = A2 low , A1 high , A0 high 011
addr 4 = A2 high , A1 low , A0 low 100
addr 5 = A2 high , A1 low , A0 high 101
addr 6 = A2 high , A1 high , A0 low 110
addr 7 = A2 high, A1 high, A0 high 111
Connect pin #12 of the expander to Analog 5 (i2c clock)
Connect pin #13 of the expander to Analog 4 (i2c data)
Connect pins #15, 16 and 17 of the expander to ground (address selection)
Connect pin #9 of the expander to 5V (power) // operation voltage is 1.8 to 5.5
Connect pin #10 of the expander to ground (common ground)
Connect pin #18 through a ~10kohm resistor to 5V (reset pin, active low)
Input #0 is on pin 21 so connect a button or switch from there to ground

Code:

#include <Adafruit_MCP23017.h>
Adafruit_MCP23017 mcp1; // chip 1
Adafruit_MCP23017 mcp2; // chip 2
#define addr1 7 // 7 = A2 high, A1 high, A0 high
#define addr2 0 // 0 = A2 high, A1 high, A0 high
void setup() 
 {
 Serial.begin(9600); 
 mcp1.begin(addr1);
 mcp2.begin(addr2);
 mcp1.pinMode(0, INPUT); //pin 21 on chip
 mcp2.pinMode(0, INPUT); //pin 21 on chip
 } 
 void loop()
 { 
 if(mcp1.digitalRead(0)== HIGH )
 Serial.println("HIGH"); 
 delay(1000);
 if(mcp2.digitalRead(0)== HIGH )
 Serial.println("HIGH 2"); 
 delay(1000);
 }
answered Nov 12, 2016 at 17:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.