Home CodeArduino Micro:bit and TEMT6000 ambient light sensor example

Micro:bit and TEMT6000 ambient light sensor example

by shedboy71

TEMT6000X01 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.

Here is a picture of a module

Here is a schematic of the module

APPLICATIONS

Ambient light sensor for control of display backlight dimming in LCD displays and keypad backlighting of mobile devices and in industrial on/off-lighting operation.

• Automotive sensors
• Mobile phones
• Notebook computers
• PDA’s
• Cameras
• Dashboards

Connection

Code

[codesyntax lang=”cpp”]

#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);
}
[/codesyntax]

 

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

TEMT6000 Light Sensor

https://www.vishay.com/docs/81579/temt6000.pdf

You may also like

Leave a Comment