Instructables

Using The PCF8575 i2c i/o Expander To Read Inputs With Arduino

Picture of Using The PCF8575 i2c i/o Expander To Read Inputs With Arduino
This Instructable will show you just how easy it is to add extra inputs to your Arduino. You can use this technique to add hundreds of extra inputs to your Arduino with only two wires by using a fancy communication protocol called i2c (eye-squared-see).

What I have used...


 
Remove these adsRemove these ads by Signing Up

Step 1: Build The Circuit

The SDA and SCL lines enable i2c communication. 

Which pins are SDA and SCL?
Uno, Ethernet: A4 (SDA), A5 (SCL)
Mega2560: 20 (SDA), 21 (SCL)
Leonardo: 2 (SDA), 3 (SCL)
Due: 20 (SDA), 21 (SCL), SDA1, SCL1

The PCF8575 is not available in a breadboard-friendly form (only surface mount). The handy Sparkfun breakout boards allow you to plug this chip into the breadboard for prototyping. 

You need to connect a 10kOhm resistor between SDA/SCL and PWR (see image). 

Also note that push-buttons need resistors. If you want an i2c i/o expander in which you don't need resistors on the switches check out the MCP23017.

If you are having troubles hooking up your switches try this for reference. 

I included the LEDs only to provide some feedback. They add no functionality. 

e.ma.niak8 months ago
How do i address more than 8 expanders, is it even possible?
Fuzzy-Wobble (author)  e.ma.niak7 months ago
not possible
2^3 = 8
maybe if you have a microcontroller with multiple i2c ports. better check that. looks like teensy3 has two i2c ports.
http://www.pjrc.com/teensy/pinout.html
lekirst1 year ago
I have the code working as described above. However, I now want to connect four MPR121 sensor boards to the breakoutboard.
Without the PCF8575, the mpr121 code worked perfect. (http://code.bildr.org/download/1010.zip) However with the PCF8575 board I need to alter the addressing within the code. The SDA and SCL lines of the MPR121 boards I have connected to the PCF8575 board. See image. (http://forum.bildr.org/download/file.php?id=174)

But how should I address and read these pins?
does this chip only work for digital inputs, or can you read analog values too?
Fuzzy-Wobble (author)  amandaghassaei1 year ago
Oly digital. 
If you want to read analog ins (without i2c), use the CD4067.