Home CodeArduino micro:bit and LX1972 light sensor example

micro:bit and LX1972 light sensor example

by shedboy71

The LX1972 is a low cost silicon light sensor with spectral response that closely emulates the human eye. Patented circuitry produces peak spectral response at 520nm, with IR response less than ±5%, of the peak response, above 900nm.

The photo sensor is a PIN diode array with a linear, accurate, and very repeatable current transfer function.

High gain current mirrors on the chip multiply the PIN diode photo-current to a sensitivity level that can be voltage scaled with a standard value external resistor. Output current from this simple to use two-pin device can be used directly or converted to a voltage by placing it in series with a single resistor at either of its two pins.

Dynamic range is determined by the resistors (typically in the range of 10K to 100K) and power supply values. Typically the LX1972 needs only 1.8V of headroom to operate at 1000 Lux illumination.

Internal temperature compensation allows dark current to be kept below 200nA over the full specification temperature range (-40 to +85°), providing high accuracy at low light levels. Usable ambient light conditions range is from 1 to more than 5000 Lux.The LX1972 is optimized for controlling back lighting systems in low cost consumer products such as LCD TV, portable computers, and digital cameras.

FEATURES:
1. Near Human Eye Spectral Response
2. Very Low IR Sensitivity
3. Highly Accurate & Repeatable Output Current vs. Light
4. Scalable Output Voltage
5. Temperature Stable
6. Integrated High Gain Photo Current Amplifiers
7. No Optical Filters Needed

Connection

 

micro:bit connection module connection
 Gnd GND
 3v3 VCC
P0 output

Code

[cpp]
void setup()
{
Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}

void loop()
{
int val;
val=analogRead(0); //connect sensor to pin marked P0
Serial.println(val);//print the value to serial
delay(1000);
}
[/cpp]

 

Output

Open the serial monitor and you should see something like this

210
236
2267
2291
2289
2347
2352
2445
2527
2631
2691
2699
2799
2303
2247
265
288
312

To give some context, the low value was me covering the sensor and the high value was a desktop lamp. So in a practical application you would need to figure out the analog value you wished to act on, so for example if you read in under 500 you may want to send an alarm as its too dark.

Links

LX1972 Analog Light Sensor DIY Maker Illumination Sensor Module

You may also like

Leave a Comment