Toggle Nav

Interfacing TEMT6000 Ambient Light Sensor with Arduino

Table of Contents

TEMT6000 Sensor Features

The TEMT6000 sensor is an analog sensor which has a function similar to NPN transistor. The sensor is designed to mainly detect the light spectrum visible to the human eye with peak sensitivity. If the light intensity increases or decreases, it will react properly. This sensor is too sensitive and react to slightest changes in a wide brightness range.
Note
This sensor does not react well to IR and UV light.

You can download the datasheet of this sensor here. 

TEMT6000 Light Sensor Pinout

This sensor has 3 pins:

  •  VCC: Module power supply – 3-5.5 V
  •  GND: Ground
  •  OUT: Data pin for I2C communication

You can see pinout of this module in the image below.

Required Materials

Use one of the STM32 or Arduino microcontrollers based on your needs. 

Hardware Components

*Arduino Nano × 1
*STM32F103C8T6 × 1
TEMT6000 Ambient Light Sensor × 1
female-female-jumper-wire × 1

*Use one of the STM32 or Arduino microcontrollers based on your needs. 

Software Apps

Arduino IDE

Interfacing TEMT6000 Sensor with Arduino

Step 1: Circuit

The following circuit shows how you should connect STM32 or Arduino to TEMT6000 sensor. Connect wires accordingly.

Step 2: Code

Upload the following code to Arduino.
/*   
modified on Sep 8, 2020
Modified by MohammedDamirchi from http://arduinolearning.com/amp/code/arduino-temt6000-light-sensor.php
https://electropeak.com/learn/ 
*/ 


//Ambient light sensor reading
#define LIGHTSENSORPIN A1 //for Arduino 
//#define LIGHTSENSORPIN PA1 //For Stm32
 
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(100); 
  delay(100);  Serialrial  }
After running the code, you will see the following image in the serial output.

Liked What you see?

Get updates and learn from the best

More To Explore

Leave a Reply

Your email address will not be published. Required fields are marked *