PCF8574 I2c port extender current sink always sinking proble

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I built a circuit using a PCF8574 I²c IO port extender to drive a transistor to switch relays. I used a current sinking scheme. So, output 1 = off, output 0 = on. The problem is, the relay always clicks on.

This is the schematic:

I measured the voltages and wrote them in (Irq should be Ir1). Vdd = 5V.

As you can see, there is 5.8V at the output of the PCF8574. I had expected there to be near 8V. If the output truly was high-impedance when 1, it would be, right?

I tested this circuit first by substituting an NPN transistor as an open-collector configuration and it worked fine.

What am I doing wrong here?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the port expander is powered from 5V, that will be enough to always keep the transistor on unless the output pins are compliant to 8V. Most CMOS is limited to around 0.3V above Vcc. Your whole circuit violates that. So, the output is about 1 diode drop above Vcc.

The drop across R1 shows that current is flowing into the base of Q1, keeping it on.

If you must use a high side switch, then add an NPN to drive the switch. Drive the NPN (with a base resistor) from the port expander. Connect the collector of the NPN to the junction of R1 and R2.

Problem solved.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, I don't get that. I thought the whole point of an open-drain setup is to be able to interface different voltages together, as long as you use a pull-up resistor like I do. The test circuit I made with the NPN transistor also had 5V and 8V, which worked fine.

I made PCF8574 circuits before, but then instead of sinking current, I sourced current from the PCF8574. But, max current is 500 µA, so I had to use a very high value resistor and a darlington setup. I was then advised to use a sinking setup with a pull-up resistor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you considered a low side FET switch? I believe that would solve the issues, though a 1 output would energize the relay.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess a FET would be a better idea, since it's voltage driven. 1 or 0 as 'on' would both be OK.

However, I already built two PCB's using this technique and I hope I can make a simple adjustment to this circuit to make it work. Plus, I'd like to understand it. An open-drain circuit isn't that hard, yet this baffles me.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You call it an open drain, are you referring to the PCF I/O? If so, and I just glanced at the data sheet so I might be incorrect, but it is a totem pole output with a stiff low and a 100ua high, not an open drain. Did I misread that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
An open-drain circuit isn't that hard, yet this baffles me.
Correct, but you have it back to front!

Use a NPN transistor (BC547 if you like) with the emitter to ground, the coil to +8V, add a reverse biased diode across the coil or the transitor WILL DIE after one or more switching actions because of back EMF, R2 to ground and maybe change R1 to 4K7 and all will work.

As you have it the emitter is at 8V, once the base is at 7.3V the transistor will turn on, as you have it at possibly 5V or maybe lower it will ALWAYS be on as Jim also explains above.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh whoops, I did get it all wrong, the output is not open drain. Only the INT is open drain. Will look at it in more detail tomorrow.

I do have a back-EMF diode on the relay BTW. This is a simplified circuit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Move R2 to the other side of R1 connection and it should work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Move R2 to the other side of R1 connection and it should work.

It worked, but I had to lower the 10k resistor to 1k.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You lucked out on this circuit.
The data sheet for the PCF8574 says that the maximum voltage you can apply to an output pin is Vcc +0.5, or 5.5V then down in the fine print it says you can exceed those voltage ratings, but only if the I/O clamp current is observed. (8V-5.5V)/(10K//47K) is 303uA. The clamp limit is 400uA.