Shop OBEX P1 Docs P2 Docs Learn Events
1 pin bi-color LED control help — Parallax Forums

1 pin bi-color LED control help

Bobb FwedBobb Fwed Posts: 1,119
edited 2010-08-26 09:47 in General Discussion
Designing fun little circuits is my new little obsession when I have free time. I have tried a couple times to make a circuit that controls a bi-color LED (3 states) with 1 IO without wasting a bunch of power. I have developed motor control circuits from this endeavor, but not a circuit suitable for an LED. Alas, I think I have found a circuit that I could deal with, it's only 5 transistors, 7 resistors, and 2 capacitors. According to SPICE, it uses 2.9mA while on (not including LED), and 1.7mA when off. It operates up to about 10KHz; above 5KHz there starts to be a small a drop in brightness, around 50KHz it is on less than 50%.

I have a problem: the circuit works great in SPICE, but when I breadboard it, I cannot get it to work correctly. I have quadruple checked the wiring, pulled it apart and rewired it again. What is supposed to happen is when the IO is input, the LED is off, when its high, the power flows one direction, and low, the other direction. What happens on the breadboard is when it is input it is off, and either low or high will work, but the other direction pulls about 70mA on my meter and the LED sometimes lights up about 20% but usually is just off. If you swap the PNP transistors on the breadboard the the polarity that works swaps directions.

So my question is, does anyone have an idea as to why? Up until now, I have never had SPICE show me anything significantly different than what a real circuit does, what is happening?

Attached I have the LTSpiceIV file.
Here is a video of operation of the breadboard. It was taken with my phone, the file can be viewed in quicktime. It may be a little hard to follow, but it basically demonstrates the description I have above.

attach.aspx?a=45115
I labeled it as 'IO Input' I meant 'IO Output'

April, 2008: when I discovered the answers to all my micro-computational-botherations!

Some of my objects:
MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!

Post Edited (Bobb Fwed) : 8/3/2010 5:06:53 PM GMT

Comments

  • TonyWaiteTonyWaite Posts: 219
    edited 2010-08-07 02:21
    Hi Bobb,

    I've been thinking about your circuit; there is a lot going on.

    My approach would be to divide the logic into two halves and then recombine when each half has been debugged.

    T o n y
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-08-25 15:03
    I was finally able to get back around to working on this. And it took me all of 5 minutes to solve, uhg.

    I moved the LED's currently limiting resistor and added another to better isolate the NPNs and PNPs, that didn't do anything. I then just tried different PNP transistors. Switched over to the 2N2907 and it worked great! Breadboard is happy and works exactly as expected (maybe I had a bad transistor in the last setup, but whatever).

    I optimized the resistors and got it to stably work between 2.5V and 6.1V. Wasting only 285µA @3.3V when off. I am pretty happy with this. My next proto PCB will have this (curious to see how small I can make it) on it so I can test it before going on to something more important.

    attachment.php?attachmentid=72737&stc=1&d=1282773822
    800 x 431 - 37K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-08-25 20:03
    Think... H-Bridge.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-08-26 09:47
    Yes, but do H-bridges have 1-IO interfaces? This is what I need. And if they do exist, where is the fun in that (but I do think I would have to use that on my final project for simplicity sake).

    Oh, and I got the whole thing with large SMT parts (so I can hand solder them), including the LED and a 3-pin header, into less than 0.7sq-in. So a streamlined version could probably be less than 0.5sq-in or using both sides of the board, who knows. I could probably get it to about the same size as a normal H-bridge DIP IC.
Sign In or Register to comment.