TEMT6000 ambient light sensor is a silicon NPN epitaxial planar phototransistor in a miniature transparent 1206 package for surface mounting.
It is sensitive to visible light much like the human eye and has peak sensitivity at 570 nm.
Features
• Adapted to human eye responsivity
• Wide angle of half sensitivity ϕ = ± 60°
Applications
Ambient light sensor for display backlight dimming in:
Mobile phones
Notebook computers
PDA’s
Cameras
Dashboards
Connection and Layout
TEMT6000 Pin | Chipkit Uno Pin |
SIG | A0 |
GND | GND |
VCC | 3v3 |
Code
No libraries needed
[codesyntax lang=”cpp”]
#define LIGHTSENSORPIN A0 //Ambient light sensor reading void setup() { pinMode(LIGHTSENSORPIN, INPUT); Serial.begin(9600); } void loop() { float reading = analogRead(LIGHTSENSORPIN); //Read light level float square_ratio = reading / 1023.0; //Get percent of maximum value (1023) square_ratio = pow(square_ratio, 2.0); Serial.println(reading); delay(1000); }
[/codesyntax]
Output
Open the serial monitor and you should see something like this
3.00
0.00
1.00
4.00
4.00
10.00
11.00
1.00
15.00
2.00
Links