Go Down

Topic: PCF8575 vs. PCF8575C I2C expanders (Read 3534 times) previous topic - next topic

Pitchoilcan

Apr 06, 2012, 08:02 am Last Edit: Apr 10, 2012, 03:34 pm by Pitchoilcan Reason: 1
Hello All,
I'm trying to use a PCF8575C port expander to drive 16 LED's. I found  this demo (which uses PCF8575)
http://www.youtube.com/watch?v=UXPuzbEV_ic&lcor=1&email=comment_reply_received&lc=WXSmUkaibiuXGHBb-mQG2Gdv_r_3ZM5Zym77mm2PVxs&lch=email_reply&feature=email
that turns on each LED in series, but I'm unable to get it to work. This what I have at present :

(Arduino) PIN A4 -> (PCF8575) PIN SDA
(Arduino) PIN A5 -> (PCF8575) PIN SCL
(Arduino) PIN 5V -> (PCF8575) PIN VCC
(Arduino) PIN GND -> (PCF8575) PIN GND
(Arduino) PIN GND -> (PCF8575) PIN A0, A1, A2
That's the way it's setup in the demo and in the makers blog http://www.lucadentella.it/2012/03/16/orologio-nixie-3-rtc-ed-expander/3/, yet I don't get any response from the LED's.

Here's the code:
Code: [Select]
#include <Wire.h>

#define PCF8575_ADDRESS  0x20
unsigned int outputs;
 
void setup() {

 Wire.begin();
 
 Serial.begin(57600);
 Serial.println("PCF8575 LED rolling demo");
 
 outputs = 0xFFFE;
}

void loop() {

 byte low = outputs & 0x00FF;
 byte high = outputs >> 8;
 Wire.beginTransmission(PCF8575_ADDRESS);
 Wire.write(low);
 Wire.write(high);
 Wire.endTransmission();
 
 if(outputs == 0x7FFF) outputs = 0xFFFE;
 else outputs = (outputs << 1) + 1;
 
 delay(200);
}

First off I was unable to get it to compile, after look at afew other code snippets I changed
Code: [Select]
 Wire.write(low);
 Wire.write(high);
to
Quote
Wire.send(low);
 Wire.send(high);
and was able to get it to compile, but still not a blink from any of the LEDs.

The breakout board's datasheet says Pin connections:
Breakout Board for PCF8575 I2C Expander
SDA to pin 4 on the analog header
SCL to pin 5 on the analog header
VCC to 5v
GND to GND
I/O pins need pull up resistors to VCC.
I didn't use any resistors because the demo didn't include them. What am I doing?
Quote
http://www.ti.com/lit/ds/symlink/pcf8575c.pdf
vs.
http://www.ti.com/lit/ds/symlink/pcf8575.pdf

Sparkfun's Breakout Board for PCF8575 I2C Expander has the PCF8575C IC
Quote
Breakout Board for PCF8575 I2C Expander
Description: Have you run out of I/O pins? This great IC allows the user to expand up to 16 I/O using only two I/O for control! The PCF8575C is controlled through an I2C interface and features 16-bits of quasi-bidirectional input/output pins. Checkout the datasheet for more info!
http://www.sparkfun.com/products/8130
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

cjdelphi

Code: [Select]

#include <Wire.h>

#define PCF8575_ADDRESS 0x20
unsigned int outputs;
 
void setup() {

  Wire.begin();
 
  Serial.begin(57600);
  Serial.println("PCF8575 LED rolling demo");
 
  outputs = 0xFFFE;
}

void loop() {

  byte low = outputs & 0x00FF;
  byte high = outputs >> 8;
  Wire.beginTransmission(PCF8575_ADDRESS);
  Wire.send(low);
  Wire.send(high);
  Wire.endTransmission();
 
  if(outputs == 0x7FFF) outputs = 0xFFFE;
  else outputs = (outputs << 1) + 1;
 
  delay(200);
}



does this compile / work (make the LED's turn on / off) ?

Pitchoilcan

#2
Apr 06, 2012, 09:43 am Last Edit: Apr 10, 2012, 03:19 am by Pitchoilcan Reason: 1
Yes cjdelphi that looks like what I've got.
Quote

The bidirectional I
2C bus consists of the serial clock (SCL) and serial data (SDA) lines. Both lines must be
connected to a positive supply via a pullup resistor when connected to the output stages of a device
http://www.ti.com/lit/ds/symlink/pcf8575.pdf
even with the resistors all LED's remain LOW (off). Any ideas on what's wrong?
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#3
Apr 10, 2012, 01:15 am Last Edit: Apr 10, 2012, 03:36 pm by Pitchoilcan Reason: 1
ok it works, but LED's are very dim


http://www.ti.com/lit/ds/symlink/pcf8575c.pdf
http://www.ti.com/lit/ds/symlink/pcf8575.pdf
As far as I can tell the difference lies between the PCF8575 used in the demo and the PCF8575C which I'm using. Although I'm not exactly sure how to compensate for that difference just yet.
Quote
There is in fact a small difference in the schematic diagrams for PCF8575
and PCF8575C. The PCF8575C lacks the weak pull-up in the form of the 100 ?A
current source in the output I/Os. This is the reason that PCF8575's I/Os remain HIGH
after power-on and after being written HIGH. Without this current source, PCF8575C's
I/Os will be in high-impedance state after the initial strong pull-up transistor is OFF (it
is ON during the acknowledge phase)
quote from: http://www.electro-tech-online.com/general-electronics-chat/94967-i2c-pcf8574-pcf8575-i-o-expander-i-cant-drive-pin-output-high.htm and
Quote
• Difference between PCF8575 and PCF8575C are:
- No internal I/O current source (open-drain)
- TTL input levels
from http://ics.nxp.com/support/documents/interface/pdf/an469.pdf
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

lucadentella

Hello!

So at the moment you can turn on the leds, even if they are very dim?
Did you connect them in "sink" mode (5v -> LED -> PCF8575 pin)? PCF8575 in source mode can't provide enough current...
thanks
lucadentella.it

Pitchoilcan

#5
Apr 11, 2012, 02:34 pm Last Edit: Apr 12, 2012, 05:16 pm by Pitchoilcan Reason: 1
Here's my wiring. LEDs flicker very dimly you almost can't even tell they're on at all.  
(as wired lucadentella's demo)  Think my next step is to add resistors to each i/o.



Here SDA and SCL are connected to Vcc via pullup resistors however all LEds remain HIGH, static not in sequence
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

lucadentella

Hi

(sorry I was away for my job): did you resolve your problem?
lucadentella.it

Go Up