TL431 + RGB LED for power on + low battery indicator - Page 1
Forum section: electronics / projects

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 01:16:27 am
content: I'm using a TL431 and a RGB LED to indicate both power on and low battery level. Green LED for power on, yellow (green+red) for low battery (~3V and below).Battery is 18650 (Li-Ion 3.7V).R: 1.6-2.4V@8mA. This will be limited to 2-3mA (need to experiment how much is needed to blend to yellow.G: 2.4-3.2V@5mA.Can the TL431 work in this configuration (without a transistor) down to 3V (or even 2.8V), and still power the red LED properly?(The RGB needs to be common anode for other project reasons.)And how do I add a small hysteresis for this? Or is it not needed, if red LED might gently glow more and more as battery level drops closer to the trigger point? I don't want it to blink like crazy at the trigger point.

author: magic
author_rank: Super Contributor
timestamp: December 28, 2024, 08:46:37 am
content: If the common cathode is grounded and the red anode pulled up to Vbat, TL431 "cathode" could be connected to the LED anode directly.TL431 can work with any cathode voltage starting from ~2V and this could potentially be a problem - it may be unable to fully turn off the LED. Probably the simplest solution is to use a 1.24V variant, these are called TLV431 or similar.It will probably turn on the LED gradually rather than blink. For hysteresis, I'm afraid you'd need an extra transistor.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: December 28, 2024, 08:54:20 am
content: Quote from: okw on December 28, 2024, 01:16:27 amNot directly.The TL431 is designed to clamp at Vref, it can only go slightly under Vref before it saturates.There are 4 terminal Vref parts that can saturate the NPN output much lower.However, if you want common cathode, you need to source current, so additional parts are needed.

author: inse
author_rank: Super Contributor
timestamp: December 28, 2024, 09:09:53 am
content: Do you HAVE to use the TL431?A comparator with integrated reference would give you all freedom to define the behaviour.Microchips MCP65R41 is even available with push-pull output, no inverter necessary.

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 12:22:53 pm
content: Quote from: PCB.Wiz on December 28, 2024, 08:54:20 amThe TL431 Vref is 2.5V. Why is that a problem, since I want it to trigger at approx. 3V? Or are we talking about the base voltage for the NPN, which should be much lower than 2.5V?

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 12:28:31 pm
content: Quote from: inse on December 28, 2024, 09:09:53 amI don't have to use 431, but it's cheap and a lot of low battery indicator examples use this.For production reasons, I can choose LM393D and LM358D. In some previous projects I've used the 358 as a comparator, and was told by peers using an opamp as a comparator sometimes has benefits in some areas compared to dedicated comparators.If I do chose to replace the 431, should I go for a comparator or the opamp?What about current consumption, TL431, LM393D and LM358D?

author: inse
author_rank: Super Contributor
timestamp: December 28, 2024, 12:51:02 pm
content: For something simple like a lo batt LED, a OPAMP is suitable as well.It’s more for high speed applications that dedicated comparators are better than OPAMPs.Sure you can build the circuit with TLV431 and additional components as well.As long as a power indicator LED is OK from current consumption, some single mA for additional circuits should not matter, right?The formerly proposed comparator would be hard to beat current consumption wise.

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 12:54:15 pm
content: Quote from: inse on December 28, 2024, 12:51:02 pmThanks. How would I modify the existing TLV431 circuit?

author: inse
author_rank: Super Contributor
timestamp: December 28, 2024, 12:59:32 pm
content: What is the existing circuit like?Did you show it yet?

author: Terry Bites
author_rank: Super Contributor
timestamp: December 28, 2024, 02:44:45 pm
content: Yeah, save yourself some painhttps://www.aliexpress.us/w/wholesale-1S-2S-3S-4S-5S-Lithium-Li%2525252dion-Battery-.html?spm=a2g0o.home.search.0Here's a knife and fork solution using low voltage (push pull op) comparators eg TLV7032 and a TL431. It would cost more than the Alixpress special [ Attachment Invalid Or Does Not Exist ] l.

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 03:05:55 pm
content: Quote from: Terry Bites on December 28, 2024, 02:44:45 pmHehe, thanks, but that's absolutely not what I'm looking for. It's for an integrated design. And for the learning.

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 03:07:16 pm
content: Quote from: inse on December 28, 2024, 12:59:32 pmSorry, forgot to add the existing design. Have updated the original post with it now

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2024, 04:46:07 pm
content: How accurate does it need to be?

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 05:05:51 pm
content: Quote from: Zero999 on December 28, 2024, 04:46:07 pmNot accurate at all. 2.9 or 3.1It's just a heads up to the user, that it's soon time to charge the battery

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2024, 05:14:44 pm
content: Quote from: okw on December 28, 2024, 05:05:51 pmThree 1N4148 and a resistor in series with the red LED.

author: inse
author_rank: Super Contributor
timestamp: December 28, 2024, 05:21:54 pm
content: The schematic shows a common Anode LED, you entioned common Cathode, so which is right?

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 05:27:33 pm
content: Quote from: inse on December 28, 2024, 05:21:54 pmSorry, common anode. Original posted fixed now.

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 05:33:11 pm
content: Quote from: Zero999 on December 28, 2024, 05:14:44 pmHow would that illuminate the LED below ~3V and keep it off above?

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2024, 05:41:00 pm
content: Quote from: okw on December 28, 2024, 05:33:11 pmIt won't. It'll turn the LED on when the voltage approaches 4V, which is what the schematic attached to the original post will do.

author: okw
author_rank: Frequent Contributor
timestamp: December 28, 2024, 05:45:37 pm
content: Quote from: Zero999 on December 28, 2024, 05:41:00 pmThe green yes, but the red should turn on when voltage drops below ~3V.

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2024, 05:51:08 pm
content: Quote from: okw on December 28, 2024, 05:45:37 pmThat's not what the circuit attached to your original post will do.

author: magic
author_rank: Super Contributor
timestamp: December 28, 2024, 06:33:35 pm
content: Yeah, the original circuit works in reverse and it puts TL431 in series with the LED, so minimum supply voltage for operation is 2V + Vf or roughly 4V.I would recommend breadboarding before committing to production, but this below looks like it might just meet your performance specifications...It works by gradually stealing current away from G and towards R, using G as a voltage reference (resistor values assume Vf=2.25V).

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2024, 06:41:06 pm
content: That'll work.The LM393 is another option. Don't go for 3V, which is far too low for lithium ion. Aim for 3.5V. This uses the green LED as a voltage reference. The TL431 will give better results, but I wanted something cheap.

author: magic
author_rank: Super Contributor
timestamp: December 28, 2024, 06:44:23 pm
content: A subtle feature of my circuit is that its exact reference voltage is Vf(green) - Vbe(3904). People say that tempco of red LEDs is fairly matched to tempco of silicon diodes/transistors, so if green LEDs aren't very far away, the two coefficients roughly cancel and such reference should be more stable with temperature than either a transistor or an LED alone.

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2024, 08:18:03 pm
content: LEDs have a negative temperature coefficient, just like silicon. The ΔVF/ΔT curves for red appear to be the same shape as blue and pure green, just steeper, which reflects the higher forward voltage.https://www.ti.com/lit/an/slvaeb5/slvaeb5.pdf

author: nali
author_rank: Frequent Contributor
timestamp: December 28, 2024, 08:29:27 pm
content: An open-drain MCU reset supervisor should do this. One SOT23 device, one resistor, done.

author: Zero999
author_rank: Super Contributor
timestamp: December 29, 2024, 12:40:17 pm
content: How about the LM385?

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: December 29, 2024, 01:54:40 pm
content: When it comes to battery-powered projects, keeping an LED energized at all times is an issue to be considered. I don't see any need to indicate that the battery is sufficiently charged; it is enough to indicate with the red LED that it is time to recharge. Here is an example, in which the circuit consumes around 55µA, while the LED is not activated. Today's LEDs can also be used with very little current, and still achieve good brightness.

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: December 29, 2024, 02:18:01 pm
content: Quote from: nali on December 28, 2024, 08:29:27 pmIt is undoubtedly the simplest form. Low current consumption in Off and has an option for the desired reset voltage.https://www.lcsc.com/datasheet/lcsc_datasheet_2410010301_KEC-Semicon-KIA7029AF-RTF-P_C69759.pdf

author: inse
author_rank: Super Contributor
timestamp: December 29, 2024, 05:59:26 pm
content: Low Batt is usually a light that comes up when battery goes down.The reset generator pulls down a common anode LED when the voltage drops below specified level - BINGO

author: okw
author_rank: Frequent Contributor
timestamp: December 29, 2024, 06:04:00 pm
content: What about a dual opamp (to save space and cost)? One channel for low battery led and one channel for reset supervisor?Not sure if the esp32-c3 powered from battery really needs reset supervisor?

author: nali
author_rank: Frequent Contributor
timestamp: December 29, 2024, 06:05:18 pm
content: https://www.diodes.com/assets/Datasheets/APX803L.pdfQuote

author: nali
author_rank: Frequent Contributor
timestamp: December 29, 2024, 06:18:53 pm
content: Or another idea... use a pair of NPN as a long-tailed pair which will switch over from green to red rather than power both LEDs when the battery is low. There may or may not be an available reference voltage to use (maybe even Vcc if the MCU is powered by a LDO rather than direct from the battery)

author: okw
author_rank: Frequent Contributor
timestamp: December 29, 2024, 07:06:12 pm
content: Yes of course, would be better to switch, instead of blending colors.

author: Zero999
author_rank: Super Contributor
timestamp: December 29, 2024, 08:20:35 pm
content: Quote from: okw on December 29, 2024, 07:06:12 pmWhy didn't you say?Presumably you're not using the blue LED? Here's an idea which uses it as a reference. It'll obviously glow dimly, but shouldn't be noticeable. There is some overlap when both red and green LEDs are on, giving three colours: green, amber and red, as it discharges.

author: okw
author_rank: Frequent Contributor
timestamp: January 15, 2025, 02:59:13 pm
content: Quote from: Zero999 on December 29, 2024, 08:20:35 pmI didn't think about it, sorry. But thanks, that an excellent solution.Are there any pitfalls of increasing R1/R2/R3 10x or even 100x?With original 1.5k, 100R and 1k, it uses 1.4mA@3V to 1.84mA@4V (excluding red and green LED, blue is 100k as designed).15k, 1k and 10k, it uses 0.35-0.44mA.150k, 10k and 100k, it uses 0.25-0.31mA.The MCU is set to sleep after 20 minutes of inactivity (button press).Is it a good idea to add a MOSFET to switch the supply to the indicator circuit, so I can turn it off when MCU sleeps?I can place it at the beginning of the circuit cutting out everything, or I can place it on only the RGB anode. With the latter, I can PWM when battery goes low, to still provide dim power status, but greatly save power. That will of course mess up the reference (blue LED). What implications would that have? Is it better just turn off the whole circuit when MCU sleeps?

author: Zero999
author_rank: Super Contributor
timestamp: January 15, 2025, 09:09:52 pm
content: Why not turn off the power to the entire indicator circuit?Yes, the resistor values in the divider can be increased. Note the bias current of 25nA, so if you go very high, it will affect the voltages.Please build and test this circuit. I selected the resistor values based on the forward voltage for a typical blue LED, with an IF of an order or 100µA. Your LED might give different result. Also note that this circuit isn't very accurate. The forward voltage of the blue LED will be affected by temperature and even light shining on it.

author: okw
author_rank: Frequent Contributor
timestamp: January 15, 2025, 09:18:12 pm
content: The requirement is quite bright power LED when in use (will be used in a bright environment). But as battery is getting low, it would be nice to save power where I can, but not turn off the power LED functionality entirely.So using PWM I can turn down the LEDs quite a lot, and still see them.

author: okw
author_rank: Frequent Contributor
timestamp: April 03, 2025, 03:20:38 pm
content: Quote from: Zero999 on December 29, 2024, 08:20:35 pmI just received my board. The battery indicator looked good in simulations, but in experiments it's quite off.I'm using a lab supply as input to finely adjust and observe the LED. I see these changes now:Green: 4.18 ->Yellow: 3.90 to 4.17Red: <-- 3.89I have simulated all resistor values up and down to move the curve, then transfer some changes to the board, but it only changes slightly and green is still very narrow. I also tried with various potentiometers on R6 and R2. I'm up to R6=10M and that moves green down to 3.9 and with R2=2k makes yellow a bit wider, but I'm not sure if this is the right approach.Red should be "turn off and charge now" (5% capacity or so), and yellow could be the next 20%, green the rest.I'm not sure how to attack this. Should I also split R6 in two resistors and take out two references, and give each opamp separate references?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 03, 2025, 07:33:08 pm
content: Quote from: okw on April 03, 2025, 03:20:38 pmThat's expected, as you are hitting the limits of using a BLUE LED as a reference. A real BLUE LED will differ from the model.The LED Vf will vary with batch and temperature - how many of these are you making ?What precision do you really need, and what are your actual trip targets ?

author: okw
author_rank: Frequent Contributor
timestamp: April 03, 2025, 07:41:33 pm
content: Quote from: PCB.Wiz on April 03, 2025, 07:33:08 pmI'm making 50 pcs in each batch (now 5 pcs prototypes until everything is tested).I'm open to other suggestions than the blue LED.I'm not sure what limits are good? Maybe red at 3.6V and yellow at 3.7V?

author: Zero999
author_rank: Super Contributor
timestamp: April 03, 2025, 09:09:10 pm
content: Quote from: okw on April 03, 2025, 03:20:38 pmI did advise you build it first!What's the forward voltage of the blue LED? Measure it, then swap the blue LED in the simulation with a voltage source equal to the measured forward voltage. It should then match the real life results fairly closely.

author: okw
author_rank: Frequent Contributor
timestamp: April 03, 2025, 09:22:54 pm
content: Quote from: Zero999 on April 03, 2025, 09:09:10 pmI know you didBut I was in a hurry, and bot the RGB LEDs and PCBs would arrive approx. at the same time. So I chanced itI'll measure in a minute.

author: okw
author_rank: Frequent Contributor
timestamp: April 03, 2025, 09:47:09 pm
content: Quote from: Zero999 on April 03, 2025, 09:09:10 pmI measured one:2mA 2.64V (quite bright already, @1mA it's off)5mA 2.76V10mA 2.92V15mA 3.03V20mA 3.12VI set my PS at 5V, and current-limit at 2mA and slowly increase until 20mA.Which number do I use? The lowest(?), since the opamp is sinking negligible?Datasheet says 2.6-3.2V for the blue. Does That mean I can see quite big difference in the limits of red/green between various units?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 03, 2025, 10:20:55 pm
content: Quote from: okw on April 03, 2025, 07:41:33 pmThat's just under 3%, so I'd suggest you start with a proper voltage reference.Using more standard parts the TL431 of your heading, is ancient, you can do much better.ie chase down a 1.25V Vref with sub 100uA knee. 0.5% should still be cheap.You need two trip points, but ideally want a single reference, so set that shunt regulator up as an opamp with a feedback resistor from K to RIf I use a 1.244V 50uA ref, and 36k/82k divider with a 300k feedback resistors, that starts to ramp down & regulate at > 3.55V and saturates at > 4.10V, so you have an amplified 550mV span, with your setpoints within that.Inside that linear region, the R voltage is well regulated, so that can be one comparator IPAdd a dual comparator, and define your two setpoints to drive the LED.There are parts like lcsc CN305, that are 1.211 Vref and Dual Comparators, small and moderate cost, but a bit 'single-source' for my liking.

author: okw
author_rank: Frequent Contributor
timestamp: April 03, 2025, 10:30:46 pm
content: Quote from: PCB.Wiz on April 03, 2025, 10:20:55 pmThanks. I didn't quite get it. Would you mind sketching it up?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 03, 2025, 11:12:42 pm
content: Quote from: okw on April 03, 2025, 10:30:46 pmHere you go, using a TL431A (ugh) as that's the model I have handy, but the resistors can all scale upwards with a better regulator.Notice this model starts regulating at about 366uA, increasing to about 2.16mA in this circuit, where it saturates.Addit: if you have a PCB already done, you could just drop in a 2 terminal shunt regulator, instead of connecting to the blue LEDAddit2: If you are using a LM393, that's not rail-rail, so you need a low current, but higher voltage reference.That's less common, (Most xx431 are 1mA max), but they do exist :eghttps://www.lcsc.com/product-detail/Voltage-Reference_ALJ-TL431D_C22392283.htmlis 0.4% and 80uA max 2.495V

author: okw
author_rank: Frequent Contributor
timestamp: April 04, 2025, 12:18:31 am
content: Quote from: PCB.Wiz on April 03, 2025, 11:12:42 pmThanksSadly I only have a two 431 (FOSAN FS431S 0.5% (lcsc C2936844) and TL431 (lcsc C963380) and they're both 1mA.I have some other opamps and comparators in same package (OPA340UA, MAX4239ASA+, LM358, TL062C, TL072C, TL082IDR, AD8629ARZ, GS8558-SR) which I could maybe use in conjunction with the TL431, just to make these 5 boards work at least..And if I abandon the battery indicator on the already produced PCBs and revamp it for next batch. What would you suggest? Keep in mind no need for precision unless it's very cheap (I use lcsc). The indicator is just a heads up to remind to charge the battery.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 04, 2025, 12:53:55 am
content: Quote from: okw on April 04, 2025, 12:18:31 amPrecision and even low current comes pretty much for free, at least as far as moving to 0.5% and sub 100uA.You can use LM393 if you use a 2.45V ref, on the high side (ie swap the Blue LED for a Regulator). Just keep the inputs below Vcc-2VIt's a shame to not collect useful info so rather than abandon it, I'd use what you have and revise the BOM for final production.You can test using your FOSAN FS431S 0.5% parts, and then upgrade to sub 100uA models with a single resistor change.Another low IQ-2v5 option is lcsc PJSEMI-TL431LA C42405719 and Shenzhen-Fuman-Elec-431S C19630716

author: Zero999
author_rank: Super Contributor
timestamp: April 04, 2025, 07:07:33 am
content: Quote from: okw on April 03, 2025, 09:47:09 pmI meant the forward voltage of the blue LED whilst it's in your TL431 circuit.

author: okw
author_rank: Frequent Contributor
timestamp: April 04, 2025, 10:43:50 am
content: Quote from: PCB.Wiz on April 04, 2025, 12:53:55 amWith the 2.45V ref it's hard to keep inputs below Vcc-2v, even with full battery it's (vcc 4.2V - 2V < 2.45V ref).Or did I misunderstand?Would replacing the opamp be recommended? I'd prefer jlcpcb basic parts (LM324, NE5532, LM393, LM358, LM2904, TL072CDT) if suitable.I'm also gonna order a some parts from TME in a few days, so I would add everything I need for test (and breadboard it before ordering next batch of PCBs). I'll definitely add a few various sub-100uA vrefs, both 1.25V and 2.45-2.5V.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 04, 2025, 07:25:29 pm
content: Quote from: okw on April 04, 2025, 10:43:50 amYou put the VREF to the positive rail, same way as the blue led was used.the ref is then 0V until Vbat > 2.45V and is always 2.45V below Vbat.The comparators do not care which side the VREF sits, the resistors simply flip.

author: Zero999
author_rank: Super Contributor
timestamp: April 04, 2025, 09:51:43 pm
content: The reason for choosing the blue LED as a reference was simply to save cost and parts. The downside is loss of accuracy which you're clearly concerned about.Why complicate things? Simply switch the blue LED for the TL431 in my circuit and change the resistor values.

author: okw
author_rank: Frequent Contributor
timestamp: April 04, 2025, 09:59:15 pm
content: Quote from: Zero999 on April 04, 2025, 09:51:43 pmSaving cost and parts is great, but a TL431 won't ruin meI'm not too concerned about precision, unless it comes almost "free". But with the current setup, I couldn't get green unless i was over 4.17V which is like 95-98% charge. A little wiggleroom around the trigger points is ok, but I need to have green down to around 3.7V.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 05, 2025, 08:11:09 am
content: Quote from: okw on April 04, 2025, 10:43:50 amWired as in #52, a LM393 would work.Because this does notneed36V, the next enhancement you could consider is a CMOS comparator with inbuilt hyst and rail-rail input.This has lower Icc and lower IP bias current, so you can use higher divider resistors, further lowering current.That adds a few cents to the BOM, but works over a wider supply and avoids oscillations at the thresholds.An example would be 3PEAK LMV393TP-SR C97672 - not a great part number to clone off, but the data claims RRI and Hyst

author: Zero999
author_rank: Super Contributor
timestamp: April 05, 2025, 01:37:18 pm
content: Quote from: okw on April 04, 2025, 09:59:15 pmThe circuit will work with the blue LED used as a reference. You just need to know the forward voltage whilst it's in your circuit (measuring it at other currents is no good) then you can calculate the values of R1, R2, and R3.I used a website to help me to calculate the resistor values.http://sim.okawa-denshi.jp/en/teikokeisan.htmFirstly you need to know the voltages in your circuit, the reference voltage and the voltages when the red LED turns on (upper threshold) and the voltage when the green LED turns on (lower threshold).Here's an example.Upper threshold is 3.8VLower threshold is 3.3VReference voltage is 2V.Refer to the schematic on the potential divider calculator website.We need to calculate the voltages to enter into the website, in order for it to calculate the resistor values.Firstly set the power supply voltage V1 to the lower threshold.Calculate V3, which is simply the supply voltage minus the reference voltage.Now set the power supply voltage V1 to the upper threshold.Calculate V2 which is again, simply the supply voltage minus the reference voltage.We also need to recalculate V1, because the power supply voltage has increased, so it needs to be scaled up by a factor of upper threshold to the lower threshold.Enter the voltages calculated above into the calculator website:V1 = 3.8V2 = 1.8V3 = 1.4969For 24 resistors, it gives us:R1 = 1kR2 = 150RR3 = 750RThese are a little low, so the values can be all multiplied by a factor of 10, since it's the ratios which matter, not the values themselves.Put it all into SPICE to confirm it works.

author: okw
author_rank: Frequent Contributor
timestamp: April 09, 2025, 03:31:50 pm
content: Thanks for the help.I guess the blue LED is the most efficient way (compared to the 431 or any other cheap reference)?With 220k I just measured it in circuit to 8.2uA when battery voltage was 4.2V down to 5.1uA@3.5V.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 09, 2025, 08:07:12 pm
content: Quote from: okw on April 09, 2025, 03:31:50 pmDepends what ‘most efficient’ means.Those numbers are quite soft, and at low current you should measure 10 LEDs in also light and dark situations.If you want predictable and low cost, a VREF is hard to beat.Since you are driving LEDs, low current does not really matter.Where uA matter (non-LED) window detectors, the CN305 I mentioned before is hard to beat, very small, about 11uA and is VREF plus 2 comparators.For even lower current, you can pay a bit more and get BD48xx parts from ROHM.bd48w00g: Dual COMP and 1.200 Vref, Icc ~ 3uAbd48hw0g: Dual COMP and 1.277 Vref, Icc ~ 0.5uA 42V 0.75% 1nA

author: Zero999
author_rank: Super Contributor
timestamp: April 09, 2025, 09:09:29 pm
content: Yes, using the spare LED as a voltage reference is cheap, but it's much less accurate than a separate reference.Note that LEDs have a negative forward voltage/temperature coefficient, which isn't massive, but is fairly linear.Here's a plot for a 1N4148 model, showing the forward voltage vs temperature. It's probably not a problem if it's always around room temperature.The forward voltage vs current is logarithmic. Doubling the current increases the voltage by a fixed amount, about 30mV in this case. The X scale is logarithmic, yet the Y axis is linear, yet the plot is still a straight line. At higher currents the slope gets a bit steeper, but you're running the blue LED at a very low current, so it's irrelevant. Again, I doubt this is significant, as the current varies by only a factor of 2.