Light to voltage.... with a twist - Page 1
Forum section: electronics / beginners

author: PinheadBE
author_rank: Regular Contributor
timestamp: May 03, 2023, 10:36:44 am
content: Hi,I would like to dim a bunch of rainbow fading LED's depending on the ambient light level.- PWM is not usable because of the nature of the LED's (they contain an IC)- A LDR has a non-linear output which does not suit my need- The rainbow LED's need at least 2.5 - 2.6 V to work properly- I have a single +5VDC power supply available- I'd like, if possible a 100% analogue solution (I know it would be very easy with a µC, but I need to refresh/learn again my analogue basics :-) )I plan to use a TSL257 (https://ams.com/documents/20143/36005/TSL257_DS000140_3-00.pdf) light-to-voltage converter. Its output is (almost) linear, rail-to-rail and thus, swings from 0V to 5VBut that output voltage (0 -> 5 V) should be converted to 2.6 -> 5 V.That new voltage will then drive a power transistor which drives the LED'sHow ? An op-amp seems obvious, but what about the offset ?(If needed, I have plenty 2.5 V references in stock)Any help welcomed

author: Ian.M
author_rank: Super Contributor
timestamp: May 03, 2023, 11:06:25 am
content: As blue LEDs have a significantly higher Vf (typ. 3V) than red and green ones, I wouldn't expect satisfactory results below about 3.5V. As you reduce the voltage, the blue will dim much faster than the other two component colors, and will rapidly tend towards cut off below 3V. Is the brightness range that you can get above 3V worth it?Also, a power transistor as an emitter follower will introduce a voltage drop - at best, you'll be loosing about 0.7V, so if you start with a 5V supply don't expect more than 4.3V out at max. brightness!A simple potential divider between the sensor output and +5V can scale and offset your output voltage. 24K to 5V and 27K to the sensor output should get you in the ballpark. Follow it by a unit gain buffer.

author: Psi
author_rank: Super Contributor
timestamp: May 03, 2023, 11:45:10 am
content: You could use a photodiode for better light sensing linearity.But since you want a 100% analogue solution I'm guessing you're trying to make it difficult on purpose.So maybe the LDR is a requirement.

author: PinheadBE
author_rank: Regular Contributor
timestamp: May 03, 2023, 02:15:45 pm
content: The problem of the LDR is its non-linearity; that's why I try with the TSL257 which is almost perfectly linear.For the VCE drop, I will use a very low VCEsat transistor (less than 300 mV)I also tested those rainbow LED's, and, to my surprise, even the blue chip works from around 2.6 V on. I didn't expect it, but it worked, and the IC was also still doing its job of sequencing the colors...

author: Ian.M
author_rank: Super Contributor
timestamp: May 03, 2023, 03:01:27 pm
content: Fair enough, they are your LEDs and you know best if they'll function adequately from 2.6V upwards.The VCE.satisn't relevant as its less than VBE, and to buffer a voltage, it needs to be an emitter follower, so the limit on the emitter voltage is how high can you drive the base, i.e. 5V, your supply voltage on the base gives you a VBEdrop less at the emitter. You could use a 3 pin adjustable LDO regulator rather than an NPN emitter follower, driving its Adg pin with a control voltage, which would let you get closer to the 5V rail, but I suspect that the total current of a 'bunch of LEDs' may be too high for that to be viable. Measure the max. current drawn by one LED and tell us how many LEDs you have in parallel, and we may be able to come up with better suggestion.

author: Kim Christensen
author_rank: Super Contributor
timestamp: May 03, 2023, 04:54:15 pm
content: Have you thought of converting the ambient light level to a varying current source (Or sink) instead of a varying voltage source?Might be easier to implement, since LED brightness is easier to control that way.

author: PinheadBE
author_rank: Regular Contributor
timestamp: May 03, 2023, 10:25:58 pm
content: @Ian: The current is fluctuating with the color displayed. When its white (all 3 LED's lit up), I measured 20 mA (VCC = 5 VDC; R in series = 100I will have 270 LED's, that's a whopping 5.5 A draw......The whole thing could be divided in 6 parts, each with 45 LED's, drawing around 900 mA.It was not my initial intent, but it can be done if it simplifies the choice of componentsThe initial problem remains: how to convert the 0..5V output of the sensor in the 2.6..5V rangeI know it could be easy done with a µC : Read the sensor with a ADC, convert the value to be in the suitable range, and output it through a DAC and an unity gain op amp to beef it a little so it can drive the transistor. A 8 pins PIC16F17114 already contains all those peripherals and will do the job with almost no externa component....But, except if it REALLY too difficult, I would like to try with an op-amp. Isn't it possible ?@Kim: For those rainbow LED's, constant current is not an option, since the current draw varies depending on the state (coulor displayed) it is in

author: Ian.M
author_rank: Super Contributor
timestamp: May 03, 2023, 10:49:05 pm
content: Certainly its possible to map 0 - 5V to 2.6V - 5V with an OPAMP. All you need is two resistors and a RRIO OPAMP.As I mentioned above, 27K between sensor and OPAMP +in, 24K between +in and +5V, and OPAMP -in connected to out so its configured as a unit gain buffer.A bigger problem is the current draw. If you go for the simplest emitter follower option, for 5.5A, depending on the transistor, you could need over 200mA of base drive, too much for an ordinary OPAMP.You'll also have close to 4W of heat to get rid of so it will definately need heatsinking.IMHO the only sane option here is to use a 10A stepdown (buck) converter module, preferably with synchronous rectification for efficiency (i.e. two MOSFETs rather than a MOSFET and Schottky catch diode), and inject current at its controller chip's feedback pin to fool it into reducing its output voltage as required. Details to follow if you go that route.

author: PinheadBE
author_rank: Regular Contributor
timestamp: May 03, 2023, 11:13:39 pm
content: RRIO ? What is this ?For the current draw in the base, this could indeed be a problem.I looked for the stepdown, but with my limited knowledge, the only thing I could envision were those cheap e-bay modules.For a 10 A capable one, i recently found a step up/down module based on LTC3780, with CC, CV, and under-voltage on various well known websites. (Example:https://www.aliexpress.com/item/32902533475.html), but I haven't dig into the datasheet of the controller yet

author: Ian.M
author_rank: Super Contributor
timestamp: May 03, 2023, 11:32:21 pm
content: https://www.analogictips.com/amplifiers-rail-to-rail-single-supply-mean/explains RRIO.A 10A*LTC3780 based module could certainly do the job. Inject current to its Vosense pin through an extra resistor, (only a few mA or less depending on the lower feedback divider resistor), and you can drive its set output downwards to about 1V. Use an inverting OPAMP to invert, scale and offset the sensor voltage to get the dimming range you require.* 10A because Chinesium!

author: EPAIII
author_rank: Super Contributor
timestamp: May 04, 2023, 10:49:13 am
content: And just what makes you believe you want/need a linear relationship between the light level and the Voltage to the LEDs?Our eyes do not respond to light in a linear fashion.LEDs do not produce light in a linear relationship to the Voltage driving them.And we probably do not perceive the differences in two light levels, the ambient and that of the LEDs, in a linear fashion.Not trying to rain on your parade and it may come out the way you want, but then, it could easily not.A microprocessor based system could be adjusted more easily if needed. All that would be needed is a simple look-up table in memory. Of course, OP amps can have non-linear response curves.

author: PinheadBE
author_rank: Regular Contributor
timestamp: May 04, 2023, 11:21:12 am
content: @Ian : OK, I got it (RRIO). I didn't know the acronym. Thanks for the link, it is very useful litterature. I will read it carefully.In the meantime, I saw some reviews (including YT videos) of the LTC3780 based modules and they seem a bit crappy.... I think I will stay away from it@EPAIII: You may be right. I may be totally wrong in my assumption. In my past projects, I always used an LDR connected to an ADC in a µC and the results drives a PWM signal to dim the LED's, or a direct output to the LED drivers (I²C, SPI, whatever). This gives good results, even with the non-linearity of the LDR. But PWM being not an option here, and the only control chip being inside the LED case and being totally on its own, I was looking for another way to go, and came up with the idea of doing it 100% analog, for a change.All in all, this seems to become overly complicated for what it's worth, and maybe I'll choose another simplier project/use case for going analog.For now, I will going back to finish my other project (simplier in design but difficult in implementation with a complex PCB layout....)Thanks for your help, I will certainly come back to this project in a few weeks.See you then !