What is a micro:bit?
- micro:bit is a pocket-sized computer equipped with LED lights, speaker, buttons, sensors for sound, movement, magnetic field and temperature, and pins which other hardware and extension kids can be connected to
- With all of these features, the micro:bit can be used to create countless experiments, games and activities – from alarms and music players, to mini robots and remote-control cars
- Kids programme their micro:bit using Microsoft MakeCode (block-based coding) or Python (text-based coding), learning to code in a fun and exciting way!
Coding with micro:bit
Gone are the days when budding coders needed a clunky desktop to learn programming. Today, kids can use a micro:bit – a pocket-sized computer developed by the BBC, that introduces them to how software and hardware work together and helps them to learn to code. Programmed via web or mobile apps and equipped with a variety of different input and output features – light, sound, movement, temperature and even magnetic field sensors – micro:bit provides countless fun and educational activities which are perfect for hands-on learners.
Languages and apps for coding with micro:bit
There are two web-based editors on the micro:bit website that kids can use to program their micro:bit: Microsoft MakeCode and Python.
Microsoft MakeCode is used to write block-based or text-based code for micro:bit. As block-based languages (also known as visual programming languages, or VPLs) are better for new coders, Microsoft MakeCode is the perfect way for kids to start their coding journey. Similarly to other popular VPLs like Scratch, kids write their micro:bit program by dragging and dropping colour-coded blocks. Block-based coding on MakeCode is simple but powerful enough to make use of all of micro:bit’s capabilities and features. What’s more, MakeCode provides a window into text-based coding, as the code editor can be switched into JavaScript view to see what lies behind the blocks.
Alternatively, Python can be used to program a micro:bit. Python is one of the world’s most popular coding languages, a text-based language used in industries such as AI, data science and machine learning. However, as its syntax is more similar to standard English than many other text-based programming languages, Python is simple enough to be learnt by kids as young as 8.
After writing their code on these editors, kids can download it, pair their micro:bit to the computer via USB, and drag and drop the .hex file into the micro:bit drive. If they have a micro:bit with the latest firmware (a type of software that makes devices function properly and can be easily updated) and a Google Chrome browser, programs can be sent directly to the micro:bit via WebUSB, eliminating the need to redownload and drag and drop the new code each time it is updated.
As well as using the web-based editors, micro:bit can be operated via mobile apps for Android and iOS. After pairing the micro:bit with a mobile device, programs can be written and sent to the micro:bit directly from a phone or tablet. This means that kids can learn to code using even basic and inexpensive hardware.
What features does micro:bit have?
- 25 red LED lights arranged in a 5x5 grid display. These lights can be used as an output, flashing with different messages and patterns for games and other activities, or as an input sensor which detects light levels.
- Two programmable input buttons (button A and button B) which are used to control games, pause and change songs on a music playlist, and much more.
- A speaker to play sounds and songs.
- A microphone sensor to react to loud and quiet sounds and to measure noise levels. The microphone LED lets you know when the microphone is being used.
- An accelerometer sensor to detect and measure physical motion. The micro:bit can be programmed to do certain things when it is moved, shaken, dropped or turned.
- A compass sensor – known as a magnetometer – which can be programmed to measure the Earth’s magnetic fields and tell you which direction you are facing.
- A sensor to measure the temperature of the space around you.
- Radio and Bluetooth transmitter and receiver, allowing the micro:bit to interact wirelessly with mobile devices or other micro:bits.
- 25 gold strips, known as pins. These input and output pins can be used to physically connect the micro:bit with things such as circuits, headphones and buzzers, or with extensions such as robotics kits, games controllers or customisable accessories.
What can kids code with micro:bit?
With all of these features, micro:bit can be used for countless experiments, games and other activities. There are plenty of tutorials on the official website to help kids make the most of their micro:bit. Potential projects include:
- Step tracker: micro:bit can use its accelerometer sensor to track your steps as you walk and display the step count in LED lights. Kids can change the calibration of the accelerometer to make their step tracker even more accurate. After programming the micro:bit, they can attach it to their shoe and head out for a walk!
- Jukebox: music lovers can programme songs for their micro:bit, switch between songs by pressing the buttons, adjust the volume by tilting or shaking the micro:bit, and connect it to headphones or a speaker to listen to the music.
- Light alarm: who needs a traditional alarm clock? micro:bit’s LED light sensor can be programmed with an ‘if…else’ loop to measure the light in a room and set off an alarm when the light exceeds a certain level, waking them up with the sunlight.
- Intruder alarm: keep intruders at bay by connecting a homemade pressure sensor, crafted from cardboard and tin foil, to the 0 and GND pins on the micro:bit. Then, connect a second micro:bit to a buzzer. The micro:bits can connect via radio signal to set off the buzzer when the sensor is stepped on. Hide the sensor in your desired place, for example under a rug by the bedroom door, and wait!
- Disco ball: kids can calibrate the microphone sensor to detect the sound level in a room, and programme the LED output display to dim or brighten based on this level. When they play a song, the micro:bit lights will change along with the beat!
Photo by Stuart Bradyderivative on Wikimedia, images from Makecode.microbit