Using a light sensor with BBC micro:bit and MicroPython

A light sensor is a small component with a particular characteristic: it is basically a resistor and its resistance decreases if the light is more intense. To use it with micro:bit we need to use one of the analogic ports. To build this circuit you will need a breadboard, 3 jumper wires, a 10k resistance and possibly a Kitronik breadboard kit.

The project

I wanted to realise a simple project where, depending on the light intensity captured by the light sensor, the micro:bit shows an image of the Sun if the light is intense and an image of the Moon if the light is less intense.

Here is the complete circuit scheme:

microbit_breadboard_schema_light

"Image Copyright © Kitronik"

and here is a picture of the finished project I created:

microbit_breadboard_example_2

The source code I needed is available here:

and as a demo I realised this small video:

Comments !

social