Pages: [1]   Go Down
Author Topic: Modern Device/Liquidware AMBI light sensor calibration problem  (Read 2887 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

Problems trying to use the Modern Device/Liquidware AMBI light sensor.  It sounds great from the description,
but I don't see many examples using it successfully because of the log conversion needed.

Sorry if this has been discussed before, but the one thread I found in the old forums is incomplete
and the code snippets don't seem to work:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1281333002/all

Here's the sensor datasheet:

http://sharp-world.com/products/device/lineup/data/pdf/datasheet/ga1a1s201wp_e.pdf

with the relevant uA vs Lux graph attached.   

So here's the sample code based on the thread last fall:

Code:

int ambipin=5;

void setup() { 
Serial.begin(9600);
}

void loop() {
int voltage = analogRead(ambipin);
Serial.print(" AMBI voltage="); Serial.print(voltage);
float current = voltage * 3.3 / 1023.00; // 3.3V feeding sensor
Serial.print(" Current="); Serial.print(current);
float light = pow(10, current);
Serial.print(" Light="); Serial.println(light);
delay(3000);
}


BUT, notice the AMBI raw voltage bouncing on a well-lit workbench with a constant EV=9 (measured by a LunaPro meter) even with a 3 sec delay.
It should return constant values 0-1023 from 0-3.3V (not that using 5V made much difference)

 AMBI voltage=12 Current=0.06 Light=1.14
 AMBI voltage=25 Current=0.12 Light=1.32
 AMBI voltage=12 Current=0.06 Light=1.14
 AMBI voltage=20 Current=0.10 Light=1.25
 AMBI voltage=21 Current=0.10 Light=1.27
 AMBI voltage=4 Current=0.02 Light=1.05
 AMBI voltage=15 Current=0.07 Light=1.18
 AMBI voltage=12 Current=0.06 Light=1.14

Second, the current should be between 5 and 45 uA, so that's off, and so of course 10 exp current is off too.
Any thoughts?

Thanks.

Dan

 


* Capture.JPG (40.03 KB, 642x295 - viewed 25 times.)
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sensor provides current output, but analogread gives a voltage.
It's not clear where in your math transformation between two physical value happened?
Usually resistor is a transformer, R = U / I = 3.3 / 45 uA = 73.333 k. between output and ground,
so when current reach a maximum value, voltage will be at maximum too.


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The AMBI has a (measured) 17k resistor and small cap in it as well (See attached closeup) between V0 (Arduino A5) and Vcc (+3.3) and Gnd respectively.  So E=IR, the AMBI presumably turns the current output into a voltage the Arduino analog pins can read.


* Capture1.JPG (26.81 KB, 349x434 - viewed 21 times.)
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I suppose Liquidware try to keep size of the board as small as possible,
and degrade precise instrument to hobbyist level the same time.
It's sad to say, you can't get any meaningful measurement results from their board, it good only
to estimate "more light" or "less light". Board taking ground from analog pin, that is floating between 0 and 0.8 V, the worst scenario for any designer.
 The solution, IMHO, use piece of wires to connect 3.3V and GND directly from arduino board, not using analog pins at all.
 Resistor has to be included in the math, if you keep it,
 Btw, if it's connected to +V power, it make output "reverse", more light/current setting lower output.
With maximum exposure, I = 45 uA, so voltage Vout = 3.3 - 45 * 17 * 10^-3 = 3.3 - 0,765 = 2.535 V. That not so bad, but not optimal ether.


 
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just re-read old forum, guys say that   resistor 100 kOhm to ground,
so last sentence in my previous post should be ignored.
And R value have to be in formula anyway.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I asked the Liquidware guys if they could supply a schematic of how the resistor and cap are wired.
Trying to follow the traces in a magnifier with a multimeter, it looks like board pin Vcc (marked +5)
has the SM resistor to board pin V0, and the SM cap between Vcc and board Gnd pin.  The SM resistor
(no markings) in circuit measures 17.7k but of course that's measuring the sensor too.  The resistor and cap
are in series V0 to Gnd.


* Capture3.JPG (21.33 KB, 467x240 - viewed 32 times.)
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

O'k, nice you have a DMM.
Liquidware provide an example of scetch, that configure two analog pins as digital with "high" A4 and "low" A5 state - create  a power for sensor, have you include it in your code? I can't see in the original post, probably that part of the problem.

Than , after configuring this pins, can you measure a voltage on this pins relatively to real GND?
I hope it could be not so bad from measurements point of view, as sensor consume a very small amount of current, there is a chance that  imaginary "gnd" (analog pin A5 with "low" state) stay pretty close to natural ground, with difference in mV area.
 Imaginary + power (analog pin A4 with "high" state) will be around 4.5 V, and this value have to be included in the equation/formula, if board will be connected as it design.

* Light_Sensor_Cheatsheet_1.pdf (207.55 KB - downloaded 20 times.)
« Last Edit: June 01, 2011, 10:57:04 am by Magician » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
O'k, nice you have a DMM.

Yes, a nice new tiny Amprobe PM55A that autosenses R and VDC and VAC, so you only have to select continuity,
elec field sensing, freq, cap, current, or HiZ V.  Amazing what US$45 buys in a DMM these days.

Ok, I should have said that it's not wired like the Liquidware Light_Sensor_cheat_sheet.  I have board Vcc
and Gnd wired to the Arduino 3.3v and Gnd, not using the analog pins for those.  Only A5 is connected
to the board V0.    Measuring HiZ V0 to real Gnd is 0.00V, so it's not dragging it down.   

Dan



Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the HiZ?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What is the HiZ?

Oh, the autosense R/VDC/VAC function defaults to Lo Z, so you can check VDC/VAC
with Hi Z like a regular DMM in circuits like this where it might drag it down.

Paul from Modern Device got back with the below:

>> Problems trying to use your AMBI light sensor. It sounds great from
>> the description, but I don't see many examples using it successfully
>> because of the log conversion needed.
>
> Most people don't bother converting to LUX and just use the output -
> which unlike everything else on the market - has an intuitive
> relationship to the way people see light.

Yes, that is simplest, but my application is a logging light sensor for PV panel placement,
so I need to actually calibrate it against my old Gossen LunaPro's EV reading, and not just
"bright" and "dim" like any  photocell can do.  I'm thinking now I should have gotten the TSL230R
and counted frequency but the AMBI looked like it could be calibrated.

>> AMBI voltage=4 Current=0.02 Light=1.05
>> AMBI voltage=15 Current=0.07 Light=1.18
>> AMBI voltage=12 Current=0.06 Light=1.14
>
> I believe what you are seeing here is the sine wave inherent in your
> "well-lit workbench" If you have fluorescent lighting it's really
> noticeable and even with incandescent lighting there is a really
> definite sine wave riding on the "average" value. We just can't see it
> because our eyes are so slow.

Good point, didn't think of the effect of flicker on a fast sensor.
Probably ought to try it outside.

> But I do agree those raw readings are too low for a well-lit bench -
> they should be in 300 to 500 range. Let me know what your results are at
> 5V - maybe you need a new sensor.

> Here's the cure:
>
> long total = 0;
> start = micros();
> int i = 0;
> while(micros() - start < 16666){ // if you're in Europe please use 20000
> total += analogRead(ambipin);
> i++;
> }
>
> average = total / i; // make sure you're not overrunning the long
> variable too - you might need a small delay in the loop
>
> report back your results and see if that hasn't fixed the "flicker"
> also drag the sensor out in the sun and see if the flicker goes away.
>
> Other ideas:
> The datasheet recommends a 47 or 50K resistor - I'm using 100K for a
> little more sensitivity on the low end - it will saturate on the high
> end. (daylight) For outdoor use just use a 100K resistor in parallel
> with the output for a total of 50K

Thanks, will try those things.

> It's a high impedance circuit so make sure you have cleaned the pins
> with isopropyl alcohol after you soldered them on.
>
> I haven't used the sensor much at 3.3V so let me know your results. It
> may saturate a lower voltage since your supply is lower.
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2573
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, take in account flickering of the artificial lighting make sense, only priority should be given
to resolve an issue why is reading 15 - 30 times lower than expected.
Quote
Measuring HiZ V0 to real Gnd is 0.00V, so it's not dragging it down. 
What you are saying there is no signal? I don't understand. It must be some voltage on build in 100 k resistor.
Quote
Let me know what your results are at > 5V - maybe you need a new sensor.
According to data sheet:
■ Recommended Operating Conditions
Parameter  Operating supply voltage   Illuminance range
(Ta = 0°C to 70°C)
Symbol         Min.    Max. Unit
VCC               2.3     3.2   V
EV                 3        55000 lx

Max voltage is 3.2 V, probably it will works at 5 V also, but I'm not sure if it'd still provide linear output.

And last comments,
Quote
light sensor with a spectral response similar to that of the human eye.
But it's not a case for PV panel, haven't read any spectral data for PV recently, I suggest their
max sensitivity area shifted in UV, as more energetic part of spectrum, not 550 nm as for human.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Modern Device thinks the AMBI is bad and is replacing it.  Thanks for your help.  Dan
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

this reply could be very interesting to me, since I'm trying to understand the behavior of this sensor:
I explain my problem here: http://arduino.cc/forum/index.php/topic,133522.0.html
I'm understanding that this could be an electrical issue, that is the sensor output has an output voltage range
that arduino misinterprets but I can't get out of this.

Can you help me? Thanks

Elina

Sensor provides current output, but analogread gives a voltage.
It's not clear where in your math transformation between two physical value happened?
Usually resistor is a transformer, R = U / I = 3.3 / 45 uA = 73.333 k. between output and ground,
so when current reach a maximum value, voltage will be at maximum too.



Logged

Pages: [1]   Go Up
Jump to: