Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

Let me first say I'm new to electronics. :) So, my question is will this circuit work? I'm trying to light up a 2 lead bipolar LED using 2 pins on a microcontroller.

My theory is when the mcu pin 1 is high Q1 is saturated giving voltage, and when pin 2 is low Q4 is saturated connecting the circuit to ground and allowing LED1 to light up. And LED2 will light when pin 1 is low and pin 2 is high.

Am I on the right track? Or am I over-complicating this even? I do that a lot :)


share|improve this question
So what you just created... Is an H-Bridge. Add two transistors and you'd be able to control it with a single pin. –  Passerby Dec 13 '13 at 22:08
@Passerby true, but you can't turn them off at the same time. –  jippie Dec 13 '13 at 22:36

2 Answers 2

In your schematic, the PNPs need to be on the high side, and NPNs on the low side, all in the appropriate direction (+ → -). But you are overthinking it; using the MCU's standard push-pull outputs (which you've almost reconstructed in your schematic) with opposite levels will light the LED assuming the output voltage is high enough for the LEDs, and you can use alternating polarities to turn it the combined color.


simulate this circuit – Schematic created using CircuitLab

share|improve this answer
The Keep it Simple Standard. –  Passerby Dec 13 '13 at 22:05
  • If you add base resistors (4 pcs) for all transistors it may just work, but it'll be on the edge;
  • You only need a single series resistor for both LED's if you move it to the right branch where the LED's join;

With this circuit you rely on the fact that your MCU will actually be able to pull its output high all the way up to Vcc (with 10k load!) and pull it down all the way down to GND. This is often not the case, you should check the datasheet of your MCU for that.

Left is what I think you are trying to do, which relies on the controller pulling its output all the way to Vcc and GND; right is an alternative approach that may work:


simulate this circuit – Schematic created using CircuitLab

For the left half brigde, notice that the voltage at the base of the two transistors differ substantially. The base voltage for the lower transistor at best varies between 0 and 0.7V, whereas top transistor at best varies between 4.7 and 5V.

Over engineering

While checking the MCU datasheet, just check if the MCU can source/sink enough current to drive the LED's (with a series resistor) directly. Many microcontrollers can. See also @Ignacio Vazquez-Abrams's answer.

share|improve this answer
Why use two individual resistors in the base of the transistors instead of a single one that drives both? –  alexan_e Dec 13 '13 at 21:45
I was under the impression current will take the path of least resistance? When pin 1 is low the PNP would be triggered by sinking it to GND via the 10k. And when pin 1 is high the NPN will be triggered, basically bypassing the connection to GND because of the resistor. And the MCU only has to trigger than transistors, not power the LED, right? –  bwoogie Dec 13 '13 at 21:46
@alexan_e If you connect the two bases in the left half bridge together, the base voltage of the lower transistor will never rise above 0.7V. That means the top transistor will never cut off. Actually in practice there are two BE-diodes in series in that case between the power rails. –  jippie Dec 13 '13 at 21:48
@bwoogie as in the comment above, the base to emitter voltage will always be 0.7V or less. The voltage on your lower base can never get low enough to cut off that transistor. They will both be conducting at the same time and overheat. –  jippie Dec 13 '13 at 21:54
@bwoogie: The statement "current will take the path of least resistance" is somewhat misleading, as some people take it to mean that the current will flow only in the path of least resistance.. Current will flow in all possible paths - the largest current will flow in the path with the least resistance, but some current will flow in other paths, in inverse proportion to their resistances. –  Peter Bennett Dec 13 '13 at 21:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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