O/I Expander wont fully switch transistor (pcf8574, tip120)

Hi,
I have 4 I/O expanders PCF8574P. I'm using them to switch TIP120 transistors, which controls pieces of 12V LED stripes (7-segment display). The wiring is: expander's pin>resistor ( RM 6k8 0204 0,185W 1%)>transistor. But some of the segments aren't so bright as the others. I thought I have something wrong in the PCB, but when I touch the DIP socket's pins with 5V wire, the segment goes fuly bright, so there must be a problem with I/O expander.
I tried measure voltage on it's pins, and instead of expected 5V on expander's outputs, there are 2.0-2.2V on pins which are to control bright segments, and on pins controling not fully lighted segments is only 1.3-1.8V. I bought set of 10 of them, so I tried the others, and I managed to change all the chips so all segments are fully bright, but I don't think this is the best solution.
What should I do? Should I contact the seller that he send me "broken" chips, or did I messed something? Are these resistors/transistor that I use the right one? Each of them controls just one piece (3 LEDs) of SMD5050 LED strip. It's deffinitelly not because of the power, I'm currently using computer power suply, up to 30A on 5V, up to 10A on 12V.
Thanks.

This is how some of the segment are switched

And this is the PCB, if you need to see it.

I would suggest a pull resistor to +5V on the outputs.

The PCF can only drive 30uA (Ioh min); I doubt that that is enough to get your TIP fully open. You can try to add a 1kOhm pullup resistor on the outputs of the PCF.

Note: my electronics knowledge is 15 years old so I might be totally wrong.

//Edit: seems somebody agreed while I was typing so my knowledge might not be that rusty :wink:

I tried measure voltage on it's pins, and instead of expected 5V on expander's outputs,

Why did you expect that?
Read the data sheet, these things do not source current they sink it.

Please post a schematic of what you have. Photos of bunches of wires are useless. Could you make anything from that photo?

If you touch the base of the TIP120 to 5V directly you'll fry it. I hope you have series resistors
in place to prevent this.

It's amazing how many newbees are unaware of the SOURCE/SINK issue.

Grumpy_Mike:
Why did you expect that?
Read the data sheet, these things do not source current they sink it.

Please post a schematic of what you have. Photos of bunches of wires are useless. Could you make anything from that photo?

It runs on 5V, so I expected it to work with 5V output.
The yellow connections are the (purple,gray,white,black) wires for IIC on PCB.

MarkT:
If you touch the base of the TIP120 to 5V directly you'll fry it. I hope you have series resistors
in place to prevent this.

Of course I have resistors.

sterretje:
The PCF can only drive 30uA (Ioh min); I doubt that that is enough to get your TIP fully open. You can try to add a 1kOhm pullup resistor on the outputs of the PCF.

Note: my electronics knowledge is 15 years old so I might be totally wrong.

//Edit: seems somebody agreed while I was typing so my knowledge might not be that rusty :wink:

My electronics knowledge isn't so good, what is the difference between "normal" resistor and pullup?

I'm not "Grumpy Mike" but I I have my moments.
I don't know what you consider "normal" but a " pullup " resistor goes from a GPIO pin to +5V.
Can yiu guess how a "pullDOWN" resistor is connected ?

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

You must be able to export a jpg or png image of your schematic, not the PCB pattern that you have supplied.

Tom.... :slight_smile:

parmanik:
My electronics knowledge isn't so good, what is the difference between "normal" resistor and pullup?

Connect 1k resistors between 5V and each output of the PCF; leave your existing resistors in place.

It runs on 5V, so I expected it to work with 5V output.

Well a read of the data sheet shows your expectations are wrong.
It says.

A quasi-bidirectional I/O can be used as an input or output without the use of a control signal for data direction
(see Fig.15). At power-on the I/Os are HIGH. In this mode only a current source to VDD is active. An additional strong pull-up to VDD allows fast rising edges into heavily loaded outputs. These devices turn on when an output is written HIGH, and are switched off by the negative edge of SCL. The I/Os should be HIGH before being used as inputs.

The DC characteristics say:-

That means the maximum current you can hope to get from a high output pin is 300uA and it could be as low as 30uA. So you are surprised when you measure a voltage sag.

As you have been repeatedly told you need a pull up resistor on the outputs if you want to turn on your transistor.

FYI,
"strong pullup" means 1k ohm to you.

sterretje:
Connect 1k resistors between 5V and each output of the PCF; leave your existing resistors in place.

Wow, I thought that if I add resistor to output, there will be, even if lowered, some power, which will switch the transistor. So, there is still power, but because of the resistor it won't switch the transistor, and to switch it, I don't need so much power from the IO expander, because there is some from this resistor, right?

TomGeorge:
Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

You must be able to export a jpg or png image of your schematic, not the PCB pattern that you have supplied.

Tom.... :slight_smile:

Of course I can export chematic, but... Have you ever worked in fritzing? You create nice circuit in PCB card, but in breadboard and schematics, there is bunch of parts at one place. I was first trying to make it look nice, but then I give up. And here, you even don't need the schematics, if you look at the bigger PCB, there are four big parts with many pins - I/O expander. Also, there are few part with 4 pins - just a header. 3 pins - transistor, you can recognize resistor, and the small 2 pins parts next to transistors are headers for segments.
But if you want schematics... :smiley: The second PCB is just ATmega328p with headers, not important.

The datasheet does do a lousy job in making that clear, imo.

As far as I can tell, it looks like the PCF8574 has open drain outputs with a very weak internal pullup, so that while they can sink 10~30mA (if you're driving the pin low), but can only source 30~300uA (if you're driving the pin high).

Since a transistor is controlled by current, not voltage, in order to turn on the transistor, you need to be able to supply enough current to the base of that transistor. The PCF8574 can't source enough current to turn on the transistor all the way, so the voltage sags.

If you were using fets, which are voltage controlled, this would work (though the switching time might be a little slow, due to the gate charge on the fet).

So, there are a few solutions:

Band-aid: Use pullups, and the same port expander. These go right after the port expander (before the series resistor). When the pins are driven low, the pin will be at ~0v, because those port expanders are real good at sinking current. When the pin is not driven low, the pin will be pulled up by the 1k resistor - so the transistor will see a 1k resistor in series with it's base resistor - so in those examples, it would be seeing a 1.2k resistor from base to Vcc when the port expander writes the pins high. You'll need to look at the datasheet for the transistors and see whether that will provide enough base current to keep the transistor in saturation

Use different port expander: Swap the port expanders for the pin compatible PCA9554. These have real push-pull outputs.

Use fets instead of BJTs: If you use fets, you don't need to supply the ongoing current to the transistor like you do with a BJT. They will probably turn on a bit slowly (rise time will be slow, on the scale of a few milliseconds, but you're not trying to PWM anything, and the load isn't so large that you need to worry about what happens to the fet while it's switching.

Re: schematic - I hope the part with the '328p is not done - you're missing a decoupling cap on AVcc, and the loading caps on the crystal. And the port expanders ought to have a 0.1uf decoupling cap next to each one too, for good measure.

Hi,
No, sorry, that is not a schematic and it is a poor screen save and it is fritzty.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

The image you have supplied is not readable as logical arrangement of symbols indicating the connections of your circuit.

May I suggest you forget fritzty, the state that it allows you to layout your "schematic" shows how terrible it is.

Sorry but a lot of people get caught like you do with this program.

Try ExpressPCB, it is excellent, however it does not produce a Gerber file for PCB production.
Eagle is another package, but a lot of work for simple schematics and too many adjustable parameters.

Try a hand drawn diag please.

Thanks. Tom..... :slight_smile:
PS. Good project and good attempt at fixing its bugs by the way. 8)

, because there is some from this resistor, right?

No not from it, through it.

Because the chip has a bidirectional I/O pin you do not have to set a data direction register to say if it is an input or output.

It will sink 30mA and source about 300uA. Normally grownups power things by sinking current, however the Arduino folk seem to encourage powering by current sourcing. This is fine on the ATmega processors, but the whole world is not like that.

It needs the very weak pull up to act as an input so it can be pulled down by an other chips output.

Oranges are not the only fruit.

NO Fritzings please

TomGeorge:
Hi,
No, sorry, that is not a schematic and it is a poor screen save and it is fritzty.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

The image you have supplied is not readable as logical arrangement of symbols indicating the connections of your circuit.

May I suggest you forget fritzty, the state that it allows you to layout your "schematic" shows how terrible it is.

Sorry but a lot of people get caught like you do with this program.

Try ExpressPCB, it is excellent, however it does not produce a Gerber file for PCB production.
Eagle is another package, but a lot of work for simple schematics and too many adjustable parameters.

Try a hand drawn diag please.

Thanks. Tom..... :slight_smile:
PS. Good project and good attempt at fixing its bugs by the way. 8)

If you mean the last image I post, it is schematics, but not complete. Even if you would have the full quality, it won't help you, simply because I don't have any full schematics. Everything is in the PCB drawing. I'm not making any schematics, I'm only using fritzing to create the PCB, the schematics is generated and it's very bad.

In other words, "sourcing" is generally a Newbee's approach to everything. You need to "graduste" to the "grownups" world of "sinking". There you will find the sky's the limit.

In other words, "sourcing" is generally a Newbee's approach to everything. You need to "graduste" to the "grownups" world of "sinking". There you will find the sky's the limit.
There are exceptions but your post is not one of them. You could use a PNP "high side" transistor to drive the TIP120.