Friday 8 April 2016

BBC Micro Bit in 2016

Micro Bit back

David Briddock finds out what’s happening with the much delayed BBC Micro Bit

In March 2015, the BBC Micro Bit launch caused quite a stir in the media. Announced as part of the BBC’s Make It Digital initiative (bbc.co.uk/mediacentre/mediapacks/makeitdigital), it was designed to integrate into the school computing curriculum. The idea was to encourage children to discover how computing systems work through interactive experimentation and coding.

With its buttons, array of LEDs and built-in sensors, the Micro Bit has the flexibility to host a wide range of projects, from simple games to full-blown scientific experiments, and it can connect wirelessly to smartphones and tablets.

During the launch, the BBC promised to give a Micro Bit to every child in Year 7 (11- and 12-year-olds), soon after the start of the 2015 school year. But things didn’t go to plan. We’ll address these issues later, but first let’s recap the components of the BBC Micro Bit.


Specification


The board itself is about the size of half a credit card (4cm by 5cm). It holds a Nordic Semiconductor nRF51822 ARM Cortex-M0 32-bit microprocessor running at 16MHz plus 256KB of flash memory and 16KB of static RAM. The ARM core can switch between 16MHz or a power-sipping 32.768kHz clock rate.

Two of the most prominent features are the 25 LED display, laid out in a 5x5 array, and three tactile push buttons (two for user input and one for reset). Other elements include a three-axis accelerometer for motion tracking, a three-axis magnetometer for compass headings or metal detecting, a digital thermometer and 2.4GHz Bluetooth Low Energy (BLE) wireless networking.

It also has a 23-pin edge connector with pulse-width modulation outputs, General Purpose IO (GPIO) pins, six analogue inputs and serial I/O, plus five ring connectors that accept crocodile clips or 4mm banana plugs.

Connect the Micro Bit to a PC, and it appears as a USB drive, so code can be installed using drag and drop operations. Power is provided via the micro-USB port or with batteries.

Early prototypes had an small integral battery, but after problems, a revised design means an external AAA battery pack is now needed to power the device as a stand-alone or wearable product.

Delay After Delay


In summer 2015, the BBC still expected to give the Micro Bit free to every Year 7 child by October 2015. Some teachers were to receive prototype boards a month earlier than this date to gain a head start in lesson preparation. And promised manufacturing targets would allow the general public to buy Micro Bit boards before the Christmas holidays.

However, none of these things actually happened. At the last minute, the BBC revealed power supply problems had caused a delay. The hastily revised plan was to provide teachers with a Micro Bit board before the end of 2015 and Year 7 children early in 2016.

But as the new year started, there was still no sign of the boards. Pushed by the media, officials suggested availability would be delayed until the February half-term holiday, but the message was vague with phrases like “pushing to deliver as many as possible”.

Initial enthusiasm is fading fast. Until March only a few lucky schools have been given prototype Micro Bit boards, and it wasn’t until 22nd March that an official BBC announcement (goo. gl/4MZKLF) said the mass rollout had started.

Now we know many children won’t have a Micro Bit before the third and final term. Quite understandably, teachers are now deeply concerned there’s not enough time left to do it justice. Many are considering whether to suspend the whole exercise until the next school year.

Organisational Chaos


What’s going on? BBC Learning executive Cerys Griffiths said, “The main issue has been some fine-tuning.” The official BBC message is, “We have created hardware, it’s very complex, it’s very sophisticated, it’s very new.” Mmm… not very convincing, is it?

To placate teachers and students, the BBC is promising to roll out more copies of the device than it had originally planned, so some children in other school years should also receive a Micro Bit. But with such a bad track record, there’s deep scepticism about whether this will happen.

In the midst of all this chaos, the original design specifications have changed. Compared to the early prototypes, the board layout has been revised. Now it’s more streamlined and easier to manufacture, although a rather more boring rectangular shape.

More importantly, the board now lacks a slot for a watch battery. Instead, you’ll need a battery pack holding two AAA 1.5V batteries. Cost reasons were cited by the BBC team, along with health and safety issues, but it certainly isn’t as neat a solution as a coin battery. On the plus side, as part of the board redesign, the Micro Bit gained an accelerometer motion sensor.

Too Many Chefs?


We can never know the real reasons behind these delays, but a clue comes from the 29 entries on the BBC’s Micro Bit partner list. Here’s a brief summary of some of the major partnerships.

Taking the hardware first, Nordic Semiconductors supplies the CPU, while NXP Semiconductors provides the sensors and USB controller. Technology Will Save Us (techwillsaveus.com) designed the physical appearance of the device, and manufacturing will be overseen by Farnell / Element 14.

The system software picture is also fragmented. ARM Holdings provides the ‘mbed’ platform and operating system, plus development kits and compiler services. Lancaster University developed the device runtime, and the BBC itself developed a Micro Bit App that connects smartphones and tablets with the device.

As for programming, Microsoft contributed coding tools and learning materials (more on this later). Samsung developed an Android app for smartphone and tablet connectivity, while ScienceScope is doing something similar for Apple iOS mobile devices. The Python Software Foundation is working on the MicroPython coding language, and Espruino provides a JavaScript interpreter, which can be remotely controlled via Bluetooth LE with the DroidScript mobile app.

In addition to all this, Barclays has signed up for product delivery and outreach activity support, while The Wellcome Trust (wellcome.ac.uk) is committed to delivering learning opportunities for teachers and schools.

This looks distinctly like a classic ‘too many chefs’ scenario.

Online Simulator


Let’s move on to coding. You might think talking about code is a little pointless without a Micro Bit board. However, during the delays, Microsoft and others have been busy rolling out an online code editing platform and Micro Bit simulator.

The simulator’s primary purpose is to help teachers prepare lessons, but as it’s freely available to anyone with a web browser, it also means we can have some coding fun (microbit.co.uk/create-code).

The board is displayed as a graphical image alongside the coding environment. Importantly, this image responds to mouse input, so buttons can be pressed and accelerometer motion simulated by moving the mouse over the image. You can even click on the input/output pins.

For certain coding situations, special buttons appear (for instance, a shake button and one that presses both the A and B buttons simultaneously). Even so, not everything can be simulated. Projects that involve things like wireless communication will have to be done with a real board.

The website supports a number of different software development languages, as we’ll see shortly. However, the Micro Bit board supports a few more, including the C/C++ language.

Code Blocks


Newbie coders can start with Microsoft’s Block Editor to build code via colourful snap-together blocks (microbit.co.uk/blocks/contents). Some blocks listen out for button presses; some capture sensor data readings; others test the status of the edge connector pins; and there are many ways to control individual LEDs or the complete LED array.

If you’ve used MIT’s Scratch (scratch.mit.edu), you’ll find this kind of coding interface familiar. Just like Scratch, the Block Editor encourages youngsters to transform their ideas into code. To find out more, read the Block Editor book (microbit.co.uk/blocks/book).

Code Kingdoms is an alternative drag-and-drop, block-based coding interface. However, this time the blocks you choose are used to generate JavaScript code, so you start with blocks and end up with a JavaScript program. Currently, the coding experience isn’t as smooth as with the Block Editor, but this may change in the future.

If you prefer, you can start with blocks, then continue by typing in the JavaScript code directly. This means Code Kingdoms neatly bridges the gap between blocks and text-based code. The Code Kingdoms cookbook (goo.gl/QNssjS) has plenty of project examples.

Micro Bit front

Code Scripts


More experienced coders might prefer Microsoft’s TouchDevelop online environment (touchdevelop.com/microbit). TouchDevelop is a touch-friendly, text-based general purpose app development language. In this case, it comes pre-configured with a set of Micro Bit commands and libraries.

Command sets are presented towards the bottom of the browser window (see TouchDevelop image). Just click or touch a command to insert some code. When the code appears, a new set of command options will be automatically presented for the next step.

It’s a great way to explore what’s possible. However, after a while, you might prefer to simply type in the code, and with TouchDevelop you can do this too. In this case, the command options still change as you type, providing a useful visual reminder of what to type next.

Interestingly, you can start coding with the Block Editor then ‘convert’ the blocks to a TouchDevelop code listing. For a full explanation of what’s possible, take a look at the TouchDevelop documentation (microbit.co.uk/td/contents).

Python coding support on the Micro Bit is provided by MicroPython. Here, Python scripts are combined with the MicroPython firmware and uploaded to the device. Python is likely to be a popular choice due to the huge collection of existing Python libraries and code examples.

MicroPython didn’t go live on the website until mid March. So far, there’s no simulator, but if you own a Micro Bit board, you can write Python scripts using your favourite code editor, then upload them via the micro-USB port.

Getting Started


As with any new piece of technology, it can be tricky to discover how to get started. In this case, everything is available from the official Micro Bit website.

On the Getting Started page (microbit.co.uk/getting-started), you’ll find numerous introductory-level videos. They include an introduction to the Micro Bit board itself, overviews of the Microsoft Block Editor, Microsoft Touch Develop and Code Kingdoms coding environments, plus glimpses of maker-style projects.

In addition, each one of the coding environments has a series of online lessons, from simple newbie tutorials to more advanced Micro Bit challenges, such as building your own air guitar, and there are specific categories for coding and builder-focused projects.

The help page (microbit.co.uk/help) is a useful resource, as it covers a wide variety of Q&A topics. Meanwhile, Teachers and parents have their own page with lesson and project ideas (microbit.co.uk/teachers-and-parents).

Simple Projects


Even without writing a line of code, you can play a game of Snake. It’s hidden in the pre-installed program. Just press the A and B buttons together when you see the heart animation.

The 25 LEDs can be programmed to blink, fade, display static or moving patterns and show scrolling text messages. The two user input buttons can be programmed to trigger events. They could start an animation, begin recording data, control a game and much more.

The accelerometer tracks the Micro Bit’s movement and orientation in real-time, so it could be used to switch display information or as a game controller. And with a Bluetooth LE connection you can have fun communicating wirelessly with laptops, tablets, smartphones, keyboards, game controllers and so on.

The Micro Bit website has a collection of project tutorials ,which cover some of the ideas mentioned above in greater depth.

Pi Zero Comparison


How does the Micro Bit board compare with the £4 Raspberry Pi Zero? Well, the Pi Zero is a very different computing platform and a far more flexible device.

The Pi runs a fully featured Linux operating system. So you can install thousands of apps, and it supports just about any coding language. Plus there are masses of code examples and hundreds of active projects, and it’s backed by a large and enthusiastic community that spans the globe.

In fact, you could use the Pi Zero, or any Pi model for that matter, to write programs and upload them to the Micro Bit. Also, the Pi could act as the control computer in a maker-style project, handling input and output from one or more Micro Bit devices. Remember, the Micro Bit already has sensors, buttons, LED array and wireless Bluetooth LE connectivity.

As of mid-March, the consumer price for the Micro Bit has not been set, nor do we know about availability, so it could be that a Pi Zero and sensor HAT combo might not be much more expensive.


Micro Bit Links
• Home: microbit.co.uk
• Help: microbit.co.uk/help
• Getting Started: microbit.co.uk/getting-started
• Coding: microbit.co.uk/create-code
• TouchDevelop: touchdevelop.com/microbit
• Teachers/Parents: microbit.co.uk/teachers-and-parents

Code Deployment


When you finally get your hands on a Micro Bit board, you can export your code from the online coding environment and deploy it onto the device.

To do this, the block or script code needs to be converted into something that’s understood by the Micro Bit’s Nordic Semiconductor nRF51822 ARM Cortex-M0 microprocessor. There are a number of steps involved, including converting the code you’ve written into a binary ‘hex’ file and downloading this file to the board via the micro-USB port.

Fortunately, we don’t need to worry about the details, as it all happens in the background after you press the ‘Compile’ button in the coding environment. But take a look at the Code Deployment diagram to see an illustration this deployment process for Microsoft’s Block Editor or TouchDevelop tools.