2
\$\begingroup\$

enter image description here

I've had a PCB manufactured, which is doing a whole bunch of things, all working flawlessly, using EEPROM, MAX232, Voltage Conversion etc etc.

Part of the circuit is supposed to use a 2N2222 as a switch for a low current 24v output, it is also supposed to have an indicator LED to show when this is active. I can't seem to light the LED and power the transistor at the same time (Both work fine independently) I've tried many combinations of resistor values/jumpers.

Can anyone suggest a way to solve the problem without changing the design such that new PCBs need to be manufactured? (Bodge wires totally fine though)

It's a 'standard' 3mm red LED

Output voltage from GPIO pin is 3V3

Output current from GPIO is around 50mA

\$\endgroup\$
  • 1
    \$\begingroup\$ Can you add any information on resistor values? \$\endgroup\$ – Radiohead Apr 12 '18 at 12:46
  • 7
    \$\begingroup\$ Connect the LED resistor to GPIO not the base (which limits the LED voltage to Vbe or about 0.7V). Led R should be a few hundred ohms, base resistor maybe a little higher (few K at most) \$\endgroup\$ – Brian Drummond Apr 12 '18 at 12:49
  • \$\begingroup\$ As Andy says below, there is no way it could work in prototype mode. Red LEDs need 1.8V minimum, but BE will have a max of 0.7V when on. \$\endgroup\$ – StainlessSteelRat Apr 12 '18 at 13:25
9
\$\begingroup\$

The base / emitter junction is a forward biased diode and therefore from base to ground you will see about 0.7 volts when the GPIO is activated. This isn't enough to light your LED (typically 1.8 volts and upwards is what is needed).

Connect the resistor and LED directly to the GPIO line and 0 volts.

\$\endgroup\$
  • 2
    \$\begingroup\$ When you've stared at something for too long, you miss the glaringly obvious! Thanks for the solution, I added an extra header in the event I would need to add extra components, so I have a neat way to add components directly to the GPIO. Tested and working beautifully. \$\endgroup\$ – Alfred Ernesto Apr 12 '18 at 13:55
0
\$\begingroup\$

Alternatively, if you can live with a slightly higher draw on your 24V supply, recalculate your LED series resistor for 24V, and hang it between +24V and the transistor collector.

This has the advantage of telling you whether the switched devices are actually switched (i.e., the transistor is still alive and kicking).

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

if the LED fits in the pads you could

  • suppress R7
  • mount the LED in place of R7
  • suppress OR4

The current through the LED and transistor base will probably be a bit high but should be bearable. Experiment with different led colours and models to control base current.

\$\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.