[solved] Output power of PCF8574N

Hello!

I am working on a small project where I try to control two LED's from a output pin of an PCF8574N. For those of you who don't know, this is a I2C I/O port extender.

Iv'e got everything working except for the power of the LED's is very low. When I measure the output in line with the resistor and LED I get 0.07mA and the LED is very weak. It normally draws about 0.7mA.

It is not the voltage that is wrong, when I measure the output without any load it supplies +5V

Any one have any idea of what is wrong?

I've supplied my schematics, data sheet and the current code as well:

http://www.mouser.com/ds/2/405/pcf8574-556842.pdf

#include<Wire.h>

byte x=0;
byte y=0;

void setup()
{
    Wire.begin();
    //Serial.begin(9600);
}

void loop()
{
    Wire.requestFrom(0x22,1); 
    if(Wire.available())     //If the request is available
    {
        x=Wire.read();       //Receive the data
        Serial.println(x);
    }
    if(x<255)                     //If the data is less than 255
    {
        if (x==1) { y = 4; }; //P0
        if (x==2) { y = 8; }; //P1
        //if (x==247) { y = 8; }; //P3
        //if (x==251) { y = 4; }; //P2
    }
    
    Wire.beginTransmission(0x22);     //Begin the transmission to PCF8574
    Wire.write(y);                                //Send the data to PCF8574
    Wire.endTransmission();            //End the Transmission
    
}

Best regards
Kalf

I don't think your slave address is correct.
See 8.3.2 of the datasheet.
Looks like it should be 0b0100xxx0 with xxx matching the A2-A1-A0 pins, which you appear to pull low unless the SW2 pulls them high.
So 0x40, 0x42, 0x44, 0x48, etc. per 8.3.3 for writes to the part.

Actually the adress is correct, the wire.h library shifts every bit one step right. Therefore my slave adress is 0x22 instead of 0x44.

The library shifts like this because of the LSB determines if it should write or read to/from the specified adress.

The fault is somewhare else but I cant figure out where....

I solved the problem!

Well I found a solution on the forum. Link below.

The problem war that when using the ports as outputs, they are so called sinking output and this means that you should connect the load between positive power (typ +5v) and the IO-pin istead of the usual sourcing output where you connect the load between the IO-pin and ground.

The PCF8574 is capable of driving a small load (i think it is 0.1 mA) with the pins sourced. And this is because I only gotten 0.07 mA output.

Im sorry for my bad english, but I hope some one can gain something from my problem.

http://forum.arduino.cc/index.php?topic=19046.0

Best regards
Kalf