keyestudio
Share your creative ideas with us here
By Alisa | 12 June 2024 | 0 Comments

How to Control the Brightness of External Light with Micro:bit?

Overview
 

It is seen that sensors are everywhere in our daily life. Some public street lights automatically light up during the day and automatically go out at night. Why?In fact, those lights make use of a photosensitive element that can measure the brightness of external light.
 

In the evening, when outside brightness becomes lower, the street light is automatically controlled to be turned on. When it is bright during the day, the street light is automatically turned off.
 

In this project, you will learn how to use our keyestudio photocell sensor and micro:bit to control the brightness of external light. Show the result on 5*5 LED of micro:bit or serial monitor of CoolTerm software.
 

Component Required:
 

  • Micro:bit main board*1

  • Keyestudio Micro bit Sensor V2 Shield*1

  • USB Cable*1

  • keyestudio Photocell Sensor*1

  • keyestudio Digital Red LED Module*1

  • DuPont jumper wire*6

  • Premium Battery Holder 6-cell AA*1

  • 1.5V AA Battery*6

Img


Component Introduction
 

Photocell Sensor:
 

A photoresistor or light-dependent resistor (LDR) or photocell is a light-controlled variable resistor. Its principal is very simple.

The resistance of photoresistor changes with incident light intensity. If the incident light intensity is high, the resistance decreases; if the incident light intensity is low, the resistance increases.

This keyestudio photocell sensor is a semiconductor, integrated with a photoresistor, easy to use and very convenient for wiring. It has features of high sensitivity, quick response, spectral characteristic and R-value consistence.

It can be applied in light-sensitive detector circuits, intelligent switch design and light- and dark-activated switching circuits.
 

Connection Diagram
 

22


Test Code
 

Img


Test Results
 

Connect micro:bit to computer via USB cable and transfer code to micro:bit.

Open CoolTerm, click Options and select SerialPort, set COM port and baud rate(115200). Click OK and Connect.

CoolTerm monitor shows the corresponding analog signal, with the light intensity getting weaker, the analog value plummets gradually and red LED gets dimmer, otherwise, the analog value grows and red becomes brighter.

Leave a Reply

Your email address will not be published.Required fields are marked. *
Name
E-mail
Content
Verification code