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...

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. 

How do i address more than 8 expanders, is it even possible?
not possible<br>2^3 = 8<br>maybe if you have a microcontroller with multiple i2c ports. better check that. looks like teensy3 has two i2c ports. <br>http://www.pjrc.com/teensy/pinout.html
I have the code working as described above. However, I now want to connect four MPR121 sensor boards to the breakoutboard.<br> 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)<br> <br> But how should I address and read these pins?
does this chip only work for digital inputs, or can you read analog values too?
Oly digital.&nbsp;<br> If you want to read analog ins (without i2c), use the CD4067.

About This Instructable


17 favorites


Bio: I am a human from planet earth. I use my brain to make things. fuzzywobble.com
More by Fuzzy-Wobble: Teensy Monster v1.0 // DIY MIDI Controller Prototyping Wizardry With SPACEBREW Top / Best DIY Electronic Stores & Suppliers
Add instructable to: