I've got a bi-color LED in a push-button that is red when powered in one direction and green in the other direction. I would like to control it from a Raspberry Pi GPIO pin, e.g. High=Red, Low=Green.

I thought I could use some kind of H-Bridge to reverse the polarity, something like this perhaps?

enter image description here

The idea is that when input is High the BC547 is open and FET B and C are open providing polarity in one direction. When the input is Low the BC547 is closed and the FETs A and B are open providing polarity in the other direction.

I want to power it from Raspberry Pi's 5V pins however the GPIO is only 3.3V (that I can level shift up to 5V if needed).

The LED doesn't need a resistor, the button has an internal one.

I've put 4x 2N7000 (N-channel MOSFET) in the schematic as I've got a bag of them but happy to replace them with BC547 / BC558 or anything else.

  • Is the overall idea correct?
  • Will the gate levels be high enough to open the FETs?
  • Will the voltage drops on the FETs will still allow the LEDs to operate?


  • 3
    \$\begingroup\$ Wouldn't you be better just getting a bi-coloured LED with a common cathode and just driving the LEDs individually, rather than needing all that extra circuitry. You could also just use a single NOT gate if you want to control them off one GPIO. \$\endgroup\$
    – HandyHowie
    Oct 15, 2019 at 6:56
  • \$\begingroup\$ @HandyHowie The LED is built in the push button, I can't change it unfortunately. \$\endgroup\$ Oct 15, 2019 at 9:35

2 Answers 2


H bridges are for driving high current coils or motors. You have no current limiting R.

CMOS (74HC family ) has about 50 OHms driver R so you can include this with your current limiting R.

Since Iv intensity in xxxx mcd is common now , the curent can reduced to a few mA for indicators with a single Rs = 470 to 1k. schematic

  • \$\begingroup\$ Note that you can do this with 2 x 5V inverters in my answer vs 1x 5V inverters in the accepted answer. But if you had 5V uC then only 1 inverter needed/ \$\endgroup\$ Oct 16, 2019 at 22:52
  • \$\begingroup\$ Also why do you put an extra resistor for the red LED? I tried without, with just one shared one like the other answer shows and it worked fine. Using 74HC04. Thanks! \$\endgroup\$ Oct 16, 2019 at 22:52
  • \$\begingroup\$ Since R/G has a different Vf the extra R adds the 1.3V+/-0.2 difference typ 2.1 to 3.4 but reality is choice of LED Iv from 100mcd to >10,000 mcd at 20mA means you can tune equal brightness by R or choice of LED but the RED will draw more current, then operate at lower current like 5mA.. But Iv efficacy differences can make it look equal \$\endgroup\$ Oct 16, 2019 at 22:55
  • \$\begingroup\$ I see, that makes sense. Thanks for a quick reply! \$\endgroup\$ Oct 16, 2019 at 22:57
  • \$\begingroup\$ So single R is adequate then choose brightest cheap LEDs that are roughly equal and run at low mA lens reducing angle 50% makes almost 2x brighter \$\endgroup\$ Oct 16, 2019 at 22:59

Here is how I drive bi-color LEDs:


simulate this circuit – Schematic created using CircuitLab

Use a logic family that can source or sink 20ma or whatever you need to drive the LEDs. I actually don't use inverters (that solution was closest to your circuit), but a serial to parallel shift register (like a 74xx591) to drive 4 bi-color LEDs using the 8 outputs. For two output pins you end up with 00 -> off, 01 -> red, 10 -> green, 11 = off.

  • \$\begingroup\$ That's brilliant, thanks! Works like a charm with 74HC04 :) \$\endgroup\$ Oct 16, 2019 at 22:48
  • \$\begingroup\$ Unfortunately I can't upvote with my reputation yet :( \$\endgroup\$ Oct 16, 2019 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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