EQ-13 · Light sensor
Compare bright and dark readings
Sense changes in ambient light with an analog reading or an adjustable digital threshold.

How to use it
You’ll need: ESP32-S3, photoresistor module, USB data cable, jumpers, and a lamp or flashlight.
Connections
This example uses one part at a time on the MoloWorks ESP32-S3. If a course uses different GPIO pins, follow that course’s wiring and code together. Disconnect USB and any external power before changing wires.
| On the part | Connect to |
|---|---|
| Module VCC | ESP32 3V3 |
| Module GND | ESP32 GND |
| Module AO | ESP32 GPIO4 (ADC1) |
| Module DO (optional) | ESP32 GPIO5 (digital input) |
- Begin with AO alone. Use 3.3 V for the module and confirm that its outputs are within the board’s signal range. Check the actual pin labels.
- Run the ADC example. Cover the photoresistor, uncover it, then shine a light on it. Compare the ranges you observe; the reading may rise or fall with light.
- To try the threshold output, turn power off and add DO. In digital input mode, watch GPIO5 while you move between bright and dark, then adjust the module’s trimmer in small steps. Verify which level means bright on your unit.
MicroPython example
Run this on the board with your MicroPython editor. Set up the ESP32-S3 first if you don’t have a working connection.
from machine import ADC, Pin
from time import sleep_ms
sensor = ADC(Pin(4), atten=ADC.ATTN_11DB)
for _ in range(40):
print(sensor.read_u16())
sleep_ms(250)What to look for: The raw readings change with the light level. Treat them as relative readings; they are not calibrated lux.
AI prompt
Copy the prompt and replace any brackets with details from your kit. Check the suggested wiring against the labels on your parts before applying power.
Compare bright and dark readings
My 3.3 V MoloWorks photoresistor module uses AO on ADC1 GPIO4 and optionally DO on GPIO5, with common ground. In MicroPython, help me log covered, room-light, and bright raw readings, choose a threshold from the measured ranges, and test whether the DO output is active high or low. Do not convert raw ADC values to lux.