Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Linearizing help

Status
Not open for further replies.

D.M.

New Member
I have a photoresistor with a range of about 200Ω-20+MΩ. So the photoresistor is basically 'open' in darkness and a 'short' in full light (ideally).

So im writing a program that duties an LED. the duty is based the amount of clock pulses during the RC decay time in which the photoresistor is connected. I have a working model of what im trying to achieve, however, im never completely satisfied so i wanna refine it.

I want to ask anyone here if they know of a way of linearizing the photoresistor so the response to my system is a little more gradual as light changes. Im not sure if the photoresistors resistance as a function of Luminosity is exponential so i dont want to assume i can run it through a log amp or some other technique.

I've searched and heard about lookup tables. Ill have to research this myself, but i was looking for some other advice.

Im rushing out the door right now and wanted to get a post out so i bet this is a little unclear, but any help would be cool.
 
It could be difficult. Light intensity varies a huge amount between "enough light that you don't bump into the furniture" and full sunlight. I think that you are looking at a 1000:1 or 10000:1 ratio.

The result of that could be that you need to work with 16 bit or longer numbers.

A lookup table is used where there is no easy mathematical relation between the input and output of a function. You just have a big table of values. If the input to the function is n, the output is just the nth entry in the table.

However you need to be able to write the table, and I can't help you with that. Do you have any exact measure of what you want the LED to do in a particular lighting condition?

Also, if you have a very wide range of input values, the table could become too big to handle. You don't say what you are writing the programme on. If it is a PC, a couple of MB of table is not a problem. On a microcontroller you have to be more subtle.
 
well the number i output from my controller correlates clock pulses during logic high times. when fully lit (my desktop with a 20watt cfl) the output is a 'number' say 50. when i completely cover the sensor the output is like 32000... small changes in light result in huge changes in clock pulse counts i was wondering if there are any techniques to come close to a linear output. otherwise i could have an object blockling light from sa 6'' away and the number is X... if i move an inch close the number greatly increases, and so on.

How would i implement a lookup table. Are those to force feed results we desire. for example if my output 'number' is between 50 and 150 luminosity is near normal, LED does not need to be fully lit, so i force a 10% duty... if the 'number' i output is like 150 to 500 then the LED needs tobe a little brighter, and so on... So for the lookup table do i just write conditional statements to force the values i want?

im so tired so im sure this is a crappy attemp at asking for help. my apologies
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top