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

 by Fuzzy-Wobble
pcf8575.jpg
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. 

lekirst says: Feb 22, 2013. 12:40 AM
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?
amandaghassaei says: Nov 26, 2012. 2:55 PM
does this chip only work for digital inputs, or can you read analog values too?
Fuzzy-Wobble (author) in reply to amandaghassaeiNov 26, 2012. 5:46 PM
Oly digital. 
If you want to read analog ins (without i2c), use the CD4067.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!