1 GPIO, bi-colour, 2-pin LED

GPIO and bi-colour 2-pin LED.

Driving a bi-colour, 2-pin LED with one pin is possible!

GPIO and bi-colour 2-pin LED.
A single GPIO pin driving a bi-colour, 2-pin LED.

When GPIO1 pins are in short supply a bi-colour 2-pin LED may seem like a good idea.

It can be done, but is not that efficient.

How it works

  • When GPIO is low R1 provides current to L2 and the indicator glows red.
  • When GPIO is high current flows through L1 and R2 to ground and the indicator glows green.
  • By alternating the GPIO high-low fast enough both LEDs can be illuminated giving an orange colour (since they’re both in the same package). By varying the ‘on’ pulse width a smooth cross-fade can be given from red to green.
  • If the GPIO is tri-stated (disconnected) the LED will be dark.

Note that this circuit is not very efficient. R1 and R2 pass current to ground always and when the red LED is on R2 is stealing power from it and when the green LED is on R1 is stealing power from it. It may take some experimentation to get this to work.

See also 1 GPIO – 2 LEDs.

Please link to us if you find the information helpful ...<br>Tweet about this on Twitter
Twitter
Share on Facebook
Facebook
Pin on Pinterest
Pinterest
Digg this
Digg
Share on LinkedIn
Linkedin
Share on Reddit
Reddit
Share on StumbleUpon
StumbleUpon
Share on Tumblr
Tumblr
  1. GPIO = general purpose input output. Most micros allow user configuration of the pins as either input or output or tri-state (disconnected).