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
Parts Required
Here are the parts I used
you can connect to the sensor using a standard header the classic dupont style jumper wire.
Name | Link | |
ESP32 | ||
TEMT6000 | ||
Connecting cables |
Connection and Layout
TEMT6000 Pin | ESP32 Pin |
SIG | A0 |
GND | GND |
VCC | 3v3 |
Code
No libraries needed
#define LIGHTSENSORPIN A1 //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); }
Output
Open the serial monitor and you should see something like this
41.00
42.00
4.00
1.00
21.00
38.00
41.00
41.00
40.00
Links
https://www.vishay.com/docs/81579/temt6000.pdf