This is the exact same idea behind automatic streetlights and your car's automatic headlights, sense how dark it is, and switch a light on or off accordingly. We'll wire up a Light Dependent Resistor (LDR) into a simple voltage divider, read it with the ADC, and use that reading to automatically turn an LED on in darkness and off in bright light.
2. Scope
We'll build a voltage divider using the LDR and a fixed resistor, read the resulting voltage with ADC1, and compare that reading against a threshold to decide whether it's dark or bright. This reinforces the ADC skill from Experiment 3, applied here to a light sensor instead of a potentiometer, and introduces the voltage-divider trick you'll reuse for several other resistive sensors later on.
3. Prerequisite
3.1 Hardware
-
STM32 Nucleo-F070RB development board
-
LDR (Light Dependent Resistor)
-
Fixed resistor (10kΩ typical, to form the voltage divider)
-
LED + 220Ω resistor
-
Breadboard and jumper wires
-
Micro-USB cable
3.2 Software
-
STM32CubeMX (standalone)
-
STM32CubeIDE
-
ST-LINK USB driver
Community Q&A
0 questionsAsk questions and get answers from our community and staff moderators.
No questions yet — be the first to start the conversation!
Ask a Question
Please log in to ask a question or post a reply.
Login to Participate