I have an RGB LED that I'd like to change from green to red when a circuit is completed. While I know this is very simple with tools like an Arduino, I'd love to not use a microcontroller. Would it be possible using basic components (which can certainly include transistors, diodes or even common ICs like a 555 timer) to achieve this? If so - how would I connect the components?

Clarification: I'm using a common anode RGB LED (a lead for each color plus ground - four in total). I'd like to have it be green when a switch somewhere in the circuit is open (not connected) and red when the switch is closed. The switch is not connected to anything else.

  • \$\begingroup\$ How are the LEDs connected internally? \$\endgroup\$ – Ignacio Vazquez-Abrams Jan 27 '14 at 15:30
  • \$\begingroup\$ And what does "when a circuit is completed" mean? You mean you have a normally open pushbutton, or an open collector output, or what? When the button is pushed, you want green, and when it's not pushed, you want red? Or, when the button is pushed, do you want the LED to be red and then some time later green? There are a lot of ambiguities in your question that make it hard to answer. \$\endgroup\$ – Phil Frost Jan 27 '14 at 16:54
  • \$\begingroup\$ @PhilFrost To clarify, I'm trying to have an RGB LED be green when a switch somewhere in the circuit is open and turn to red as soon as that switch is closed. \$\endgroup\$ – mbeasley Jan 27 '14 at 20:39
  • \$\begingroup\$ @mbeasley if you edit your question to clarify that, it will go in the reopen queue. You also need to specify what kind of RGB LED you have. Is it common-cathode? Common-anode? Each emitter available separately (six leads)? Is the switch connected to anything else? \$\endgroup\$ – Phil Frost Jan 27 '14 at 20:44

This is the simplest circuit I can think of (2 parts):-


simulate this circuit – Schematic created using CircuitLab

Input = 5V Red Input = 0 Green

The circuit works because the \$V_F\$ of a Red LED is generally much less than the \$V_F\$ of a Green or Blue LED.

Here is a typical RGB LED datasheet:

And here are the typical plots of \$V_F\$ vs. current:

enter image description here

When the transistor is "off", the Green LED will have a forward voltage of about 3.0V at 10mA. When the transistor is "on", the Red LED will have a forward voltage of less than 1.9V. Referring back to the Blue/Green graph, little current will flow through the Green LED at that forward voltage.

This particular arrangement shows a common-cathode arrangement, however it could be flipped and a similar P-channel MOSFET used. In that case, 0V would select the Red LED, and +V in would select the Green LED.

  • \$\begingroup\$ Are you depending on a higher Vf for the green LED to turn it off? \$\endgroup\$ – Tut Jan 27 '14 at 16:06
  • \$\begingroup\$ Yes, that's correct. \$\endgroup\$ – Spehro Pefhany Jan 27 '14 at 16:16
  • \$\begingroup\$ I like this circuit iff the green LED can be depended to turn off fully (or near enough). Perhaps a little further explanation including LED selection would be in order. \$\endgroup\$ – Tut Jan 27 '14 at 16:38
  • \$\begingroup\$ I just looked at a Kingbright RGB LED that seems to have a pretty large Vf difference. +1 ... clever circuit! \$\endgroup\$ – Tut Jan 27 '14 at 16:47
  • \$\begingroup\$ Might be easier to replace M1 with a BJT, since finding a MOSFET with a sufficiently low threshold voltage takes a little more work than grabbing the first one out of the parts drawer. \$\endgroup\$ – Phil Frost Jan 27 '14 at 16:48

Maybe something like this?


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ It would be normal to have current-limiting resistors for LEDs and for BJT bases. \$\endgroup\$ – RedGrittyBrick Jan 27 '14 at 15:48
  • \$\begingroup\$ Sorry. Sort of assumed that. You are correct. \$\endgroup\$ – mikeY Jan 27 '14 at 15:50
  • \$\begingroup\$ R5 is not needed. You can also invert Q2 with the led cathode on the emitter, collector to GND and then you can remove R4 too. \$\endgroup\$ – alexan_e Jan 27 '14 at 23:03
  • \$\begingroup\$ @alexan_e When you answer the question, you should certainly do those things. \$\endgroup\$ – mikeY Jan 28 '14 at 16:03
  • 1
    \$\begingroup\$ @alexan_e My fault - bad wording on my end. Not upset. Merely suggesting that if you have another way, you could provide it to OP. It's all good. I appreciate your comment. \$\endgroup\$ – mikeY Jan 28 '14 at 16:25

For this particular case ONLY, there are various ways to do this

Digital gate ICs, flip-flop, ON/OFF transistor configuration, etc. depending on your actual configuration

Assuming common anode RGB, attached a sample circuit using transistors


simulate this circuit – Schematic created using CircuitLab

  • 2
    \$\begingroup\$ Where is your power-supply? \$\endgroup\$ – Tut Jan 27 '14 at 16:00

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.