When You Forget an LED......

For The Popcorn

Well-Known Member
Most Helpful Member
In my haste to get my vending machine control board fabricated and assembled before the tariffs hit, I made a rookie mistake and forgot to include an LED on the board. As you may well be aware, an LED on a board is handy, particularly when working with an unfamiliar micro. As luck would have it, I'm off to a rocky start with this PIC18F56Q83, which I need for its CANBUS controller.

Fortunately, I have a spare 3-pin header (installed with a lock footprint - see my previous post) with +5V, ground and one port pin. That gives me one LED..... but wait, it can actually provide three different indications. Two LEDs + series resistors are wired up as shown in the diagram below. One LED is full on when the port pin is high. The other LED is on when the port pin is low. But if the port pin is set as in input, both LEDs and their resistors are connected in series between +5 and ground, resulting in both LEDs being dimly illuminated.

This idea may come in handy if you only have one port pin to spare and you want to indicate a couple conditions. Toggling the port pin with different duty cycles can indicate additional conditions.

As usual, this is just a suggestion. I hope you may find it useful at some point.

 
If you added a diode in series with one or other LED, and a bleed resistor in parallel with each LED, you could make the input state be off on both LEDs.
 
Someone tell him he might also be able to pulse the microcontroller pin. Using 50 percent duty cycle or whatever is needed to get the desired brightness on both the red and the green.

Pulsing at 50 percent probably will not make them both the same brightness because the efficacy of each LED probably varies. Pulsing at say 1 percent would only light the upper led, while 99 percent would only light the lower LED. Anything in between will make one LED brighter and one dimmer.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…