Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

3 states one pin.png
 
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.
 
One tricky aspect to this is with todays LEDs many capable of glowing with uA
of current. So, for example, when output goes low, the current x Rdson of the
lower fet in the output stage has to be very close to ground in order to keep
the ground referenced LED fully off.

So just a design consideration..... Iol x Rdson = Vol as close to 0 as possible.
 
You could use something like the ws2812 and have as many debug indicators (in any color) that you want.

That's a possibility – the downside is you need a certain amount of functionality to light up a neopixel. So not so functional for verifying clock rate and so on.
 
There is a gotcha to this idea I realized, after wasting half a day troubleshooting....

This circuit will tell you if a port pin is high or low. You can flash an LED to determine clock speed or signal some status. You can check if a UART pin is boggling. I suggest using 1k resistors or greater, which will provide plenty of brightness with modern LEDs.

What you can't do with this circuit is check the level of a signal that is only pulled high by a resistor, such as I2C SDA and SCL lines. A 4.7k resistor pulling up doesn't stand a chance against an LED and 1k or less resistor pulling down.

Wish I'd thought of this before soldering a board with 16 LEDs and resistors together.

Yeah, I know some people here have never made a bone-head mistake... well, at least that they'd publicly admit.
 
Like this you mean?

Oh sorry I must have missed that somehow. I must have read over it too fast.

So if it was pulsed at 50 percent duty cycle, each LED should be as bright as 1/2 of it's total brightness with those resistor values. If the brightness does not look equal (if you needed that) then change the duty cycle.
If the brightness is not enough then if you can decrease the resistor values that would help, as long as the port pin can handle the current.

Reminds me of "Charlieplexing".
 

Latest threads

Back
Top