Micro:bit Physical computing guides
No. 5: LDRs (Photo resistors)
Connecting an LDR (Photoresistor) to a micro:bit
Instructions on how to attach an LDR (Photo resistor) to a BBC micro:bit.
What you will need
Instructions on how to attach an LDR (Photo resistor) to a BBC micro:bit.
What you will need
- BBC micro:bit
- Micro USB cable
- Battery pack with 2 x AAA batteries
- 1 x Miniature Light Dependent Resistor (LDR)
- 1 x 10kΩ resistor
- 3 x Crocodile clip leads
Understanding LDRs
Light dependent resistors (LDRs), also known as photo resistors, are light sensitive components most often used to indicate the presence / absence of light or to measure the light intensity. In low light, their resistance is very high but when the LDR sensor is exposed to light, the resistance drops dramatically.
Light dependent resistors (LDRs), also known as photo resistors, are light sensitive components most often used to indicate the presence / absence of light or to measure the light intensity. In low light, their resistance is very high but when the LDR sensor is exposed to light, the resistance drops dramatically.
Wiring instructions
- Disconnect the micro:bit from your computer and disconnect the battery pack.
- Use a crocodile clip to connect either leg of your LDR to either end of your resistor.
- Connect another crocodile clip from the other end of your resistor to GND on your micro:bit.
- Connect a crocodile clip to the remaining leg of your LDR and attach it to Pin 0.
Programming your LDR
Copy the below:
Programming your LDR
Copy the below:
Testing your code
Testing your code
- Download your program to your micro:bit.
- Reconnect your battery and run your program.