-2

I have an rgb led with a common annode connected to my 3.3v arduino mini pro in the following way:

schematic

simulate this circuit – Schematic created using CircuitLab

When I try to illuminate more than one diode, to create a "multi" colour, only one of the colours shows. An example would be, using the following code would result in only the red colour showing:

digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
digitalWrite(blueLed, LOW);
Transistor
  • 168,990
  • 12
  • 186
  • 385
Blease
  • 99
  • 1
  • 4

2 Answers2

3

As @uint128_t says, 'the one with the lower voltage drop will win'.

To understand this wire up the LEDs with individual 1k resistors and turn them all on with your code. Measure the voltage between the +5 V (top) side and each LED - resistor junction, V1, V2 and V3.

schematic

simulate this circuit – Schematic created using CircuitLab

LED voltage-current graph

Graph of LED voltage vs current. Source Arduino-info.

You should observe that the red LED will light with a much smaller voltage drop. In your circuit this would reduce the anode voltage below that required to turn on the others. (If you turn off the room lighting you may see them glow a little.)

Transistor
  • 168,990
  • 12
  • 186
  • 385
1

You need a separate resistor for each diode.

As it is, the diode with the lower voltage drop (red) will "win" the battle for current.

uint128_t
  • 8,664
  • 6
  • 26
  • 28