Programming Languages

Off-The-Shelf Hacker: Meet the micro:bit

28 Jan 2017 3:00am, by

The micro:bit is a small ARM microcontroller developed by the BBC, along with a gaggle of technology giantsto give away to children in the United Kingdom to help them learning computing. The device was released to teachers in early 2016.

As a hardware hacker, I was curious about how this board compared to an Arduino or Raspberry Pi. As always, I also wanted to see how the micro:bit might play with a Linux notebook and if it had a place in the Off-The-Shelf hacker’s tool box.

The device is interesting and has some cool features. Let’s take a look.

Hardware Overview

The board fields a 16 MHz, 32-bit Arm Cortex-MO micro-controller, 256 KB of flash and 16 KB of static RAM. It also has a Bluetooth Low Energy radio onboard for local networking with a super phone or other Bluetooth-equipped device. There’s an additional ARM microcontroller that handles the USB connection and external power management. As an Inter-Integrated Circuit (I2C), it includes an NXP/Freescale MMA8652 three-axis accelerometer and a NXP/Freescale MAG3110 three-axis magnetometer. The front-end user interface is a 25 surface-mounted LED array (arranged in a 5 X 5 matrix) and two push buttons. The back side of the board has the micro-USB connector, a power/upload status LED, a reset button and an external 3.0-volt connector.

Front view of the micro:bit.

Back view of the micro:bit.

There’s also a 23-pin edge connector and 5-ring connectors. You can connect alligator clips or banana plugs to the ring connectors for simple projects.

The two right ring connectors are for +3.0 volts and ground. Pins 0, 1 and 2 serve as analog inputs, while the remaining 23 connectors function as GPIO, analog in, power, and ground pins. Some of the pins are shared with the onboard LEDS. Various pins also support I2C and SPI buses.

There’s a convenient help page describing the pins in much greater detail.

How about Software?

Recall that the Raspberry Pi is a multi-user, multi-tasking system. In contrast, the micro:bit is similar to the Arduino microcontroller. It’s doesn’t have a Linux operating system or micro-SD card. There isn’t a WiFi stack, either. Don’t let that put you off, it’s a nice little package with plenty of power and capabilities. Code development is handled on a notebook and uploaded to the micro:bit as firmware.

The micro:bit uses web-based applications for editing and uploading code. Of course, using web-based tools means you’ll need a WiFi or Ethernet connection on your Linux notebook.

Don’t have WiFi? No problemo, use your super-phone. Download the Android app and pair the micro:bit with your phone over Bluetooth. The web-based applications work via the phone, as well. In an upcoming article, we might cover using the Android app with the micro:bit.

Several of the editors are visual-based, “slide the parts together” apps quite suitable and intuitive for children and beginners. They include:

  • MicroSoft PXT: Supports block-based editing and JavaScript.
  • Block Editor: Supports drag-and-drop code blocks.
  • Javascript: Code Kingdom is a drag-and-drop editor for JavaScript.

I prefer traditional text editors, so fortunately, there are a couple of those, as well:

  • Python: Text-based editor that has a collection of pre-built code snippets for use in your projects
  • Microsoft Touch Develop: An editor that’s designed for building mobile applications with a touchscreen

I’m somewhat familiar with Python, so that’s the one I used during this review. Here’s a screenshot of the requisite “Hello, World” script, with some additional code I snarfed from the reference manual.

The Python Editor With My Code Additions

The MicroPython documentation is easy to use, comprehensive and full of useful code snippets. Start with the tutorial introduction page. There’s a handy index along the left side of the screen, that will take you to the various topics.

Once the code was finished, I simply clicked the “Download” button to compile everything into a .HEX file. The file then showed up in my /home/rob/Downloads directory. I used the provided USB cable to connect the micro:bit board to my Linux notebook and copied the file into the /media/rob/MICROBIT directory. Using the Thunar file manager application on Linux makes handling files a breeze.

After copying the file (uploading) to the MICROBIT directory, the board will reboot and run the script. If there is an error, a message will scroll across the LED array, pointing to the offending line in the code.

Slick!

Going Further

Even if you are used to working in the Arduino IDE ecosystem, I think the micro:bit shows a lot of promise as an easy-to-program micro-controller platform. Python is gaining in popularity on nano-sized systems. You may have already used Python with the Raspberry Pi.

And, I like the idea that you can simply compile the program and use a simple file copy to upload the firmware to the board. That’s a heck of a lot easier than the standard Arduino upload, particularly to ESP8266 boards.

While we didn’t get into general purpose input/output (GPIO) capabilities today, the micro:bit is a solid product and I’ll likely cover other details and features, in future articles.

Although the micro:bit isn’t available in the U.S. yet (though plans are afoot to bring it to the colonies), it is available in the U.K. and in much of Europe, through resellers.


A digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.