Not enough I/O pins

Hey all,

I recently decided to take my first dive into the arduino pool and have come up with what I thought was a fairly simple project. However, after pondering on the details for a short time I realized I might have more work ahead of me than I thought. The problem is that I need to be able to read analog input from 10 different photocells and use that information to control the output of 10 corresponding digital I/O pins. This is a problem since the arduino only has 6 analog input pins. I thought for a bit that I could multiplex the inputs using a 3/8 multiplexer, but that would require the use of 3 digital I/O pins, thereby leaving me at least 1 short in that department since there are only 12 available to begin with.

I guess my question is, short of getting another board is there any way to have read so many inputs and still have control over so many outputs individually?

EDIT: I should also mention that the digital I/O pins are to be driving individual transistors which are in turn driving 6 LED's each.

google: "analog to digital converter"

Use a cd4051 analog mux to get 8 more analog ins (at the cos of one aanalog and 3 digital pins).

If you still need more digital outs use 74hc595 shiftregisters to add more.

A RBBB Arduino clone (http://www.moderndevice.com/) kit costs $12.50 + very reasonable p&p. Easy to assemble, and if you don't want to assemble, assembled units are also available.

Could your project be done simply by using two Arduinos?

MCP23xxx series 8/16 port(pin really) I/O expanders. I2C or SPI.

For analogue multiplexing see this project:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html

For extra I/O with fast access use the MCP23S17 - 16 extra I/O and you can use up to 8 of them directly giving up to 128 digital I/O.

For extra I/O with fast access use the MCP23S17

I'm so badly trying to get hold of them, but RS has no stock currently... :frowning:

Farnell have 457 in stock:-

Farnell have 457 in stock:-

Pity that I am in South Africa. Should have asked the English football team to bring me some ::slight_smile:

The do South Africa as well:-

or choose S.A. from:-

Why not use 2 or more Arduinos to do this?

Not sure how quick shipping would be to you from Taiwan (it took about 10 days to Kentucky in the US),
but Futurlec has the MCP23S17 for $1.35 US.

I've got the I2C version of that chip already built up into a shield: Centipede Shield

Though the default Arduino I2C speed is 100KHz, it's still pretty fast. We've had no problems detecting lots of simultaneous button presses just by polling, not even bothering with the interrupt and latch feature. The MCP23017 can support up to 1.7MHz I2C so there is room to tweak the Arduino I2C implementation if more speed is really needed.

Though the default Arduino I2C speed is 100KHz, it's still pretty fast.

I got a couple of MCP23016's.

Mine runs pretty good at 400khz, after I tweaked the Wire libs.

With a few other I2C devices, I had to drop it to 300khz though.

Finally found the local distributors for Farnell. Pretty close to me in fact.

Thanks Grumpy_Mike :slight_smile: