laser_preparation

Laser device

Build your own laser device that uses a laser module and a light sensor connected to the micro:bit to emit a beam and detect objects or directions! Learn the basics of programming, electronics, and working with light elements in a fun way - ideal for teaching physics, computer science, or for home experiments with light, safety, and smart technologies.

Description

The laser fixture is a project that serves as a practical demonstration of the function of a light barrier. It uses a laser module to send a narrow beam of light to a light sensor (photoresistor). When the beam is interrupted – for example, by an object or person passing through – the micro:bit detects this event and can respond by displaying information, playing a sound, or lighting an LED.

This device is ideal for school lessons and home experiments and does not require any advanced knowledge. It will allow children and adults to learn the principles of detection, optics and microcontroller programming in a fun way.

Connection

Photoresistor

The photoresistor is connected using three wires. On the sensor we find a pin VCC (power supply), GND (grounding) and DO (digital output). Connect the VCC pin to the white power rail on the board, which will supply 3,3 V. Connect the DO pin to the P1 and grounding is done by connecting GND to the black grounding bar.

Laser

The laser has only two wires – red VCC and blue GND. Connect VCC to 5V red strip (or to the white 3V3 strip, but the beam will not be as strong). Connect the GND wire to the black ground strip on the board.

Notice

When you first start the device, you need to adjust the sharpness of the photoresistor. Use a Phillips screwdriver and insert it into the blue square on the sensor. By turning the screwdriver, you set the switching point, which determines at what light intensity the sensor should respond.

Recommendation

When connecting, the expansion board must be turned off and the micro:bit disconnected from the power supply.

Program

Basic program

The program starts by setting pin P0 to a pulse, or interruption by a signal from the photoresistor. Next, we set Pin P1 to Neopixel (our LED strip). Then a simple comparison is repeated in the loop. If the signal is interrupted, the LED strip starts to glow a different color than if the signal is not interrupted.

Tasks

Task 1: Expansion with TM1637 display

Expand the product with a display TM1637. Display the number of signal interruptions from the light sensor on this four-digit seven-segment LED display.
This will create a simple counter (counter) that displays how many times the laser beam has been interrupted.