Pages: [1]   Go Down
Author Topic: Least lines for 8 switches  (Read 332 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am building a robot with my son, giving it 8 bumpers that sense when things have been hit.  One or more could be hit at one time. Is there an IC I could add into this to track it with fewer lines.

I have also thought about a 2nd arduino so we have tons of cables.  Fairly new to this, Not new to programming, used to do small electronic projects (like this) 30+ years ago - and I don't recall all the details and the world has changed (for the better thanks to arduino)
Logged

BCC AZ USA
Offline Offline
Edison Member
*
Karma: 35
Posts: 1213
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An I2C expander chip like PCF8574 or MCP23006 would work for you.  It would take 8 switches and use 2 lines for communication plus 1 optional line for an interrupt.  The interrupt will fire on any expander pin changing.  I think that the PCF8674 may be simpler to use but the MCP23008 is more versatile.  Plus, if you are using the I2C bus, you wouldn't need but 1 extra line for the interrupt.
EDIT: You can have 7 additional expander chips on the same 3 wires for a total of 64 inputs (or outputs mix and match).  It gets a bit more complicated if you want interrupts from all 8 chips, but from 1 or 2 not so much.
« Last Edit: July 04, 2013, 11:17:36 pm by groundfungus » Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1271
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A parallel to serial input converter like the 74HC165 is cheap, available and uses 3 lines to interface as many of these chips as you need (they cascade). Lots of examples (code and circuits) on how these are used. Each chip takes 8 bits in parallel and squirts them out as a serial stream that you can assemble into a byte at the Arduino end. Datasheet here http://www.nxp.com/documents/data_sheet/74HC_HCT165.pdf.

The reverse comms is done using the 74HC595 chip.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Pages: [1]   Go Up
Jump to: