Go Down

Topic: Modern Device/Liquidware AMBI light sensor calibration problem (Read 3 times) previous topic - next topic

Dan Magorian

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: [Select]


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


Magician

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.



Dan Magorian

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.

Magician

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.



Magician

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.

Go Up