# How to drive 2/3 color LED's and circuit schematic

I need to use 2 or 3 color LED for my circuit.(preferably 3 color one). I am going to use PIC18F26K83 to control the LED. However, I am confused how am I going to make it change colour. I think I need to give different voltage values to it. (For 3 colour one it says: 1.9V Green, 1.85V Red, 1.9V Yellow) In this case what will it be if I give it 1.9V?. To sum up my questions are:

1. What do I need to do in order to use make the LED to change colour? Do I need to change voltage value of it? If yes how can I change it? Via hardware?
2. I have a circuit for 2 colour LED and it works fine. Can I also use exact same circuit if I need to replace 2 colour LED to 3 colour one? Do I need to replace any components? (See the datasheets below)

Datasheet of the 2 LED's and circuit schematic are below:

2 colour LED datasheet

3 colour LED datasheet

• +5V should be on pin 4 . No? – Russell McMahon Mar 28 '19 at 14:38
• See my updated answer for LED current calculation.| Circuit: Use THREE driver ICS. Use THREE PIC output pins. Check pinout of LED. PWM PIC pins to change each colour level independently. NEVER have no hope :-) – Russell McMahon Mar 28 '19 at 14:46
• Your latest diagram is correct - except for component values. | Is PIV 5V or 3V3. I'll assume 5V - you should always say what drive levels are.| Idrive = (VPIC- Vbe driver)/Rdriver ~~= (5-0.6)/21k ~= 0.2 mA. Driver GUARANTEED current gain = 33. So ILED max guaranteed = 33 x 0.2 mA = 6.6 mA. | Make R68 69 70 lower or remove. The idea of the internal R's is so driver does not need resistors external. LEDS have a 20 mA recommended Ioperate and 30 mA continuous rated. You can reduce mean level with PWM from PIC. Remove R68 etc or set to value that suits max ILED needed. – Russell McMahon Mar 29 '19 at 8:50
• R on VCC to LED package is superfluous. Each LED has it's own series R 71 73 74 to control current. The one on the VCC lead was common to all LEDs so would have caused current in all LEDs to change when any one was altered by its driver. || Enjoy :-) – Russell McMahon Mar 29 '19 at 8:53
• What @CristobolPolychronopolis means is that the LED he provided a link to is "more modern" than the one you are using. It has its own application problems. Your LEDs are driven with an analog current per LED. His cited LEDS have Vcc and ground applied and have serieal data in and out pins. Data is sent to the string of LEDs like a long "shift register" and many LEDs can be controlled by a single data pin. Good but DIFFERENT. – Russell McMahon Mar 29 '19 at 8:57

The 3 colour LED package contains 3 separate LEDs, each for one of the 3 colours.
In the device you refer to they share a common Anode (positive) connection on pin 4 and each LED's Cathode (negative) connection ON A SEPARATE PIN.

On the diagram below from the LED's datasheet I have used a red line to show the relationship between the package pin and the schematic for the common Anode (+ve) connection and green lines for the 3 separate Cathode(-ve) connections.

The 2 colour LED contains 2 separate LEDs - connection as per datasheet.

To drive a 3 colour LED with common Anode you need 3 of the (slightly modified) circuits that you have shown - one per LED. The circuit needs to be modified because you have the current controlling resistor in the Anode connection - but as this is common to all 3 LEDs and you need one resistor per LED, connect Anode to +5V and place a resistor between the each LED Cathode and its related DTC113KZA driver.

_____________________________________________

Note that the driver DTC113KZA has a 100 mA max load and a low current gain by most standards of only 33 minimum. (Max or typ not stated). It is OK for this application but would be poor for many output drive tasks.

____________________________________

LED Current:

For LED on eg pin 1, LED current = current in R68.
I_R68 = V_r68/I_R68.
V_R68 = Vcc- VLED-Vdriver_on

Say driver saturation is 0.2V.
Say I_LED_desired = 20 mA.
Look up LED datasheet - say (my guess) V_LED = 1.9V. @ 20 mA.
Then V_R68 = 5 - 1.9 - 0.2 = 2.9V.
So R68 = V/I = 2.9V/20 mA = 145 Ohms.

Change assumptions to suit.

• Thanks, so is this circuit looks okay for 3 colour LED. ( I have zero hope tho ..) I added it to the original post – Günkut Ağabeyoğlu Mar 28 '19 at 11:18
• @GünkutAğabeyoğlu Getting their :-). As I said above "To drive a 3 colour LED with common Anode you need 3 of the (slightly modified) circuits that you have shown - one per LED. 3 uC pins. 3 drivers. 3 series resistors. 3 LEDs. Replace the 2K2 with a wire. Change the 1Ks to 2K2s IF that was the right value for one LED. Use one driver per LED. You can use PWM on the PIC LED drive pins to vary brightness. – Russell McMahon Mar 28 '19 at 14:36
• @GünkutAğabeyoğlu LED Current. For LED on pin 1, LED current = current in R68. I_R68 = V_r68/I_R68. | V_R68 = Vcc- VLED-Vdriver_on ,Say driver saturation is 0.2V. Say I_LED_desired = 20 mA. Look up LED datasheet - say (my guess) V_LED = 1.9V. @ 20 mA. | Then V_R68 = 5 - 1.9 - 0.2 = 2.9V. | So R68 = V/I = 2.9V/20 mA = 145 Ohms. | Change assumptions to suit. – Russell McMahon Mar 28 '19 at 14:42
• Got it, I will change it accordingly. Thanks for all the help :) – Günkut Ağabeyoğlu Mar 28 '19 at 14:44
• @GünkutAğabeyoğlu: Your two-colour LED has two LEDs with separate anode and cathode pins (no connection between the LEDs) - you will need two driver circuits and current-limiting resistors to control the colours individually. – Peter Bennett Mar 28 '19 at 15:33