# Driving a Common Anode RGB LED Using a uC

I have an RGB LED, APHF1608LSEEQBDZGKC, (Datasheet) which is common anode. The blue and green diodes both have a forward voltage of 2.65V while the red has a forward voltage of 1.8V. I want to minimize component count while driving this LED with the TI CC2640R2F embedded MCU (Datasheet). My circuit is running off of a 3V regulator and my plan is to use the analog GPIO pins on the MCU to control the LED.

The first problem is that the current would be flowing into the GPIO pins.

The second problem is that 3V is higher than the forward voltages of the LEDs.

Therefore, my question, would it be possible to, for the green diode, feed 3V into the common anode, and then connect the cathode to an analog GPIO pin set to .35V thereby creating a 2.65V drop over the LED? I am trying to minimize component count and current draw, any suggestions are welcome.

• The way you've included your hyperlinks means we have to follow them to find out the part numbers. If you put the part numbers in instead of 'here' and 'this' we won't have to. Capital 'V' for volt. – Transistor Jun 20 '18 at 22:57
• What specs/goals do you have for Color Matching? Intensity tolerance? Temperature rise? Current max? Solder method? Moisture/ESD handling? Ignoring these may cause failures – Tony Stewart EE75 Jun 20 '18 at 23:15
• ESR of Cortex is 25 ohms to 33 ohms =/-? RED is 12 Ohms here with Blue=40 and Green =25 and Vf drops with lack of heatsink, so the answers so far do not address these issues – Tony Stewart EE75 Jun 20 '18 at 23:24

My circuit is running off of a 3v regulator and my plan is to use the analog GPIO pins on the MCU to control the LED.

So far, so good.

The first problem is that the current would be flowing into the GPIO pins.

That's not a problem. Current sinking is very common.

The second problem is that 3 V is higher than the forward voltages of the LEDs.

Good catch.

Therefore, my question, would it be possible to, for the green diode, feed 3 V into the common anode, and then connect the cathode to an analog GPIO pin set to 0.35 V thereby creating a 2.65 V drop over the LED?

No. GPIO pins have three possible states:

• High: The output is connected to the MCU's positive supply.
• Low: The output is connected to the MCU's ground.
• Input: The output is neither pulled high or low unless a pull-up resistor is enabled.

You can not use a GPIO as an analog output.

A current limiting resistor is required for R, G and B.

• In the datasheet for the MCU it states for DIO pins 7-14 that they are "Digital/Analog I/O | GPIO, Sensor Controller, Analog" Does your response still hold true? Or would my way be possible now? – Peake Jun 20 '18 at 23:22
• You haven't linked to the datasheet properly - you've linked to the catalogue. The datasheet is 64 pages long but you haven't given a page or section reference for the above quote. – Transistor Jun 20 '18 at 23:25
• My bad, datasheet here and the quote comes from page 10 – Peake Jun 20 '18 at 23:29
• The "analog" in the datasheet looks like analog inputs to the ADC. Not true analog outputs. – bmow Jun 21 '18 at 0:17
• The "features" list shows a 12 bit ADC, but no mention of a DAC. – Peter Bennett Jun 21 '18 at 0:26

You shouldn't try to drive an LED with a constant voltage. The voltages you specify are typical values at a certain forward current, and you should always design a circuit that provides a constant current to an LED. The particular LED you are using is specified for a forward current of 2mA.

In this case, tie the common anode to 3V. For each LED calculate an appropriate resistor to limit the current if a total of 3V is applied to the LED and resistor in series:$$R = \frac{V_{DD} - V_F}{I_F}$$ where $V_{DD}$ is the supply voltage, $V_F$ is the LED's typical forward voltage, and $I_F$ is the desired LED current.

Connect one such resistor in series with each cathode, and then connect the other end of each resistor to a digital output pin. Set the pin to 0 to turn on the LED.

• If my regulator outputs at 3V, wouldn't setting my analog out to .35V create an equivalent Vdd equal to Vf (2.65V) thereby making the necessary resistance 0? – Peake Jun 20 '18 at 23:28
• There is no "analog out", but even if there were, you would still want a resistor to control/limit the current. – bmow Jun 21 '18 at 0:24
• No, you must remember that the $V_F$ value is a typical value and the current is an exponential function of voltage. Trying to apply a specific voltage gives no control over the LED current, which is the important parameter. – Elliot Alderson Jun 21 '18 at 0:39