How to get a photoresistor to output 0-4 V? - Page 1
Forum section: electronics / beginners

author: Yannick
author_rank: Newbie
timestamp: January 09, 2013, 01:57:15 pm
content: Hi there,I'm quite new to electronics but found a little project I could work on for a brightness controlled indirect LED light for our livingroom. For that, I would like to drive the LEDs via a current limited voltage regulator (found some nice schematics for that), controlling the voltage with a photoresistor. Now it would be great to accomplish that directly with a photoresistor-voltage-divider-thingy, generating a voltage of 0-4 V from the 6.3 V DC input to adjust an LT3080. I have a 10k to 1M Ohm photoresistor but can't seem to get my mind around the values for the divider...Is there a way to do that (shure there is, im just not seeing it...) or do I have to take a different approach?I could read the sensor with an arduino and write the voltage directly to an output pin, but I really want to keep it as simple as possibleYannick

author: selkathguy
author_rank: Unknown
timestamp: January 09, 2013, 02:40:35 pm
content: I am new here myself, but I think there should be a very easy way to do this. Does it need to be intelligent in any way? If not, then I'd say an Arduino would be a bit much.I think you wouldn't want to change your voltage as much as your current running through it(?). Not sure what best practice is for those kinds of applications but once you've got your 3 volts or whatever couldn't you just use the photodiode to limit current o that it stays dim/off and saves energy.+3v --- [nominal series resistor?] --- photodiode --- LED --- GroundYou may not even need that series resistor. Probably not, because you're never going to have a short condition with a photodiode like that I don't think.I hope someone can correct me and set me straight.

author: robrenz
author_rank: Super Contributor
timestamp: January 09, 2013, 02:56:16 pm
content: Start hereand remember these can only handle a few hundredmilliwatts so you can't run your current for the leds directly thru it.

author: selkathguy
author_rank: Unknown
timestamp: January 09, 2013, 03:03:27 pm
content: Ah I missed the part where he was using a bunch of LEDs. My mistake.

author: TheRevva
author_rank: Regular Contributor
timestamp: April 10, 2013, 10:50:21 am
content: Purely FYI...The intensity (brightness if you will) of an LED is horribly non-linear w.r.t. the supplied current.In other words, if you get a perceived intensity of 'X' when driving it with 20mA, that does NOT mean you'll have an intensity of X/2 by simply dropping it down to 10mA...This is why any _serious_ attempt at controlling the perceived light output from an LED (or any cluster thereof) is normally done using PWM - Pulse Width Modulation.Your next 'issue' is that the Mark-I human eyeball is also somewhat non-linear in its response.I have a set of LED display boards down at the drag strip with quite a decent number of LEDs spread across the 4 * 4 digit displays (6440 of them to be precise, all soldered by hand... <Sigh>)At full brightness (100% PWM duty cycle), they're plenty bright enough to be seen from 1/4 mile away on a bright sunny day (which is the whole point of a drag strip afterall).However, at night time, they appear so darned bright that the segments 'bloom' into each other making the displays hard to read. They were simply TOO bright with the high contrast of a clear night sky. I wanted to be able to 'dim them down' for the night meetings, so I initially tried a 50% PWM duty cycle. While that definitely made a difference, my 'Mark-I eyeballs' certainly didn't perceive them to be half as bright, and I ended up selecting a 25% duty cycle which, to my completely subjective eyeballs 'appeared' to be about half as bright. (Perhaps it's an inverse-square relationship?).The frequency I chose for the PWM modulation was approx 400Hz so that is stayed comfortably above the human eye 'flicker perception' rate. I didn't want to go TOO high because the cabling to the furthest digit from the corresponding ULN2803A drivers was almost 15 meters! (In hindsight, I didn't really need to be too concerned about GENERATING any stray EMI. Any EMI I was producing was positively trivial in comparison to a Top-Fuel dragster with a pair of 44AMP magnetos pushing out 50kV or more to each spark plug [aka spark gap transmitter])When the displays were initially built, the cost of 8000mcd 30 degree LEDs was 'orders of magnitude' more than it is today. If I was to start again today, I'd be building them as full colour (RGB) dot matrix displays instead of the present 7 segment displays and it'd be around the same overall cost... <Sigh>Best of luck to you though

author: Rick Law
author_rank: Super Contributor
timestamp: April 10, 2013, 06:08:34 pm
content: Quote from: Yannick on January 09, 2013, 01:57:15 pmVoltage divider is two resisters in series connected to the voltage source:V(source)+R1 (Voltage drop here is V1)You tap into it here (call it Vtap)R2 (Voltage drop here is V2)GroundWhen resisters are in series, the final resistance is summed. So between Vsource and Ground, the total resistance is R1+R2. Let’s list all the facts we know:R total = R1 + R2V total = V1 + V2You tap in the middle, soV tap = V2, ie: V2 is what you get.So, let’s see the math: (Or skip forward to the formular point marked with asterisk)Vsource = V1 + V2Recall Ohms Law, V=I*RThe current going through R1 and R2 is the same current, so "I" here needs no subsript. I1 = I2 = ISo,Vsource = V1 + V2 becomes:Vsource = (I * R1) + V2-or, to make it easier to type:Vs = I*R1+V2- since you want to find V2, so move V2 side of the equation to the leftV2 + I*R1 = VsV2 = Vs - I*R1 ... lets call this equation 1The total voltage drop is Vsource, and the current is "I", and the total resistance is the sum of the two, so Ohms law gives you:Vs = I*(R1+R2)-move "I" to the other sideI * (R1+R2) = VsI = Vs / (R1+R2)Substitute the “I” back in equation 1V2 = Vs - I*R1 … this is equation 1V2 = Vs - (Vs / (R1+R2) )* R1 … replaced the “I”V2 = Vs – Vs*R1 / (R1+R2) ... multiplied R1 and VsV2 = Vs ( 1 – R1/(R1+R2) ) ... undistributed Vs according to distributive law*** If you skipped the math, come to this point ***So, here it is; when you tap into the middle of two resistors (top being R1, bottom being R2), your voltage is:V2 = Vs ( 1 - R1/(R1+R2) )When R1=R2, R1/(R1+R2) is 1/(1+1) = 1/2, thus V2 is half of Vs.The higher the R2, the smaller is R1/(R1+R2), thus V2 is closer to Vs.The higher the R1, the larger is R1/(R1+R2), thus V2 is closer to 0.Calculating it out may be difficult and matching the resistors may be difficult. So, consider using a trimpot. Replace R1 (or R2) with a trimpot, and let your photo resistor be the other R. Now you can experiment with it to set the trimpot at a point where max/min light gives you the V2 range you want.Hope this helps...RickEdited:SINCEQuote from: robrenz on January 09, 2013, 02:56:16 pmOnce you get the volts correctly from the voltage divider, consider feeding that into an MOSFET. So, your V2 max is what the MOSFET needs to get to max brightness, and your V2 min is your room is already bright enough.

author: psycho0815
author_rank: Regular Contributor
timestamp: April 11, 2013, 07:12:53 am
content: Well, personally i'd just take an attiny and a mosfet and use PWM to control the brightness, but than i'm a digital guy.Apart from that, do you have a schematic for that? It's not really clear to me how you would get from your 0-4V to a constant current.Cheers,Psycho