Maker Pro
Maker Pro

Driving red/green LED from high/low/tri-state output

J

Joel Kolstad

I have a battery charger IC that tells you the IC's function via a "staus" pin
output that's one of three states: Hi-Z when a battery isn't present or is too
hot or cold to charge, high when it's actively charging, and low when it's
finished charging. I'd like to convert this signal to drive two LEDs, red and
green (they're actually both in one package, but all 4 pins are accessible).
The idea being that Hi-Z=>off, high->red (charging), and low->green
(finished). What's the easiest way to do this? So far I haven't thought up
any easy schemes... and my first -- now obviously dumb -- approach of
connecting the pin to the two LEDs connected back to back -- with current
limiting resistors -- doesn't work in that a Hi-Z output just causes both LEDs
to glow dimly!

There's gotta be some really easy way to do this?

Thanks,
---Joel
 
J

Joel Kolstad

I think I know how to do this... just tie both ends of the LEDs together
(making a "2 pin" bi-color LED), drive one end from the status pin, the other
from a voltage divide formed by 2 resistors, nominally the same values for the
same current for both red and green, or somewhat different values to vary it.
 
R

Randy Day

Joel said:
I have a battery charger IC that tells you the IC's function via a "staus" pin
output that's one of three states: Hi-Z when a battery isn't present or is too
hot or cold to charge, high when it's actively charging, and low when it's
finished charging. I'd like to convert this signal to drive two LEDs, red and
green (they're actually both in one package, but all 4 pins are accessible).
The idea being that Hi-Z=>off, high->red (charging), and low->green
(finished). What's the easiest way to do this? So far I haven't thought up
any easy schemes... and my first -- now obviously dumb -- approach of
connecting the pin to the two LEDs connected back to back -- with current
limiting resistors -- doesn't work in that a Hi-Z output just causes both LEDs
to glow dimly!

There's gotta be some really easy way to do this?

Two more resistors and two transistors?

+v
|
V led +v
- |
| |
in | _R_ |<
--o------------|___|-|
| | |\
| .-. |
| | |R .-.
| | | | |R
| '-' | |
| | '-'
| _R_ |/ |
-|___|-| V led
|> -
| |
GND-------------

(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)
 
D

DJ Delorie

Alternate idea: Connect a resistor from the status line to each of gnd
and vcc. Use two comparators to compare this three-voltage state with
1/3vcc and 2/3vcc. This gives you two comparator outputs to work
with.

I'm doing this in my furnace controller, except in my case I'm using
it as a tri-state booster.
 
D

DJ Delorie

Randy Day said:
Two more resistors and two transistors?

I've tried this before. Base leakage current is sufficient to keep
both transistors on when tri-stated. I've even tried putting
resistors between the bases, like your drawing. Didn't seem to help;
high enough values to stop the leakage were too high to let the signal
activate the transistors.
 
R

Randy Day

DJ said:
I've tried this before. Base leakage current is sufficient to keep
both transistors on when tri-stated. I've even tried putting
resistors between the bases, like your drawing. Didn't seem to help;
high enough values to stop the leakage were too high to let the signal
activate the transistors.


Oops. Duh... <smacks forehead>
 
A

Anthony Fremont

Joel said:
I have a battery charger IC that tells you the IC's function via a
"staus" pin output that's one of three states: Hi-Z when a battery
isn't present or is too hot or cold to charge, high when it's
actively charging, and low when it's finished charging. I'd like to
convert this signal to drive two LEDs, red and green (they're
actually both in one package, but all 4 pins are accessible). The
idea being that Hi-Z=>off, high->red (charging), and low->green
(finished). What's the easiest way to do this? So far I haven't
thought up any easy schemes... and my first -- now obviously dumb --
approach of connecting the pin to the two LEDs connected back to back
-- with current limiting resistors -- doesn't work in that a Hi-Z
output just causes both LEDs to glow dimly!
There's gotta be some really easy way to do this?


Put your Leds anode to cathode, one end of the pair to the IC and the other
to the middle of a voltage divider made by two 500R resistors. It wastes
power all the time (5mA@5V) but then so do the LEDs. ;-)
 
C

Chris

I have a battery charger IC that tells you the IC's function via a "staus" pin
output that's one of three states: Hi-Z when a battery isn't present or is too
hot or cold to charge, high when it's actively charging, and low when it's
finished charging. I'd like to convert this signal to drive two LEDs, red and
green (they're actually both in one package, but all 4 pins are accessible).
The idea being that Hi-Z=>off, high->red (charging), and low->green
(finished). What's the easiest way to do this? So far I haven't thought up
any easy schemes... and my first -- now obviously dumb -- approach of
connecting the pin to the two LEDs connected back to back -- with current
limiting resistors -- doesn't work in that a Hi-Z output just causes both LEDs
to glow dimly!

There's gotta be some really easy way to do this?

Thanks,
---Joel

Hi, Joel. Assuming both the green and red LEDs have a forward voltage
drop of around 1.7V, and also assuming your tri-state output can
source or sink 8mA, you should be able to get what you want with this
fairly inelegant but workable solution (view in fixed font or M$
Notepad):

|
| VCC
| +
| |
| G V ~
| - ~
| |
| D V
| -
| |
| D V
| -
| |\ ___ |
| -| >O--|___|-o
| |/ 270 |
| D V
| -
|D = 1N4148 |
| D V
| -
| |
| R V ~
| - ~
| |
| ===
| GND
|
(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

The forward voltage drops of the two LEDs plus the four small signal
diodes will be at least 5.8V. If your supply voltage is 5V, that will
keep the LEDs from turning on when the output is tri-stated.

The 270 ohm resistor will lead to a little less than 8mA being driven
through only one of the LEDs when the logic gate is on. That should
be plenty for high intensity LEDs.

Make sure to look for red and green LEDs with similar typical forward
voltages. If the red is still brighter than the green, you may want
to place a small resistor in series with the red LED to balance.

Good luck
Chris
 
J

jasen

I have a battery charger IC that tells you the IC's function via a "staus" pin
output that's one of three states: Hi-Z when a battery isn't present or is too
hot or cold to charge, high when it's actively charging, and low when it's
finished charging. I'd like to convert this signal to drive two LEDs, red and
green (they're actually both in one package, but all 4 pins are accessible).
The idea being that Hi-Z=>off, high->red (charging), and low->green
(finished). What's the easiest way to do this?

So far I haven't thought up
any easy schemes... and my first -- now obviously dumb -- approach of
connecting the pin to the two LEDs connected back to back -- with current
limiting resistors -- doesn't work in that a Hi-Z output just causes both LEDs
to glow dimly!

you're so close to the answer....

.-------------------------------------------------------------.
| This is an ascii schematic, if the diagram appears garbled |
| try switching to a fixed-pitch font (courier works well) |
| pasting it into notepad works well on ms-windows. |
| or in google groups "view source" (found under options) |
`-------------------------------------------------------------'



green
LED
in ---+--|<----+--[RX]--- +v
| |
| |
+--->|---+--[RX]--- gnd
red
LED
 
J

Joel Kolstad

Thanks to everyone for their solutions; I've learned a lot. I am using the
approach that Jasen suggested, and it's working well. I have power to burn
here, but if I didn't, I think I'd go with Chris's solution. I'd have a hard
time convincing myself to use a comparator, although that seems like the
least-kludged approach.

I can see now why people sometimes use one of those 6 pin PICs or 8 pin AVRs
to do little more than flash an LED...!
 
J

JeffM

jasen said:
.-------------------------------------------------------------.
| This is an ascii schematic, if the diagram appears garbled |
| try switching to a fixed-pitch font (courier works well) |
| . . . . . . . notepad works . . . . . . . . . . . |
| or in google groups "view source" (found under options) |
`-------------------------------------------------------------'

That used to work.
http://groups.google.com/group/sci....ages.by.this.author+Show.original+view.source
"view source" is no longer available.

**Show original** still works.
 
J

Jonathan Kirwan

Thanks to everyone for their solutions; I've learned a lot. I am using the
approach that Jasen suggested, and it's working well. I have power to burn
here, but if I didn't, I think I'd go with Chris's solution. I'd have a hard
time convincing myself to use a comparator, although that seems like the
least-kludged approach.

I can see now why people sometimes use one of those 6 pin PICs or 8 pin AVRs
to do little more than flash an LED...!

One of the cheaper, at Digikey, is the PIC10F200. $1 in ones, half
that in 25's. You could even set it up to handle the three states
differently, on those two LEDs, say blinking the red when nothing is
in the charger, setting it solid red when charging, and green when
done. All with no additional parts if your voltage supply rail is in
range, except possibly the two current limit resistors -- which is
only a maybe, as the output drive may self-limit acceptably. Of
course, you need the means to program the thing. So there is a big
advantage to the discrete approach, if you don't have the tool setup
in place. Much easier to make such choices, if you are ready to go,
already.

Jon
 
J

Joel Kolstad

Jonathan Kirwan said:
One of the cheaper, at Digikey, is the PIC10F200. $1 in ones, half
that in 25's

Good point. For copmarison, ATTiny11's are $0.54/1, $0.41/25, $0.38/100 from
DigiKey. I'd imagine that if you're buying, say, 1,000? 10,000? Microchip will
happily compete with those prices, however. I also imagine that, in that sort
of quantities, you could get your favorite distributor to pre-program the
parts for you, which would be even better.

---Joel
 
J

Jonathan Kirwan

Good point. For copmarison, ATTiny11's are $0.54/1, $0.41/25, $0.38/100 from
DigiKey.

Yes. I haven't used the ATTiny11 yet or the PIC10F200, so I cannot
speak to either. I'd need to check the data sheets to see what
differences may be useful to know about (packaging, oscillator, power,
peripherals, etc.) But I note that the prices at 25-qty are quite
similar. Close enough to warrant a close datasheet look, I suppose,
if I get serious about buying one or the other for 'bubble gum' part
purposes. (I usually keep two processor types in tubes, around here,
for that and shift to new ones when the old stuff runs out.)
I'd imagine that if you're buying, say, 1,000? 10,000? Microchip will
happily compete with those prices, however. I also imagine that, in that sort
of quantities, you could get your favorite distributor to pre-program the
parts for you, which would be even better.

I can only hope my hobby interests ever rise to that level of
purchase. ;)

Jon
 
Top