SOLVED: Switching RGB LED with 2 buttons & transistor

I try to make circuit in which 2 LED's are switched ON/OFF with buttons and 3rd LED is ON when both other LEDs are OFF and 3rd LED is OFF when at least one of the other LEDs is ON.

I made live working circuit with 3 separate LED's but I need this with using RGB LED. I took Common Anode version and tried to rebuild this circuit for it. I do not have such LED in my case so I am not able to test it.

Left side - working 3 separate LEDs Right side - not tested 1 RGB LED

Please check right schematic if it is electrically OK and if this circuit will work as left version? Thanks in advance for help

The two circuits have nothing in common.

Your battery on the left is connected to a resistor then the collector of the transistor. While also being connected to the emitter.

The circuit on the right has the battery connected to the collector and emitter.

You got badly confused there! Wiring the transistor across the battery is not going to work. :astonished:

Start with the left hand circuit, but the transistor will be PNP, there will be a resistor to ground feeding the third LED in the RGB, along with the resistors from the other two LEDs to the switches which then go to ground. The PNP transistor emitter will be to the positive battery and its collector will be to the LED cathode so when turned on, it will shunt the current from the LED, as it does in your first circuit.

You then need two resistors from the base to each of the switches, so that whichever is switched on (or both), provides enough base current to the transistor to turn it on.

After your sugestions and lot of searching I have done this circuit

But this do not work as supposed. when i remove transistor BC 560B green LED turns ON, but with this transistor in circuit it is always turned OFF. is it problem with resistors or with the transistor?

next step to build this circuit:

how then it is possible to read on arduino inputs state from red and blue LED's? connecting ground from switches to arduino pins does not work (leds does not light then even if switch is pushed).

with this transistor in circuit it is always turned OFF.

Yes that is because the transistor's base is always less than the supply voltage minus 0.7V so the transistor is always on.

how then it is possible to read on arduino inputs state from red and blue LED's?

What does that mean?

You have the transistor and LED wired wrong.

You need to wire the LED’s anode to the transistor’s collector. Then the emitter to the positive of your DC supply.

Thanks James for image. What software did you used for making it and simulate?

nysander: But this do not work as supposed. when i remove transistor BC 560B green LED turns ON, but with this transistor in circuit it is always turned OFF. is it problem with resistors or with the transistor?

Your circuit it perfectly correct as I described it to you. Good work!

Your problem is that you have mis- identified the transistor connections and swapped base and collector.

nysander: Thanks James for image. What software did you used for making it and simulate?

iCircuit on the iPad/iOS. It's based on the older Falstad Java emulator.

Super easy to draw up a circuit and see how it works. Things like the buttons actuate. LEDs light up. Etc.

Paul ... that was the point, after switching transistor pins in circuit everything works great :D

and I have it working with arduino also :)

see the pictures

Q2 is BC 560B transistor CBE pinout

thank you guys for help.

Your schematic is still drawing the transistor wrong.

If built as drawn, it shouldn’t work. Or if it is appearing to “work”, it isn’t doing what you think it is.

You’ve put the transistor in parallel with the LED when it needs to be in series, as I drew in my circuit.

James problem is that this circuit will use Common Anode RGB LED on which I am not able make circuit you wrote. In this examples I use 3 separate LEDs as my shop did not have Common Anode LED today, so they only simulate one LED.

Or am I wrong?

[quote author=James C4S date=1420232022 link=msg=2025791] Your schematic is still drawing the transistor wrong.

If built as drawn, it shouldn't work. Or if it is appearing to "work", it isn't doing what you think it is.

You've put the transistor in parallel with the LED when it needs to be in series, as I drew in my circuit. [/quote] James, please read the original description of what he wanted to do.

Carefully.

Paul__B: James, please read the original description of what he wanted to do.

Carefully.

Yup, I read it backwards.

So the circuit is OK then?

Absolutely.

thx I will mark it solved

one more question

As I need about 10 such circuits as above I thought to replace transistor with gate. I have MH7400 TTL one and tested this circuit. It works.

But I do not know if it is electronically ok and arduino safe, could you review it?