LED logic - switching LED's from sperate circuits

Discussion in 'General Electronics Chat' started by doby, Mar 23, 2016.

  1. doby

    Thread Starter Active Member

    Aug 17, 2011
    43
    0
    I'm building a circuit incorporating 2 li-ion charge circuits based on the TP4056.

    The TP4056 has a charge pin to illuminate an LED when the cell is being charged and a standby pin to illuminate an LED when charging is complete.

    As I'm essentially merging the two circuits into one board I only want one set of LED indicators so I need some logic on the pins of each chip, I believe this can be done with transistors.

    The method will be slightly different for each because the charge LED should only turn off after current has stopped flowing through both charge pins in each circuit and the standby LED should only turn on once current is flowing through both standby pins.

    Any help appreciated :)
     
    Last edited: Mar 23, 2016
  2. doby

    Thread Starter Active Member

    Aug 17, 2011
    43
    0
    So I've had a go and I'd like someone to confirm if it's correct (pic attached).

    I figured the charge LED (D1) will be kept on by simply connecting the two charge pins from each IC together. For the standby LED (D2) I've used NPN transistors to control the flow of current through the standby LED and it should only light up when the standby pin on each IC is allowing current to flow.

    Now I need to calculate the resistors. I've done a fair amount of research on the base transistor resistors and *think* I know what to do. I'm a little unsure about the resistors used in series with the LED's in the orginial circuit though because it used a 1K resistor. Considering a single LED only requires around 150ohms for 5V input there's an 850ohm difference which I presume is to further resist current to the IC pins?? Can anyone elaborate?
     
  3. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    You're not there yet. The charge side should be ok, but the standby side isn't.

    The plan is to have one STBY output pull the LED cathode to GND, and the other STBY output turn on a high-side switch.

    Delete Q2.
    Connect U2 STBY directly to D2 Cathode.
    Change Q1 to a PNP transistor.
    Emitter to +5 V.
    Base to U1 STBY through a resistor, 1 K to 4.7 K.
    Collector to D2 anode through a resistor. R = E / I = e V / diode current. For example, with a 300 ohm resistor the diode current would be 10 mA.

    ak
     
  4. doby

    Thread Starter Active Member

    Aug 17, 2011
    43
    0
    Thanks, I'll give it a go.
     
  5. doby

    Thread Starter Active Member

    Aug 17, 2011
    43
    0
    I've implemented a PNP transistor (http://www.farnell.com/datasheets/490737.pdf) but the LED isn't particularly bright. I figured by swapping out different resistors for the base and LED series resistor I could get it to a satisfactory brightness through trial and error but it wont go any brighter no matter what I do. I've even taken out both resistors and still no perceivable change. I'm getting a max of around 4.5mA through the LED.

    I'm at a disadvantage because I don't really understand the standby pin on the TP4056 chip. The data sheet states the standby LED will light when the standby pin is pulled low by an internal switch, otherwise the pin is in high impedance state. So in the case with the transistor, it'll allow current to flow from the emitter to base which consequently allows current to flow to the LED via the collector. What I don't know though is how much current the pin will allow to flow when in a low impendence state. If it does restrict the current it would explain the maxing out, perhaps a higher gain transistor would be the answer?

    On the example schematic from the TP4056 datasheet it suggests a 1kohm resistor to be in series with the LED. Assuming the voltage is 5V and the voltage drop across the LED is 2V the current flowing through it would be about 3mA which seems too low so I don't know if there's anything else going on here?

    I'm really quite stuck.
     
    Last edited: Apr 29, 2016
  6. eetech00

    Active Member

    Jun 8, 2013
    652
    112
    Hi

    Is this what you mean?

    The output of each chip is either low or high impedance. So added pull up resistors to each output.
    Both outputs of each chip have to be in high impedance state for each LED to be off.
     
  7. doby

    Thread Starter Active Member

    Aug 17, 2011
    43
    0
    Would it really be that simple?? I really need a crash course in circuitry design! Annoyingly I've already ordered higher gain transistors to try and get the original solution working but I'll try this if I have no luck. Thanks.
     
  8. eetech00

    Active Member

    Jun 8, 2013
    652
    112
    It says on the data sheet the outputs are "open drain" which is analogous to a BJT open collector output.
     
  9. doby

    Thread Starter Active Member

    Aug 17, 2011
    43
    0
    So this doesn't work for what I need. Whereas it works for the charge LED which remains on until both charge pins are in high impendence, I want the standby LED to illuminate only when both standby pins are in low impendence. Otherwise you have a case where the charge and standby LEDs are illuminated at the same time depending on the charge completion of each chip.

    Thinking about the PNP switch again and I've discovered the open drain on the standby and charge pins has and internal resistance of roughly 1kohm to ground when in a low impendence state which explains why I could connect the base to it without a resistor and still have a functioning transistor. But this also obviously limits the LED's current which is why it only receives 4.5mA max.

    Just to recap, I've got one standby pin acting as the trigger for the transistor to feed current to the LED and the other standby pin connected to the cathode of the LED. So in essence it can only illuminate once both pins are low impendence.

    How can I go about bumping up the current for the LED?

    Edit: I'm just going to switch both standby pins with transistors so I can control the LED current.
     
    Last edited: May 7, 2016
  10. eetech00

    Active Member

    Jun 8, 2013
    652
    112
    HI

    You can use transistor as a switch to drive the LED. Basically, if active low input, use PNP.
    if active high input, use NPN.

    Is it important to know via the LED's which device is currently active?
    If so, with only two leds, how?

    Also, its unclear from the data sheet if the stdby and chrg pins are ever both active at the same time. I'm assuming they are mutually exclusive(?)

    And...are you switching the battery BAT/TEMP pins between the two chargers?
     
    Last edited: May 7, 2016
  11. hp1729

    Well-Known Member

    Nov 23, 2015
    1,964
    219
    This?
     
  12. eetech00

    Active Member

    Jun 8, 2013
    652
    112
    I think this will do what you want.
     
Loading...