Electronic – How to achieve constant current for LED when voltage is variable in MCU

ledmicrocontrollerpower supplyresistance

I am using STM8S003F3 to drive 1 RGB LED. Link of RGB LED :- http://in.element14.com/broadcom-limited/asmb-mtb1-0a3a2/led-hb-rgb-0-09w-plcc-4/dp/2401106

To power the microcontroller and LED I am using Lithium polymer battery whose specs are 3.7V and 300mAh.

The voltage at full charge is 4.2V and it starts dropping with discharge percentage and drains at around 3.1V. The input voltage at MCU will drop correspondingly and the output voltage at the GPIO will also drop.

Value of Limiting resistor for LED at 4.2V.

R = (4.2-3.1)/0.02 (20mA)
= 55 ohm

When the battery discharge the voltage will drop, then the current going through LED will be less, hence it will get less brighter.

At 3.3v

I = (3.3-3.1)/55
= 3.6 mA

The led will not be visible and will be dull.

How to maintain constant brightness (i.e 20mA) even with drop in voltage?

One Solution is to use LDO which will maintain constant voltage and hence the current will be stable. But as I have very less space in circuit and due BOM cost, I am hesitant to use LDO.

Best Answer

Yes, this is a problem. I have had to deal with it before with blue LED's on single cell lithium battery systems. In my case, I did have a regulated 3.3V available, but I wanted to drive the blue LED directly from VBATT without varying brightness. Anyway, here is how to fix (or improve) it.

schematic

simulate this circuit – Schematic created using CircuitLab

Voltage at base will be relatively fixed because of the two diodes. So the voltage at R3 will be relatively fixed. So the collector current will be relatively insensitive to VBATT. You can adjust R3 to adjust the current in the diode. R3 will have approximately 0.6V across it. So the current through D3 will be approximately 0.6/R3.

Note that Q1 is not operating as a saturated switch. This is a linear, analog circuit. D1 and D2 could be in a single SOT23 package to save space.