Author Topic: How to get a photoresistor to output 0-4 V?  (Read 3529 times)

0 Members and 1 Guest are viewing this topic.

Offline YannickTopic starter

  • Newbie
  • Posts: 1
  • Country: de
How to get a photoresistor to output 0-4 V?
« on: January 09, 2013, 01:57:15 pm »
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 possible ;)

Yannick
« Last Edit: January 09, 2013, 02:18:48 pm by Yannick »
 

Offline selkathguy

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: How to get a photoresistor to output 0-4 V?
« Reply #1 on: January 09, 2013, 02:40:35 pm »
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 --- Ground

You 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.
« Last Edit: January 09, 2013, 02:42:06 pm by selkathguy »
 

Offline robrenz

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
  • Real Machinist, Wannabe EE
Re: How to get a photoresistor to output 0-4 V?
« Reply #2 on: January 09, 2013, 02:56:16 pm »
Start here and remember these can only handle a few hundred milli watts so you can't run your current for the leds directly thru it.
« Last Edit: January 09, 2013, 03:04:11 pm by robrenz »
 

Offline selkathguy

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: How to get a photoresistor to output 0-4 V?
« Reply #3 on: January 09, 2013, 03:03:27 pm »
Ah I missed the part where he was using a bunch of LEDs.  My mistake.  :-X
 

Offline TheRevva

  • Regular Contributor
  • *
  • Posts: 87
Re: How to get a photoresistor to output 0-4 V?
« Reply #4 on: April 10, 2013, 10:50:21 am »
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
 

Offline Rick Law

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Re: How to get a photoresistor to output 0-4 V?
« Reply #5 on: April 10, 2013, 06:08:34 pm »
... I'm quite new to electronics ...  I have a 10k to 1M Ohm photoresistor but can't seem to get my mind around the values for the divider ...

Voltage 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)
    Ground

When 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 + R2
 V total = V1 + V2
 You tap in the middle, so V 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 + V2

Recall Ohms Law, V=I*R
The current going through R1 and R2 is the same current, so "I" here needs no subsript.  I1 = I2 = I
So,
  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 left
  V2 + I*R1 = Vs
  V2 = Vs - I*R1       ... lets call this equation 1

The 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 side
  I * (R1+R2) = Vs
  I = Vs / (R1+R2)

Substitute the “I” back in equation 1
   V2 = Vs - I*R1            … this is equation 1
   V2 = Vs - (Vs / (R1+R2) )* R1        … replaced the “I”
   V2 = Vs – Vs*R1 / (R1+R2)         ... multiplied R1 and Vs
   V2 = 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...

Rick

Edited:
SINCE
Start here and remember these can only handle a few hundred milli watts so you can't run your current for the leds directly thru it.

Once 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.
« Last Edit: April 10, 2013, 06:17:01 pm by Rick Law »
 

Offline psycho0815

  • Regular Contributor
  • *
  • Posts: 150
  • Country: de
    • H-REG Blog
Re: How to get a photoresistor to output 0-4 V?
« Reply #6 on: April 11, 2013, 07:12:53 am »
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
If you like, check out my blog (german):
http://h-reg.blogspot.de
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf