Sensor breakouts
Sensor breakouts
Reading data sheets, black-boxing sensors
5. TEMT6000
When we need to sense ambient brightness with better precision than the trusty photoresistor and without adding complexity to your project, a TEMT6000 ambient light sensor is what we are looking for.
The TEMT6000 is supposed to be adapted to the sensitivity of the human eye. It works very well reacting to very small changes in a large range of brightnesses. Because it is meant to mimic the human eye, it does not react well to IR or UV light, though.
Hooking It Up
This is an incredibly simple part, we just connect power and ground, and
the signal pin to our favourite analog input and the
sensor will output an analog voltage, that ramps up when it gets brighter.
Code
This just reports the reading from the sensor to the serial terminal: 0-1023 with 1023 being very bright, and 0 being very dark.
const int temt6000Pin = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
int value = analogRead(temt6000Pin);
Serial.println(value);
delay(100); //only here to slow down the output so it is easier to read
}