Halloween Spooky Ghost With BBC Micro:bit on Cytron EDU:BIT
Introduction: Halloween Spooky Ghost With BBC Micro:bit on Cytron EDU:BIT
This article shows how to use the Cytron EDU:BIT and its BBC micro:bit to make a fun Hallowe'en scene. A MicroPython program
* controls the servo to animate the scene,
* illuminates it with the RGB Bit (an array of four RGB pixels),
* makes the eyes glow using two of the micro:bit's LEDs,
* all while playing sound samples on the micro:bit using the Music Bit for output.
The IR bit, a proximity sensor, is used to start the animation sequence. The Music Bit has a small 7.5mm speaker but it also has a 3.5mm socket for audio output which routes the micro:bit P0 pad to both the left and right channels. This is useful to plug into amplified speakers.
The micro:bit V1 is used here but the V2 also works very well with the EDU:BIT.
The EDU:BIT is an excellent kit designed for young children to introduce them to block-based MakeCode programming and physical computing. If you don't have an EDU:BIT the Halloween scene could also be made with a micro:bit V2, an RGB pixel stick and a 3.3V compatible micro-servo and a distance sensor. The power limit of the micro:bit V1's 3.3V output means it's not suitable for directly powering four RGB pixels and a servo together.
I backed the original Kickstarter campaign for five EDU:BITs as they made great Christmas gifts. The board in this article is a sample Cytron kindly sent to me to let me test compatibility and usability with the Adafruit CLUE - it's identical to the current production version.
The audio samples are excerpts from two clips on freesound.org:
* Rollo145's Door Creaking.
* Hilton Productions' Scary Laugh.
Supplies
* Cytron EDU:BIT - PiHut | Digi-Key - there are two versions of the kit, one with and one without micro:bit.
* BBC micro:bit - PiHut | Adafruit
* Art and craft material for building your Halloween scene.
Step 1: Detaching the Bits From the EDU:BIT
The video above shows how to snap off the bits from a new EDU:BIT.
After removing the bits take three grove cables and attach the Music Bit, IR Bit and RGB Bit to the board in their original positions. 1003
The servo connects on the top right block of pins at position 1 with
* yellow to S,
* orange to +,
* brown to -.
The EDU:BIT has a dedicated controller for up to three servos using 5V power. This avoids the need to find servos that are compatible with 3.3V control signal and power.
Step 2: Install Code and Audio Files Onto the Micro:bit
For a browser with WebUSB support like Google Chrome or Microsoft Edge:
1. Download the files from GitHub:
1. Click on Raw button on edubit-halloween.py and use Save as in browser to download the file.
2. Click on doorcreak4.raw, laugh1a.raw and laugh1b.raw in audio directory, click on Raw on each to download the file.
* Connect the micro:bit to the computer using a USB cable (not a charge-only one!).
* Go to the micro:bit online editor in a browser: https://python.microbit.org/
* Click on Connect, the micro:bit should appear as an entry called BBC micro:bit CMSIS-DAP - select that and click on connect.
* Click on Load/Save and then load the edubit-halloween.py file in the top section of the pop-up.
* Under Project Files at the bottom of the pop-up, click on Show Files (1) to expand the list. Click on Add file at the bottom to add each of the three raw audio files.
* Click on the cross at the top right of the pop-up to close it.
* Click on Flash - this will download all four files to the (connected) micro:bit and start the program.
The useful connection functionality in the online editor depends on WebUSB and having recent firmware on the micro:bit. If you are using a different browser or this does not work then you can use the online editor's save function to save a hex file onto the MICROBIT drive.
This is worth testing before you assemble the scene to ensure everything works properly and to set provisional values for the angles for door open and door closed. 991