This weekend, I got a BBC micro:bit from a friend. This is a nice gift indeed, I had and still have lot’s of fun with it.
Before I tell a bit more about the device, did you know each 11- and 12- year-old student in the UK got one for free!? That’s more than one million devices. This is a great opportunity for kids: they can learn about programming, computers and most of all, programming and computers can be fun!
The design of the device is very clever!
It has an ARM processor, two buttons, 25 leds (which acts like a screen), a compass, an accelerometer, Bluetooth LE, GPIO pins, a battery connector and a MicroUSB connector (for programming).
Programming is so easy! Let’s dive into this a bit deeper…
Just connect the micro:bit to your computer (using a microUSB cable) and go to the website. It’s so smart, children do not have to download anything, programming is done inside the browser using one or programming tools (as I said, running on a web page):
- Micro Python -MicroPython is a completely text-based editor, perfect for those who want to push their coding skills further. A selection of ‘snippets’ are on hand to help auto-complete trickier tasks and a range of premade images and music are built-in to give you a helping hand with your code
- Microsoft Block Editor – The Block Editor is a visual editor and provides an introduction to structured programming via drag and drop coding blocks that snap together. You can also convert a Block Editor script into a Touch Develop script which helps with the transition to text-based programming
- Microsoft Touch Develop – With its touch-based interface, Touch Develop has been designed for mobile devices with touchscreens. It can also be used with a pc, keyboard and mouse. Touch Develop introduces a statically-typed scripting language with syntax-directed editor. It can be used to produce web-based apps that can run online on any platform
The micro:bit mobile app (Google play store, Apple app store) lets you send code to your micro:bit using Bluetooth wireless technology. No connecting leads needed! Just make sure that your micro:bit is powered up and within easy reach of the phone or tablet running the app.
I tried another way to program it. Whenever my application was ready, I hit the download button on the screen. A microbit-[insert project name].hex file was compiled and download into my downloads folder. I then dragged the file to a newly created drive on my PC. This drive was created when I attached the micro-bit, the device act like a drive! And when the hex file was dropped, the micro:bit reboots with this new application. Sweet, even a child can do this!
All programming languages (both visual and those using code) have the same capabilities (Python seems to be missing the Bluetooth stack at this moment, though).
My first impression is that it acts just like Scratch, a very popular programming language, running on multiple devices and environments eg RaspberryPi.
Here is picture where I program in PXT:
In the middle, I can choose programming modules (like shown on the right) from various categories (each with its own color) eg.:
So there is a lot of things to do.
I think the most fun is to interact with the sensors. The compass can show you the north of any other wind direction. The accelerometer knows when you wobble or flip the device. The buttons are great to interact with the ‘screen’ (I have plays a very simple version of snake, directing only three dots on the screen).
I also tried the GPIO pins. It’s possible to read the pins in code and interact with them using your fingers. I had some issues with that (nothing happened while connecting pin Zero and ground and ), but finally I managed to interact with the pins a few times.
I recommend a better solution for the GPIO pins, use a programming board like this one:
And I can also recommend the battery pack having a JST connector. This is a must-have if you want to use the compass or accelerometer.
Before I go further, in the browser there is also a simulator. And it is very smart. If you program a device to use Bluetooth, It will show two devices in the emulator which can interact. Nice!
These devices cost around 18 Euro in The Netherlands and it’s pretty cheap for the amount of fun you buy with it!
As a more experienced programmer, I tried to program against the Bluetooth stack of the micro:bit. TLDR; I failed.
Ok, I managed to pass some data using the BLE advertisement. I send a 4 and a 2:
These two values are shown using the Bluetooth Beacon interactor (code available on Github):
But the Bluetooth stack of the micro:bit is much more promising, due to all the GATT profiles:
But after pairing, all I got was:
I even have seen that the device had six profiles but I did not get it working. Could be that it is not supported yet by UWP apps, I will check it out in a future blog.
I can recommend the micro:bit to anyone: child, parent, teacher, President of the United States, anybody. Although small and cheap, it is pretty powerful and easy to program. And it is versatile enough to compete with NodeMCU or Arduino.