# Photo IC light sensor

Hello everyone,

I am trying to get a Panasonic Photo IC light sensor to work. (AMS302) What I am stuck on is the way to calculate the lux from the sensor. On the DataSheet the relation between the lux and the current is see on page 2, first graph of the second row. its a log log linear relation between the current and the lux. now at 0 lux there is a current of 0.3 microAmps (page 2 top table) and against a fluorecent light, at 5V the current is 13 microAmps for 5lux.

wth this I should have a slope, and a intercept. now the problem is, the current "dependant" on the lux, when I try to switch the variables, nothing works....

To get the current, I analogeRead the pin that is connected to the sensor, convert that to voltage, and using the resistance of 100,000,000 ohms (100Mohms) from the data sheet of the arduino, I can get its current (V=IR).

knowing that the straight line slope for a log log funtion is Y=ax^k, switching y and X you then get Y=(x/a)^(1/k)

again, everything is just not working.

any help would be wonderful

From the description, it sounds like you are confused about how to measure the current (the Arduino input resistance is not appropriate). Post a schematic diagram of how you have connected the sensor and the Arduino. A scan or small photo of a hand drawn picture is fine.

here is the circuit. And you are right, I am having a lot of difficulty figuring out the current. You have it wired appropriately. The current is given by Ohm's law: I = V/R where V = voltage from ADC reading, R = 10K ohms.

For 260 uA current at 100 lux under fluorescent lighting, you expect the ADC to read the equivalent to 2.6 volts.

just ran a quick test, at about 100lx i am getting 2.6 as the volts. here is the code to calulate the volts. if you needed it. also the code for calutalting the lux is there

``````float int_Rex = 10000;

***********
float volt = Raw*(5.0/1023.0);
float amp = volt/int_Res;
``````
``````    float lux= pow(1.5888*amp,0.3846);
``````

the lux calulation is after I did the inverse of y=(0.3)X^(260/100)

the 0.3 is the current when lux is 0, and the 260/100 is 260 micro amps at 100 lux.

the inverse would allow me to find the lux for any given amp. as oppose the to the other way around.

ok, Time to put down all my findings. I dont like to leave stuff half finished or hanging if I gave up. This is a half give up, half not give up. Turns out this sensors range is too small for the application I want it for. so I need to switch to a different sensor.

some of this info might be redundant in terms of the data sheet, but this will be a nice summed up version of it all.

The sensor is NaPiCa in chemical composition, with a built in op-amp to have a better response and gives out a "linear" response in a log log scale.

1. the range of this sensor seems to be 3 to 2000 lux.

2. for calculating the equation for finding the lux: from the data sheet you have 5lx @ 13microamps, and 100 lx @ 260 microamps. using y=cx^m, you have 2 equations, 2 unknown. so BAM you have an equation.

3. code: for calulating the lux value in the program it is adjusted slightly, so it will not match the equation exactly.

``````  float Raw = analogRead(s_pin_A5);
float volt = Raw*(5.0/1023.0);
float amp = volt/int_Res;

float lux =.609*pow(amp,.820825);
``````

I used a variable resistor to change the resistance to what I want. This came about from looking at this document, Document Power Point.

page 11 has the change in sensitivity vs resistance. and page 14 has the linear stuff.

that is all I have. and at this point I will be switching to a different sensor that has a higher range for the lux. hopefully this will help anyone who is working with this sensor.