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.

Component Required


Hardware Hookup

Ready to start hooking everything up? Check out the wiring diagram below to see how everything is connected.



Insert the micro:bit into OSOYOO expansion board.


If you are not familiar to make code, don’t worry. Firstly, you can enter this link: to know more about microbit blocks.
Then you can directly enter the to edit your project program. Below is an example code we have done for you as reference.

Example Result

Done wiring and powered up, send the above code to MICROBIT. You should see the brightness data on the LED matrix of micro:bit.

If the brightness value is greater than 5, the light will be lit, otherwise, the light will remain extinguished.