1
\$\begingroup\$

I'm working on the next revision of a prototype PCB board, and from the first one I learned that LEDs would be very helpful instead of having to probe each pin/wire for a certain state.

In this regard I have a design question; how would you add LEDs for debugging purposes to a PCB, such that they don't interfere with or alter the voltages and currents, and still keep the added components to a bare minimum.

As of right now my thought is placing a MOSFET gate on the wires in question, and then let that control the LED. But I'd like to know how you would do it, as I am no expert in electronics and always looking to learn from more experienced people.

UPDATES:

· The signals being debugged are, of course, digital in nature.

· The LED's in question are going to be SMD, of course.

· If you have schematic examples that makes it so much easier to understand :D

— Thanks in advance :)

\$\endgroup\$
  • \$\begingroup\$ In general you should not add an LED to "every" signal. Sure you can pick a few important ones and add a LED to these. Indeed an LED, series resistor and MOSFET is what is generally used. ...keep the added components to a bare minimum. Then don't add any LEDs but add probing points so that probing is at least easy. Also note that for fast digital signals, an LED doesn't help much, you would still need a logic analyzer. \$\endgroup\$ – Bimpelrekkie Dec 28 '18 at 21:45
  • \$\begingroup\$ Of course not to every signal — that would be cumbersome :P Ah, yes, probing points would actually make very good sense. There's a Saleae logic analyser on its way to me, so yeah, it would make sense to plan for its use as well! Good point. \$\endgroup\$ – Casper B. Hansen Dec 28 '18 at 21:54
  • \$\begingroup\$ What are the Voh and Vol of the signals that you are monitoring? What voltage rails are available to power the LEDs when you are buffering them with a transistor/MOSFET? \$\endgroup\$ – crj11 Dec 28 '18 at 22:45
  • \$\begingroup\$ Keep in mind that if necessary you could likely build yourself a "hat" board to place over the board you are testing so that LEDs need not be incorporated into the design of that board. If you want to test a run of multiple boards this could come in handy. You can use through hole pogo pins for the legs that actually contact the other board. It would cost more, but mess with the original design less, and if you wanted you could incorporate a very high input impedance driver for the LED(s). \$\endgroup\$ – K H Dec 29 '18 at 1:47
  • \$\begingroup\$ @cr11 They are primarily CMOS. It is still not set in stone, but I try to stay in the CMOS world :) Supply is 5V. \$\endgroup\$ – Casper B. Hansen Dec 29 '18 at 9:15
2
\$\begingroup\$

The question is a bit general to be able to answer very well, but it isn't a bad one, in fact. I can make some suggestions.

First off it depends where I am in the design cycle. Early prototypes typically get more debug LEDs. Many might get removed as the design progresses.

Every power rail usually gets its own indicator LED. For these I typically use a LED with a series resistor and a zener, so that even if the rail is low the LED dies. For instance, on a 12V rail I would use something like a 9V1 zener and 470R with the LED.

For the rest it depends rather heavily on the type of circuit. Anything with a microcontroller usually has a LED to show the device is running, and i will often add a few unassigned LEDs if there are IO pins to spare.

I don't usually put debug LEDs on actual digital or analogue signals, unless they really say something very useful about the circuit state, or they are there for the user anyway (for instance a "SIG" or "OVERLOAD" led in an audio chain). For these I usually prefer test points.

As a general guideline, you need at least 1 or 2mA for a LED to be visible, and of course the effect of loading needs to be taken into account. As you say, a transistor could be added if needed. At this point though, I would ask myself how necessary this is.

Hope that helps.

\$\endgroup\$
  • \$\begingroup\$ Power rails get LEDs (even if I have to work for it a bit, like say a 0.95V rail for a FPGA core), well worth the pain. If I have a few spare pins on a processor or FPGA they get leds (AND testpoints) which I can then use to watch whatever is interesting, for all else, test points rule (SPI and I2C are especially worth having a way to probe). Remember to add some scattering of 'ground' test points so you can keep the loops small when probing. For fast things a 450R resistor to a MMCX socket or such lets you get good integrity by using a 50R patch cable and the 50R setting on the 'scope. \$\endgroup\$ – Dan Mills Dec 28 '18 at 23:19
  • \$\begingroup\$ For the purposes of multiple LEDs, I guess a CMOS buffer IC like 74HCT241 would do great, and for single LEDs, to decouple one could use 74LVC1G125. For the LVC-family are there any special considerations, or do they play well with CMOS ins- and outs directly? \$\endgroup\$ – Casper B. Hansen Dec 30 '18 at 9:15
1
\$\begingroup\$

Where to start?.. I'll start from this line:

...and still keep the added components to a bare minimum.

The bare minimum doesn't include LEDs for helping the designer1 debug.
What a designer to do instead?

  • Add test points for the oscilloscope [if you don't have access to an oscilloscope of some kind, get it]. You can kludge-wire temporary LEDs to the test points, if you want to.

  • Output the state of your program on a serial terminal, or a debugger, or radio, etc. You can can get more information that way than with LEDs.

  • Add a small number of thought-out LEDs which reflect the state of your system. I usually add at least three: power/status, activity, fault. These are controlled from the software, and they have their own dedicated pins.

LEDs are useful only for slowly changing signals. If you have 8 bytes arriving on a serial RX line at 19.2kbaud, you will not see it with an LED. Too brief for a human eye to spot.

If strategically placed LEDs help your users debug, those are different situations. For example, you device is controlling an external relay, and the user provides a relay and wires it to your device. It makes sense to provide an LED which lights up when your device activates the relay. If the relay doesn't activate when the user expects it, he can tell (at least to some degree) if the cause is in the relay, or in your device.

\$\endgroup\$
0
\$\begingroup\$

For a State machine that changes slowly use 2mA LED current on any <=5V logic family with the series R to determine the voltage drop and current.

This can be hardware states or unused points with breakpoints assigned to send some code pattern to an LED port.

The LED debug mode could also be disabled by design if using battery power after debug, using a 0.1" 2 pin disable jumper clip that you can pull for gnd return for all LEDs.

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.