PDA

View Full Version : Driving two leds from one pin



ErNa
05-29-2010, 05:35 PM
Hello, I wanted to have two leds, but only had one free pin. So I connected the leds in serial, but took care, the operating voltage is <=3.3V. The output pin is connected via a resistor to the center tab of the diodes. Whenever the pin is tristated, no current flows, when active high, the lower diode is lit, when active low, the upper one. Works quite well.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext (http://cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext)
Hello Rest Of The World
Hello Debris
Install a propeller and blow them away http://forums.parallax.com/images/smilies/wink.gif

Post Edited (ErNa) : 5/29/2010 6:37:24 PM GMT

Andrey Demenev
05-29-2010, 06:22 PM
I've been using this scheme with bi-color led and PWM - changing duty cycle changes color from red through yellow to green

Rayman
05-29-2010, 07:18 PM
Brilliant!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm

Bill Henning
05-29-2010, 08:04 PM
I've used the same trick to make diy dirt-cheap logic probe in the past :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) E-mail: mikronauts _at_ gmail _dot_ com
My products: Morpheus (http://mikronauts.com/products/morpheus/) / Mem+ (http://mikronauts.com/products/morpheus/memplus/) / PropCade (http://forums.parallax.com/showthread.php?p=894725) / FlexMem (http://forums.parallax.com/showthread.php?p=894853) / VMCOG (http://forums.parallax.com/showthread.php?p=878382) / Propteus (http://mikronauts.com/products/propteus/) / Proteus (http://mikronauts.com/products/proteus/) / SerPlug (http://mikronauts.com/products/serplug/)
and 6.250MHz Crystals to run Propellers at 100MHz (http://mikronauts.com/products/mikronauts-625mhz-crystal/) & 5.0" OEM TFT VGA LCD modules (http://forums.parallax.com/showthread.php?p=852195)
Las (http://mikronauts.com/software-products/largos/) - Large model assembler Largos (http://mikronauts.com/software-products/largos/) - upcoming nano operating system

Miner_with_a_PIC
05-29-2010, 09:22 PM
ErNa, the same scheme can be used on two outputs driving a piezoelectric element. In this configuration you get much more volume as you can send one line high while sending the other low and visa versa cyclically. You are essentially making a low current H-bridge that doubles the voltage swing (i.e. piezo sees +-3.3V rather than just 0 or +3.3V).

ErNa
05-29-2010, 10:01 PM
Yes, thats right and as a piezo seem to be a cap, you can use it in instead of the resistor (maybe) to have enlightening and sound http://forums.parallax.com/images/smilies/wink.gif . It is also possible to drive the beepers from a motherboard, but take care of flyback voltages. Also it is possible to drive leds and read buttons in a matrix from a minimal number of pins. We should make a box, where this info is collected, could be in OBEX

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext (http://cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext)
Hello Rest Of The World
Hello Debris
Install a propeller and blow them away http://forums.parallax.com/images/smilies/wink.gif

ElectricAye
05-29-2010, 10:22 PM
Hey, that's cool. I might need that ability this week. Thanks for the tip!

Phil Pilgrim (PhiPi)
05-29-2010, 11:52 PM
That's really neat! It's the Prop's 3.3V Vdd that makes it possible. 'Wouldn't work at 5V with any but blue or white LEDs.

-Phil

Rayman
05-30-2010, 12:09 AM
Is there any concern about raising the Vdd rail voltage due to the drop by the protection diodes?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm

10gigbill
05-30-2010, 12:28 AM
Dose anyone know of a multi pin, totem-pole driver chip that could be used
In this manor to drive higher current/voltage LED’s ?

Phil Pilgrim (PhiPi)
05-30-2010, 12:33 AM
'Missed the ">3.3V" part, and I'm mystified why that's necessary. It seems that it would work better with a 3.3V supply

-Phil.

ErNa
05-30-2010, 01:38 AM
Oh, was mistyped! It is just, that the forward voltage of both diodes is less than the supply to have no current when center is not pulled or pushed. Otherwise, a diode in series adds another .7V, if necessary

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext (http://cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext)
Hello Rest Of The World
Hello Debris
Install a propeller and blow them away http://forums.parallax.com/images/smilies/wink.gif

Peter Jakacki
05-30-2010, 05:16 AM
I couldn't see your link but I only just the other day combined 6 sets of leds this way though I am sure I have done this before as it seems logical. I used a red and a green in series and at 3.3V there was only a bit of leakage current flowing which means that the leds just glow slightly. In the end I put this on to a PIC running at 3.3V off the I2C bus.

EDIT: attached a schematic of what I mean

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

Post Edited (Peter Jakacki) : 5/29/2010 10:33:38 PM GMT

Beau Schwabe (Parallax)
05-30-2010, 09:00 AM
This article was published in April of 2002 ...

electronicdesign.com/article/digital/circuit-controls-two-leds-with-one-microcontroller.aspx (http://electronicdesign.com/article/digital/circuit-controls-two-leds-with-one-microcontroller.aspx)

... and I know for sure this has come up in the forums more than a few times even before then.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Peter Jakacki
05-30-2010, 04:02 PM
ErNa said...
Yes, thats right and as a piezo seem to be a cap, you can use it in instead of the resistor (maybe) to have enlightening and sound http://forums.parallax.com/images/smilies/wink.gif . It is also possible to drive the beepers from a motherboard, but take care of flyback voltages. Also it is possible to drive leds and read buttons in a matrix from a minimal number of pins. We should make a box, where this info is collected, could be in OBEX


The scheme that Miner mentioned involves two pins to drive one piezo whereas this whole thread is about driving two leds with one pin so it should really be another thread. However, the two pin method is very common for capacitive loads such as piezo elements (not active piezo buzzers). Typically piezos need a bit of drive voltage and because of the capacitance should really be driven in push-pull configuration which is what you get when you use two I/O pins in full-bridge configuration.

As to driving leds and sensing buttons in a matrix with a "minimum" of pins you should look to the charlieplexing threads, start around here:
http://forums.parallax.com/showthread.php?p=696424

About the information OBEX I agree, I did look into this a while ago but we need some more input as to how to set it up. I'm thinking of just setting up a Yahoo group just to collect this information but I don't want to shift any forum discussion away from here though, so it requires a bit of thought as to how to do it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

Rayman
05-31-2010, 12:06 AM
I'm sure this idea has been used for a long time...· But, here's why it's better with a Prop:

1.· Tristate outputs:· Both LEDs can be off.

2.· 40 mA per pin source/sink:· Both LEDs can be driven at their usual 20 mA average current limit.

3.· Multicore:· Can easily use a spare cog to have 256 or more brightness levels for each LED.·



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm

Peter Jakacki
05-31-2010, 05:25 AM
Rayman, I have to take exception to the 40mA per pin because even though you can do it you must remember that it is the ABSOLUTE MAXIMUM RATINGS and that means that this is not the maximum operating ratings. There is ABSOLUTELY no margin for error here and any manufacturer does not guarantee their devices if you are trying to operate at the AMR. This is the rider that Parallax uses:

8.1. Absolute Maximum Ratings
Stresses in excess of the absolute maximum ratings can cause permanent damage to the device. These are absolute stress
ratings only. Functional operation of the device is not implied at these or any other conditions in excess of those given in the
remainder of Section 7.0. Exposure to absolute maximum ratings for extended periods can adversely affect device reliability.

Bear in mind too while we are talking about AMRs (for the sake of a better abbreviation) that the Prop has a AMR of 300mA through the Vss and Vdd connection (as one). As the maximum operating current of all 8 cogs at 80MHz is around 100ma then this does not leave 200ma to play with as 300ma is the AMR remember so I wouldn't push more than say 160ma through all the I/O combined.

In general it is best not to bandy about any AMR figures as if they were operating conditions.

Also, the other exception I take to is quoting the average current limit of LEDs as 20ma!! Unless I am trying to blind the operator I usually operate in the more sedate but exceedingly bright range of a few mAs. I know that there are D grade LEDs left over from the 70's that might need 20mAs just to glow but they are the exception.

I'm a bit curious as to your first statement though, aren't all processor I/Os tristateable (except for some 8051 variants etc)?

Other than "that" http://forums.parallax.com/images/smilies/smile.gif I concur with your statements.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

Rayman
05-31-2010, 06:16 AM
Sadly, I'm not very familiar with very many other processors...

But, I have to agree it's best to stay below AMR...

My main point is that the Prop can drive much higher currents than a couple other chips I've looked at...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm

ErNa
05-31-2010, 12:58 PM
There is a word "sufficient". What makes a solution working is just: have plenty of options and take what is needed. Sometimes an old technology is reanimated by new hardware. Some are just forgotten. And then: "reinvented". I never had more than since I use the propeller!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext (http://cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_ 5511&partName=htmltext)
Hello Rest Of The World
Hello Debris
Install a propeller and blow them away http://forums.parallax.com/images/smilies/wink.gif

markaeric
06-01-2010, 01:03 AM
10gigbill,

You can check out the quad half-H driver parallax carries (http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/catpageindex/3/Level/a/ProductID/608/Default.aspx).