Micro:bit Christmas tree
What you need: -
Preparation
1. Cut a hole on a piece of acrylic and place it inside the photo frame.
2. Secure the 16 pixels ring around the hole
3. Secure the speaker & 360 servo motor to the bottom of the photo frame and make sure that the motor is at the centre of the hole.
4. Laser cut the Christmas tree with stand.
5. The stand is made up of 2 parts. The top is a cross and the bottom is a hole. The hole size is the same as the 360 servo.
The laser cut files in coreldraw
https://drive.google.com/file/d/1okK-ryNsG8LTUI1XXa79pQqO2Viy5w36/view?usp=sharing
The connections
We will be using pin 13. The dfplayer will receive the signal from pin 1 of the micro:bit.
The program
How it works?
When Button A is pressed, the 360 servo will start to turn anticlockwise, display rainbow colours and the mp3 will begin to play.
When Button AB is pressed, the servo will turn anticlockwise.
When B is pressed, the servo & mp3 will stop and the colours from the LEDs will be set to off.
On start will run once the micro:bit is powered on.
- We set a variable light and inform micro:bit how many RGB leds are there.
- The dfplayer will play the mp3 file when it receives a signal from the microbit via pin 1. As we do not need the dfplayer to send a signal back to the micro:bit, we do not need to connect pin 13 but we still need to specific in the program.
- The volume from the dfplayer and the brightness of the LED pixels ring can be easily adjusted.
Forever contains the instructions that get repeated over and over until the board is turned off.
- We will show the lights and rotate by 1 pixel. Initially when we power on, the lights are set to off and thus nothing to show.
- When Button A is pressed, the RGB ring will display rainbow colours. The forever loop will show the colours and rotate pixel by 1.
Since we are powering the dfplayer, led ring and 360 servo, we have to connect the power to the micromate instead of the micro:bit. If the servo is not turning, turn the voltage selector to 5v.
You can add pir to it so that the Christmas tree will respond when someone enters the room.
This project is made by Mark NG.