Hi, I want to connect three PCF8574s to uno r3 because I need to 24 output Pins.
How should I connect them to uno.
Very thanks.
Hi,
You need to connect them as usual I2C devices. Then you need to set the 3 address pins to be different so you can address them individually. Usually there are 3 address pins that can be changed like this:
See THIS: page which shows several PCF8574 versions used to run LCD displays. Near the bottom see this section:
CHANGING I2C ADDRESSES:
Also see the section on that page marked NOTE! I2C ADDRESSES:
Some modules have the 3 pins available, like THIS:
LOTS of detailed technical information about I2C Interfaces see THIS: from Nick Gammon.
DISCLAIMER: Mentioned stuff from my own shop...
leoncorleone:
Hi, I want to connect three PCF8574s to uno r3 because I need to 24 output Pins.
How should I connect them to uno.
Very thanks.
I guess you are aware that a PCF8574 is not a one to one substitute for an Arduino pin. The big limitation is that it works only on the low side to sink current. That means you cannot, for example, attach the anode of a LED to a PCF8574 pin and get it to light.
The big limitation is that it works only on the low side to sink current
Which datasheet are you reading? Because the PCF84574 I'm reading says otherwise. That the I/O pins are push pull. You may not be able to drive LED's directly (you can add a driver) from the pins, but it can certainly source as well as sink.
because I need to 24 output Pins.
OK so I would use two MCP23017. A much cheaper and better chip than the PCF84574.
pwillard:
Which datasheet are you reading? Because the PCF84574 I'm reading says otherwise. That the I/O pins are push pull. You may not be able to drive LED's directly (you can add a driver) from the pins, but it can certainly source as well as sink.
datasheet: Aurélien Jarno
datasheet extract:
My point is that it is not a 1:1 substitute for Arduino pins because, although it can sink 25 mA, it can source only a maximum of 300 micro amps.
Yes, you can add yet another chip to solve that if, for example, you are driving a common cathode device (7 segment display for example), but then at has been pointed out, there are better solutions.
6v6gt is right, it's not designed to source current. That's because the quasi-bidirectional design. It's perfectly fine to short a "sourcing" pin to GND with this. Actually, that's how you can only use it to detect switches. Coolest thing about this is you can use the same pin for a led and a switch at the same time. As long as you find it okay the switch will light the led as well (but fine for a lot of illuminated push buttons) and you blank the led very shortly to read the switch. See the PCF8574 library which can do all of this for you
But yeah, I find them a bit expensive for what you get. A Arduino Pro Mini will cost you less...
The MCP23017 looks nice as well, Bare chip is very affordable but I can't find them as cheap module (which can be a deal breaker for some).
I guess you meant expensive, but these appear (in DIP versions) to be about the same price, and for hobby work the cost increase in a project shouldn't be too noticeable:
Incidentally, the 'high power' version of the standard 959 shift register, the TPIC6B595 appears to do the same thing in that it is a low side only driver, but the difference to the pcf8574 is that the data sheet makes that very clear on page 1.
Oops, autocorrect
But yeah, it's not to crazy. But an extra Pro Mini is cheaper and gives you more IO and peripherals.