8-bit I/O Expanders - Page 1
Forum section: electronics / general

author: FlevasGR
author_rank: Regular Contributor
timestamp: March 15, 2015, 03:02:52 pm
content: Recently i bought 10 IO expanders from ebay (http://www.ebay.com/itm/321626159436?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT) and i have no idea how to use them and also the drawbacks of using them. I have few questions and i hope you can answer themCan i stack them together?How do i connect them with my arduino?What are the limitations and the drawbacks of using them?Lets say i have 5 leds on them. Can i control the 5 of them at the same time?Can i use them for stuff like bargraph displays?

author: free_electron
author_rank: Super Contributor
timestamp: March 15, 2015, 03:26:50 pm
content: These are I2c chips. You will need to use the wire library.So yes, you can con ect them to the duino.In the datasheet you will see the chips have sda,scl and three address pins.You connect all sda together, to the sda of the duino, all scl together to the scl of the duino.Each chip now need a unique adress. So the address pins of the first chips get 000, the second chip 001 , the third 010 and so on...Read the help of the wire library, there is a example for pcf8574 in there.Make sure you have pcf8574 and not the pcf8574A. The A version uses a different base address.So you can have eight 8574 plus eight 8574a on the same bus. Giving you 16 io expanders

author: dannyf
author_rank: Super Contributor
timestamp: March 15, 2015, 03:37:23 pm
content: QuoteVery simple: read the datasheet and you will know everything you need to know to use those chips.

author: free_electron
author_rank: Super Contributor
timestamp: March 15, 2015, 05:30:18 pm
content: Quote from: dannyf on March 15, 2015, 03:37:23 pmyeah. really helpfull..

author: Rick Law
author_rank: Super Contributor
timestamp: March 19, 2015, 03:21:59 am
content: This is the same chip used by many I2C LCD adapter like this one:http://www.ebay.com/itm/IIC-I2C-TWI-SP-I-Serial-Interface-Board-Module-Port-For-Arduino-1602LCD-Display-/310565362720?pt=LH_DefaultDomain_0&hash=item484f235c20Your chip is the PDIP version. The one in the picture are the SMD version.Looking at how the I2C LCD adapters are implemented in HW and SW may give you some idea on how they are used. Note of course I2C LCD is a one-way device. It listens only and doesn't talk back.Note the address pins in the picture. Note also (if you search hard enough), there is a SaintSmart implementation that is much simpler with fixed address. I have one of those and a few others like the ones pictured above. The differences may give you some real life examples on how you can gang them together.

author: hans
author_rank: Super Contributor
timestamp: March 20, 2015, 04:27:02 pm
content: I/O expanders main advantage is that you trade 2 wires for 8 digital I/O. You could go up to 64 I/O because you can hook up 8 of these chips to 1 I2C bus and individually strap the A0, A1, A2 pins accordingly. That means that I/O expanders are well suited for like indicators, buttons (if you can take the burden of I2C access), relay boards, etc. You just need a cable with power, I2C SCL, I2C SDA and GND.Accompany it with a EEPROM/ADC/etc. that also has A0..A2 address pins and you could make some interesting modular systems out of them.I2C can be multi-master.. so multiple boards could (in theory.. - if you want to figure out the software for that) read or write to 1 chip.Disadvantages? Well , it's an extra chip which takes up space and price. Sometimes a bigger microcontroller (28 to 40 or 44pin, 44 pin to 64 pin) is just a few ten cents more, depends if you need to upgrade to another family or not. However if want the remote I/O to be on another board, this argument is not valid.You need to write additional software to talk to the chip, so you can use the extra pins.You can create much simpler output-only I/O with a 74HC595 or 164 on just 3 pins. These can be operated much faster (MHz territory), and chained much longer.To even change a single bit, you need to send a complete I2C packet. Given that this chip is 100kHz and you need to write 2 bytes or so to do anything at all - the latency is in the order of 160us - 200us.As said, for buttons, indicators or relays that's often not a problem, but you may need to buffer port changes together and send them at once.How to operate: on page 9 there is the I2C address. It's different for a non-A and A versionThe next pages show how to read and write. It seems like it basically send address + write output, or send address + read port.You apparently don’t have to set the direction, with the "quasi directional I/O". Not sure how good or easy that works, but I'm sure it will work fine for just a few LEDs or something.