Hands-On With The BBC Micro:Bit

The content below is taken from the original (Hands-On With The BBC Micro:Bit), to continue reading please visit the site. Remember to respect the Author & Copyright.

It’s been a long wait, but our latest single board computer for review is finally here! The BBC micro:bit, given free to every seventh-grade British child, has landed at Hackaday courtesy of a friend in the world of education. It’s been a year of false starts and delays for the project, but schools started receiving shipments just before the Easter holidays, pupils should begin lessons with them any time now, and you might even be able to buy one for yourself by the time this article goes to press.

The micro:bit top view
The micro:bit top view

It’s a rather odd proposition, to give an ARM based single board computer to coder-newbie children in the hope that they might learn something about how computers work, after all if you are used to other similar boards you might expect the learning curve involved to be rather steep. But the aim has been to position it as more of a toy than the kind of development board we might be used to, so it bears some investigation to see how much of a success that has been.

Opening the package, the micro:bit kit is rather minimalist. The board itself, a short USB lead, a battery box and a pair of AAA cells, an instruction leaflet, and the board itself.  Everything is child-sized, the micro:bit is a curved-corner PCB about 50mm by 40mm. The top of the board has a 5 by 5 square LED matrix and a pair of tactile switches, while the bottom has the surface-mount processor and other components, the micro-USB and power connectors, and a reset button. Along the bottom edge of the board is a multi-way card-edge connector for the I/O lines with an ENIG finish. On the card edge connector several contacts are brought out to wide pads for crocodile clips with through-plated holes to take 4mm banana plugs, these are the ground and 3V power lines, and 3 of the I/O lines.

The micro:bit bottom view
The micro:bit bottom view

It is obvious when compared to other single board computers that this one has been designed with the pocket of a 12-year-old in mind. It’s a robust 1.6mm thick board that is devoid of  pins and spiky connectors, and on which care has obviously been taken to ensure as low a profile as possible.

In hardware terms it has an ARM Cortex M0 processor from Nordic Semiconductor, a compass, accelerometer, Bluetooth Low Energy and USB as well as the previously mentioned switches, LEDs, and GPIOs.

To use the device, you have the choice of connecting it to your computer via USB, or to your phone or tablet via Bluetooth Low Energy. Sadly none of our devices support BLE so for this review we’ll be taking the former approach.

All programming is performed through a selection of web-based environments, with code editing and compilation performed online and the resulting binary file arriving as a download before being placed on the micro:bit by the user through the filesystem. Since the micro:bit is also an mbed under the hood we’d expect it to be programmable using the mbed toolchain, however that is beyond the scope of this review.

The development environments are all accessible through the micro:bit website, on which no login is required for writing code. On clicking the “Create code” button you are presented with a choice of four, Code Kingdoms JavaScript, Microsoft Block Editor, Microsoft Touch Develop, and Python. The micro:bit leaflet says you need a PC running Windows 7 or later or a Mac running OS X 10.6 or later, however we encountered no problems using Chromium on a Linux desktop. Each of the different environments has its own flavour and audience, so it’s worth considering them all in turn.

The Code Kingdoms Javascript editor
The Code Kingdoms Javascript editor

First up is Code Kingdoms Javascript. This is not what you might expect as a Javascript editor, instead it’s a drag-and drop visual coding environment which creates Javascript blocks. On the left are a series of menus containing the available code blocks, in the middle the coding area, on the right a software micro:bit emulator. At the bottom on the left are buttons to run your code in the emulator, save it with your other scripts, or compile and download it to be placed on the micro:bit.

In use, the Code Kingdoms editor is straightforward and intuitive, the code for a simple compass you can see in our screenshot was very quick to assemble as a first effort. Unfortunately though in our browser at least it was extremely slow, at times almost to the point of being unusable. In particular when you wish to remove a code block it starts up an animation of its waste bin opening up which slows the browser to a crawl. It is not a good sign when you load a web page and hear your processor fan spin up.

The Microsoft Block editor
The Microsoft Block editor

Following the Code Kingdoms editor is Microsoft’s Block Editor. This is a drag-and drop visual editor in the same vein as the Code Kingdoms editor, except that there is no pretence of building a more traditional coding language and it is a much faster and smoother experience. The interface is broadly similar in layout to the Code Kingdoms editor, except for the compile and run commands which are at the top, above the coding window.

In our screenshot you’ll see a very simple environmental monitor designed to display readings from the micro:bit’s various sensors. Yet again this was a simple and intuitive piece of software to assemble for someone using the environment for the first time.

Microsoft's Touch Develop editor
Microsoft’s Touch Develop editor

The third environment is another one from Microsoft, their Touch Develop editor. This is different from the other editors in that it is designed especially for use in touch environments on tablets and phones, so we tested it on an Android phone.

While the Touch Develop editor follows the same idea as the previous two of building code by selecting blocks from menus, it creates something a lot closer to text code, and requires the user to manually enter for example function parameters. We found its help system to be a little difficult on this front, it’s doubtless a useful editor if you know its intricacies but there is quite a learning curve for a first-time user.

The Touch Develop team have made as good a good job of putting a development environment onto a phone screen as they could and it is very usable, however due to the limited screen space it is still a little awkward and crowded. With luck this should be less of an issue for tablet owners.

It is worth pointing out that this editor can be stored as an offline bookmark allowing it to be used without an Internet connection, however it is not clear how any code written in this way might be compiled.

The micro:bit Python editor
The micro:bit Python editor

The final editor choice for the micro:bit is Python, in fact a micro:bit build of MicroPython. This editor lacks the software micro:bit emulator, but is much more like the kind of software environment that Hackaday readers will be used to. The main window is a straight text editor ready to type your Python into, and there is no menu of predefined code blocks. Instead there is a comprehensive introduction, tutorial, and documentation of the various micro:bit Python libraries, and once you are armed with those you can step right in and start writing code.

In use if you are happy with Python it is very straightforward. If your code generates any errors they are displayed scrolling across the micro:bit’s LED matrix which can be rather tedious, however at least the errors we generated were informative and led us straight to the points in our compass code which had gone wrong.

Looking at the libraries available in this editor it becomes clear that Python is the most powerful way to control your micro:bit. As well as the simple functions available in the other editors it offers libraries for I2C, SPI, UART, Neopixels and more. It’s immediately obvious that this is where the micro:bit’s “Wow!” hacks are most likely to be created.

The micro:bit with its battery pack
The micro:bit with its battery pack

Having looked at all the editors, our choices would be Python as the most powerful coding environment for experienced coders, and the Microsoft Block editor as the most useful drag-and-drop environment for beginners. The Code Kingdoms editor is nice but glacially slow, and the Touch Develop editor is a bit fiddly. It’s worth mentioning that all the editors have an option to save code locally, this produces an LZMA-compressed file with raw code in a JSON structure.

Of course, though some of us may benefit from it, this board is not made for Hackaday readers but for children. If it gets the recipe right, in a decade’s time it will be cited by a generation of new graduates as the machine that got them into software, but has it hit the mark? Since the children in question are only now receiving their first lessons it’s a bit early to tell, but the teacher lent us this micro:bit for the review tells us there are only two minor gripes. Not having an on-off switch they go through batteries at a phenomenal rate, and since their failed programs show no LEDs they think they’ve killed it when their software doesn’t work. The first it’s possible the kids will fix themselves by learning to unplug the packs, and perhaps the micro:bit people can fix the second with a software update. If these are the worst things that can be said about it though there can’t be too much wrong with it.

Filed under: computer hacks, Featured, hardware, Interest, Microcontrollers, slider