I need to make circuit in which orange LED will light only when yellow and red are disconnected. When one of buttons is pushed orange LED should turn off.

See my attempt at it below.

I am new to electronics so your help is very appreciated.

Fritzing diagram


After many atemps I managed to build this circuit as on left side of schematic (tested on live breadboard)


but my primary goal is to make this work with RGB LED. I took Common Anode RGB LED for this and build circuit on right side of schematic. I do not have such RGB LED to test it live so I ask you to review if that schematic will work as it has few changes to one with 3 LED's. Thank you


Thanks to Bruce's help my circuit now works.

3 separate LEDs emulate common anode RGB LED (as I do not have one to test circuit)
Q2 is BC 560B transistor with CBE type pinout


void setup() {

void loop() {
  • I'm a newbie too, but are you planning on using an Arduino by any chance? Jan 1 '15 at 20:26
  • Yes I plan to use Arduino and using Arduino is easy way for that. But need this circuit because I need to have about 20 circuits like that and this make use of 60 arduino I/O's which I want to use for some other things than light this LED Jan 1 '15 at 20:34
  • By being disconnected, I'm assuming that you mean the buttons for the red and yellow LED's are not pressed down? Jan 1 '15 at 20:43
  • yes, when button is pressed LED is ON, when not pressed LED is OFF, when both(red, yellow) LED's are OFF orange LED should turn ON Jan 1 '15 at 21:04
  • I haven't done any of this myself, but I think you could use a MOSFET and hook up all the orange LED's to the drain pin. Have the Arduino read buttonState (google this). Then if the buttonState is LOW, meaning disconnected, have the Arduino digitalWrite HIGH to the gate of the MOSFET controlling the orange LED. If the buttonState is LOW, have the Arduino digitalWrite LOW to the gate. Just a general idea, although I'm sure there are better ways to do this. Jan 1 '15 at 21:17

You want the green LED to be on only when the red and blue LEDs are both off. In other words, you want the voltage on the green LED to be LOW only when the voltages on the red and blue LEDs are both HIGH. That is a logical NAND function.

Your right-hand circuit with the RGB LED won't work because the transistor's collector is connected to the wrong place - it's shorting out the battery! Another problem is that the Arduino can only switch to Ground or +5V, so it can't replace a 'floating' switch.

You need a configuration that produces a logical NAND function. Your left-hand circuit is doing it, but won't work with a common anode RGB LED. So swap the transistor to a PNP type, and add a couple of resistors to switch it on when either input goes low, like this:-

enter image description here

  • To clarify my goal for RGB LED ... when buttons are open (not pushed) Green LED should be OFF, when one of buttons are closed (pushed) certain LED (red or blue) should be ON and green should turn OFF Jan 2 '15 at 8:55
  • So when both buttons are open the green LED should be OFF, and when either button is closed the green LED should also be OFF. When should the green LED be ON?
    – Bruce Abbott
    Jan 2 '15 at 17:36
  • my bad english .... sorry Bruce ... correct "when buttons are open (not pushed) Green LED should be ON" Jan 2 '15 at 19:10
  • I have bought PNP transistor CTBC 560B (lowest voltage they had in store) and your circuit does not work with it. when I remove this transistor D3 (on your schematics) turns ONO. When I return it to circuit D3 turns OFF. I used R1,R2,R3 220ohm and R4,R5 10k ohm. Is it problem with resistors or with this transistor? Jan 2 '15 at 19:16
  • "when I remove this transistor D3 (on your schematics) turns OFF". If the transistor is removed the LED should be ON. If the transistor stays on when the switches are open then either it's connected the wrong way around, or noise is getting to its base through the wiring. You can put a 10k resistor from base to emitter to ensure that it turns off (this should not be problem when the switches are replaced with an Arduino, as R4 and R5 will be pulled high).
    – Bruce Abbott
    Jan 2 '15 at 19:24

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.