UPDATE & Recommendations
This solution I believe will give you more than 7 hours with a 300mAh battery. Likely a lot more.
The LEDs are rated at 20mA but the max is 50mA. You could probably run the LEDs at 40mA for 7 hours on 300mAh. I do not think even 20mA will be necessary with the Cree LEDs.
Because the green will be on when the battery is fully charged, green's higher forward voltage will be less of an issue. Both amber an red have lower forward voltages.
The green max forward voltage (Vf) is 4.0v. My experience with Cree is that the forward voltage is usually below typical. You must be aware if you get a green LED with a 4v Vf, it's not going to work when the battery discharges to 4.05v. The datasheet is not that clear. I has a peak max current also. The graphs of Vf shows Vf to be much less at 20mA and you probably can driver it at less than 20mA. I would not worry about it.
The price on an Amber Cree LED at Digikey is:
And Digikey can always be beat.
The LED driver is a constant Current source so no limiting resistor is needed. No matter the battery voltage, the LED will get the same current.
This driver is essentially a dynamic resistor that changes its value based on the battery voltage to provide exactly the desired current.
The discreet 20mA LEDs with sufficient flux are 2.7 x 3.0mm
The LED driver is smaller than one of the LEDs in an SOT-23 case.
The LED Datasheets
Cree CLM1B 50mA Red Amber
Cree CLM1B 20mA Green Blue
The Micrel (Microchip) 30mA MIC2860 is an inexpensive, very small, and simple linear LED driver in a 2.0 x 2.0mm footprint with two outputs. Probably costs about the same as your RGB LED.
The MIC2860 provides the highest possible efficiency by
eliminating switching losses present in traditional charge
pumps or inductive boost circuits. It features a typical
dropout of 52mV at 30.2mA per channel. This allows the
WLEDs to be driven directly from the battery eliminating
switching noise and losses present with the use of boost
Would replace the resistor.
Takes the same real estate as a SOT-23 transistor or diode.
The changes are to replace the RGB with 3 Cree CLM1B LEDs and replace the 56Ω Resistor with the Micrel Driver.
The Cree LEDs are Binned by Flux. That give you some flexibility when buying. Each color has its own bins so you can adjust the luminous flux by the part number.
Each row is a bin code used in two characters of the part number.
Because mcd is a Photometric quantity it is adjust for the human eye.
You can get all LEDs with the same range of brightness.
If you buy all colors in the VA bin code the all colors have the same brightness.
Red and Amber bins are identical.
Is there a reason you are using the STS STM8S003 Micro?
I think it is a little over kill and you do not need that many pins.
It is a fine device and the power is not bad.
I'm not up to date on all the processors out there.
I have always like Atmel AVR for apps like this.
The 14 pin ATtiny441 would do this job very well.
It would save real estate. The power savings would be negligible as both micros will average less than 1mA.
I am currently looking into the ATtiny817 which is a new part very similar to the Tiny441. Except the 817 has a DAC. I am going to see how well the DAC can control an LED Driver's analog current adjust and or switching frequency.
I was originally thinking a DAC could help you with the variety of luminous flux on the RGB LED. You could use the DAC to drive the Micrel Driver's current adjust pin with a different level for each color.
End of Update and Recommendations
So the LED must be seen across a well lit room.
There is only one LED turned on at a time.
LED color is controlled by 3 MCU pins connected to the color cathodes, sinking from a single 55Ω Resistor in the common anode path.
Both real estate and cost are major criteria.
Cost of the RGB LED is about $0.20.
Battery Discharge Rate is less than 0.2C.
The 55Ω resistor.
Dissipates 1.1 Watt @ 20mA
Insufficient luminous flux at low battery @ 3.6mA
The forward voltage of the LEDs is a huge factor after luminous flux.
Luminous flux and Forward Voltages
- Red: 540mcd 2.1v
- Green: 1600mcd 3.1v
- Blue: 350mcd 3.1v
The RGB is an economical and space saving way to get multiple colors.
The problem color is blue. Candela is a measurement of light based on the sensitivity of the human eye to each wavelength of colors.
Lime green (555nm) is the color the eye is most sensitive to according to CIE (Commission Internationale d'Eclairage). All other color sensitivities can be specified as a percentage or ratio compared to 555nm Lime Green.
Blue is 7.7x less sensitive and Red 3.4x.
If only two colors are needed then Green and Amber or Red and Amber would be the color combinations of choice.
Red LEDs are AlGaInP/GaAs
Blue LEDs are GaInN
Green is a deep blue GaInN LED pushing a green phosphor
Amber can be either a red or blue LED pushing phosphor.
AlGaInP/GaAs has a lower forward voltage than GaInN.
Cyan would be better than blue
Lime green better than green.
Amber and Orange better than Red
Add two resistors and put then in the cathode path
The red can be recalculated with its lower forward voltage
Green current can be reduced at least 50%
Resistor is actually 56Ω standard value.
Current 3.1v LED 19.6mA
Current Power per Color
Red 158mW 37.5ma 0mcd
Green 83mW 20mA 1600mcd
Blue 83mW 20mA 350mcd
Max current is 25mA, @ 55Ω
Red forward current = 37.5mA
LED burns out mcd = 0.
Single Resistor must be recalculated for Red
Two possible values for Red resistor, 82 and 100.
82 25.6mA 108mW 690mcd
100 21.0mA 88mW 570mcd
82 13.4mA 57mW 1070mcd
100 10.0mA 46mW 800mcd
82 13.4mA 57mW 235mcd
100 10.0mA 46mW 175mcd
Looking like a new RGB will be needed. For sure if blue is required and 235 mcd at full charge is insufficient.
If Red and Green are all that is needed, 82Ω is the only viable resistor. And at that red is being pushed over its max forward current.
I do not know where to go from here mainly because I do not know if blue is needed or if the current RGB LED is actually going to work.
It is likely the cost will increase and the PCB will get bigger.
You need to run the numbers with min and max, not typical. There is nothing typical about LEDs.
Red Forward Voltage range is 1.8v - 2.6v
Green and Blue 2.8v - 3.6v
I was hoping this would lead to a point where I would introduce another solution but things when down hill. The red will not work at 56Ω
Minimum next attempt is separate resistors.
PWM may be necessary. It is possible the micro can blink the LEDs at a fast enough rate. Not a good way to go.
Driving LED with a resistor in a battery powered circuit is seldom a good idea.
But an LED driver may be necessary. The current would need to be adjusted for each color used.
Another solution would be to raise the capacity of the battery and raise the cutoff discharge voltage.
Possibly you may have to use discreet LEDs rather than an RGB.
You should look into using cyan and amber colors. The may be multi-color LEDs other than RGB.
When selecting an LED you must test it in a well lit room and find the minimum mcd that will work. Start with blue.
An LED driver would most likely be the right solution.
Gives you the flexibility to double up two LED with less luminous flux, or just use one output.