digital I/O expander shield?

I want to have perhaps a dozen capacitive input sensors, but with only 14 input pins, I can only get 7 capacitive input sensors with the raw Arduino board. Does anyone make a shield to expand the number of digital I/O pins?



Hi, it's very simple with a PCF8575 I²C expander chip, you will get 16 I/O more using only two pins of the Arduino (note: two analog pins)

Sparkfun sells a breakout board so you can solder it directly on a protoshield for Arduino :

For the control, just refer to the Wire library for Arduino and some specific codes that may already exists for similar I²C communication. If someone offers me the breakout board, I can also write myself a simple library for Arduino.

Thanks for the info/link. There are no photos of the product, unfortunately. Does it "snap" onto the Arduino board?

The software seems a bit complex. This may take up some program space, but it also may make reading and writing the data somewhat slow. I don't know whether it will be fast enough to do the capacitance testing trick. I've programmed for a long time, but have no specific experience with this line of products.

Do they make a similar processor with 30 or 40 I/O pins?

The photo was not visible because I had not yet enabled scripts for that site. now I can see the board.

Can one run more than one such board over the I2C lines? That is, are the boards addressable, or is the protocol just point-to-point?

Look on the right of the board : there are 3 solder jumpers for changing the address (ADDR mark on the board) thus you can connect up to 8 boards on the same bus.

This component works in fast I²C mode (400 kbit/s). There is no magic. Another way is to use a digital to analogic converter and use an analogic input and decode with the internal ADC --> it will also take some time (and I think more than with the I2C bus).

It can "snap" directly into the Arduino board, as the pins for power and I2C signals are compatible with the order of analog pins of an Arduino : you can connect it on the bottom right corner in the same way as Tod did with the BlinkM (search for pictures of Arduino and BlinkM to see how it plugs directly into the board.

Question, back to your first post : why do you tell that you can only listen to 7 capacitive input sensors with 14 input pins ?

I have read about how you can use two pins to create a capacitive sensor, so I figured that 14 pins would be able to create 7 capacitive sensors. Have I misunderstood something?

Ok, I see. I didn't catch the "capacitive" adjective in your first post, and focus only on the digital I/O expander.

In fact, you need one pin for the capture, and one pin for the power (in fact, the pull-up voltage, not really powering your sensor). But it can be a common pin (and is provided on the Arduino via the power connector)

I use three capacitor sensors going directly into three digital input/output of the Arduino board : (the original is there diy 3D controller but I prefer my article for the pictures, sorry it's in french). I am not sure all digital inputs are suitable, as this is a special use (not a direct digital value as the oscilloscope view shows !)

Why do you need capacitive sensor ? I mean, not the final use, you're free to do what you want, but what information will the Arduino deal : the numeric value of capacity or like an "on/off" switch ?

Because in the second case, you may interface some components to deal with the capacitive sensor and convert it into a digital value 0 or 1.

Aren't there capacitive sensor control chips that include the IO expansion already? For instance, the Freescale MPR084 provides 8 touch-pads with an I2C interface (3 pins, addressable and expandable.) (The MPR084 used on the JMBadge demo board, so I happen to have the part number available, but there are many similar chips from many vendors, including a bunch from Atmel.)

Try to expand the hacks used to implement capacitive sensing on regular arduino pins to many additional pins is probably not worth the effort.

Unfortunately, most of the capacitive sensors are aimed at tiny handheld devices (like iPods), and they come in tiny little packages that aren't very friendly to the hobbyist manufacturer...


It was my sense that you needed to toggle the voltage at the sensing pin and then sense how long it took to recover: the longer it takes, the more capacitance you have. I understood that you needed one output pin to toggle the voltage, and the other input pin to do the sensing. If all you have is a pull-up resistor, then the voltage will not vary much when touched.

I'm trying to avoid having to purchase a lot of momentary contact switches. I also have an application where touching the switches is likely to be more useful than pressing on a switch. I don't care about the capacitance, nor the analogue value: I just need to know that something touched the sensor.


Thanks for pointing me at the Freescale. I need to be able to control the positions, locations, and sizes of the sensors. I'll look at the Freescale.

When you say that expanding the capacitive sensing is probably "not worth the effort" are you trying to say "it won't work for more than one sensor" or "it will be unreliable" or something else?

I tried looking for inexpensive momentary contact switches, to sense them "normally", and ran into both expense and not much variety. I'm trying to get an animal to play with this device, so the sensors or switches need to be robust (no plastic). And if I can get the capacitive approach to work, it will be much easier to manufacture.

But I'm still flailing around. I don't even have an Arduino here yet (should arrive tomorrow or Friday).

Thanks for all of your help!


I looked at the original 3D code, and I see how to do the capacitance trick with a single input line. Good to know that you can run three of them at once, and that they all work.

I ordered two of the expander boards. I should be all set now. Unless westfw's pessimism about the whole capacitive hack is well founded!

When you say that expanding the capacitive sensing is probably "not worth the effort" are you trying to say "it won't work for more than one sensor" or "it will be unreliable" or something else?

I'm thinking that it will be difficult to achieve the needed accuracy of timing measurements if you're acting through some kind of intermediate communications channel. I haven't actually DONE capacitive sensing directly on the AVR pins, so I'm not certain what's involved, but that's my gut feeling.

Another possibility is to use another Arduino chip. At about $5 and usually available wherever arduinos are sold (maybe?), I'm a bit surprised that there hasn't been noise about using an arduino chip as a peripheral for another arduino...

Are there any libraries or sample code to talk to a PCF8575?

I’m a bit surprised that there hasn’t been noise about using an arduino chip as a peripheral for another arduino

There has, actually: within the last week or two, someone posted info about a master/slave library for linking Arduinos over I2C.