Build a Light Meter With the TEMT6000 Sensor and ESP32

by simple silicon in Circuits > Arduino

568 Views, 1 Favorites, 0 Comments

Build a Light Meter With the TEMT6000 Sensor and ESP32

20260419_140537(1).jpg
power on.jpg
20260418_213309(1).jpg
20260418_213628(1).jpg

Your phone knows when you walk outside and automatically brightens the screen. Your camera adjusts its lens based on light. Smart homes dim lights when the sun sets. All use a simple sensor.


Today, you will build your own light meter that measures brightness just like professional equipment used in studios and nurseries. And it costs less than a dollar.


No experience needed. Every step is explained. Let us build.


What Is the TEMT6000?


The TEMT6000 is a tiny light sensor made by Vishay. Inside is a phototransistor that lets more electricity flow when light hits it. Brighter light equals more electricity flowing.


Connect it to an ESP32, and the board measures electricity flow. Using simple math, we turn that into a lux reading. These types of ambient light sensors are used in cameras, phones, and greenhouse systems.


The TEMT6000 module has three metal pins. Each does a different job:

VCC: Power pin.
GND: Ground pin.
SIG: Signal pin.


Think of it as a conversation. VCC says hello with power. SIG delivers the message about brightness. GND says goodbye as the signal returns.

Supplies

Hardware


  1. ESP-WROOM-32 development board
  2. TEMT6000 sensor module
  3. Breadboard
  4. Jumper wires or wires
  5. USB cable - (Micro USB B cable)

Software (All Free)

  1. Arduino IDE


Circuit Diagram & Wiring

TEMT6000 Circuit_bb.jpg

Here is how the three wires connect your sensor to the ESP32:


TEMT6000 ESP32 Wire Color
VCC 3.3V Red
GND GND Black
SIG GPIO34 Blue


⚠️ Important: Do NOT use 5V. Use only 3.3V.

Install Arduino IDE

Arduino IDE is where you write code and send it to your ESP32. Five quick steps:


  1. Download Arduino IDE 2 from arduino.cc for your computer (Windows, Mac, or Linux).
  2. Install it and open it.
  3. Click File > Preferences. In the Additional Boards Manager URLs field, paste: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  4. Go to Tools > Board > Boards Manager. Search for ESP32 and click Install on the one by Espressif.
  5. Select your board: Tools > Board > ESP32 Arduino > ESP32 Dev Module.


Done. Arduino IDE now knows how to talk to your ESP32.

The Code

Screenshot from 2026-04-19 13-28-20.png
Screenshot from 2026-04-19 13-27-52.png

Copy this code into the Arduino IDE. Every line has a comment explaining what it does.


// TEMT6000 Light Sensor with ESP32
// Reads light brightness

const float VCC = 3.3;
const int ADC_RES = 4095;

const int SENSOR_PIN = 34; // Pin where TEMT6000 sensor output is connected (GPIO34 on ESP32)
const float R_OHMS = 10000.0; // Load resistor value used with the sensor (10k ohm)
const float UA_PER_LUX = 0.5; // Sensor sensitivity from datasheet (0.5 microamp per lux)
void setup() {
Serial.begin(115200);
analogReadResolution(12);
analogSetAttenuation(ADC_11db); // Set ADC input range to full scale (0–3.3V)

Serial.println();
Serial.println("========================================");
Serial.println(" TEMT6000 Light Sensor Data ");
Serial.println("========================================");

// Table header with proper spacing
Serial.printf("| %-8s | %-10s | %-10s |\n", "Raw ADC", "Voltage(V)", "Lux");
Serial.println("----------------------------------------");
}
void loop() {
int raw = analogRead(SENSOR_PIN);
float volts = (float)raw / ADC_RES * VCC;
float uAmps = (volts / R_OHMS) * 1e6;
float lux = uAmps / UA_PER_LUX;
// Proper aligned table row
Serial.printf("| %-8d | %-10.3f | %-10.1f |\n", raw, volts, lux);
delay(1000);
}



Upload the Code:


  1. Copy the entire code above and paste it into the Arduino IDE.
  2. Plug your ESP32 into your computer with the USB cable.
  3. Click the Upload button (the arrow at top left).
  4. After 10 seconds, you will see Upload done.


Output

Cover with hand.png
Hold it window.png
Normal Reading.png

Now the exciting part. See the sensor working.

  1. Open Arduino IDE. Go to Tools > Serial Monitor.
  2. At the bottom right, set the baud rate to 115200.
  3. You will immediately see readings appearing every half-second.


Quick Reality Checks


Try these to confirm your sensor works:

  1. Cover the sensor with your hand. The lux number drops close to zero.
  2. Uncover it. The number jumps back up.
  3. Hold it near a bright window. The lux increases noticeably.
  4. Turn off the room light. The lux drops dramatically.



Conclusion

FRPYUTGMO3IR0TK.jpg
FI8TRPEMO3IR0L2.png

You just built a working light sensor from scratch. You wired a circuit, learned the math behind light measurement, wrote code, and got real data.


Happy building!