Home Technology Development BBC micro:bit — First Steps (Part 1)

BBC micro:bit — First Steps (Part 1)

142
0
SHARE

What is the BBC micro:bit?

And what can you do with it?

The BBC micro:bit is a small and relatively simple single board computer. The idea is to encourage children to be creative with technology, and learn programming (or ‘coding’, to use the currently fashionable name for it).

The BBC describes the micro:bit as a ‘pocket-sized codeable computer with motion detection, a built-in compass and Bluetooth technology’. In 2016, the BBC gave a free micro:bit to every child in year 7 or equivalent in the UK.

BBC micro:bit
The BBC micro:bit is incredibly small. More

Although it seems quite simple, the micro:bit’s hardware is fairly powerful in certain respects, compared to (say) the original BBC Micro from the 80s. But due to the incredible progress in computing power over the last few decades, the micro:bit’s processor is extremely low-end when compared to today’s computers and smartphones.

Don’t let that put you off though — the micro:bit doesn’t exist to compete with normal computers; it’s not made for running Excel or Chrome, or having a massive screen connected to it. In the world of embedded systems, things are done differently. What matters here is low cost, low power consumption and small size. For many tasks, a fast and expensive processor is not required.

Unlike most computing devices today, the micro:bit gives you good access to the hardware, to encourage you to experiment. You can construct a small programmable device of your own, by building your idea around a micro:bit. There’s no need to worry about developing complicated circuits involving things like Bluetooth or USB — the micro:bit handles all that for you. Instead, you can concentrate on the things that make your application unique.

Here is a summary of the hardware features.

General Hardware Features

  • 43 x 52 mm in size
  • Display with 25 LEDs, arranged in a 5 x 5 grid
  • Accelerometer
  • Temperature sensor
  • Bluetooth
  • USB
  • Two general-purpose buttons, plus a reset button.
  • Easy connection of three signals using crocodile clips. These can be digital inputs, digital outputs, or analogue inputs.
  • Additional inputs and outputs are available if a suitable connector or ‘break out board’ is used.

Technical Details

Feel free to skip this section! Or see the Wikipedia Page for more details.

Main Microcontroller

  • Nordic nRF51822, 16 MHz 32-bit ARM Cortex-M0 microcontroller
  • 256 KB of flash memory
  • 16 KB of static RAM
  • 2.4 GHz Bluetooth networking
  • The ARM core can switch between 16 MHz and 32.768 kHz

Second Microcontroller

  • NXP/Freescale KL26Z,  48 MHz
  • Provides the USB interface and interfaces to the main microcontroller

Edge connector

  • 20 small connections: These give access to GPIO, analogue input, I2C, SPI, power and ground.
    (Note: The on-board buttons and LEDs share some of these signals.)
  • 5 large connections: Three GPIO / analogue inputs, power and ground

ADVERTISEMENT

Other Similar Devices

The micro:bit isn’t the first device of its kind. These days, we are almost spoiled for choice when it comes to ready-made low-cost embedded micro hardware, to simplify the construction of home projects. When the micro:bit was released a couple of years ago, it joined the likes of the Raspberry Pi and Arduino, as another option for experimenting with hardware and software, particularly at the simpler end of the scale.

I think all these different boards have their uses, and the micro:bit seems to have a useful blend of features, low cost, small size and easy-to-use development tools.

BBC micro:bit go
The BBC micro:bit go comes with a battery pack and USB cable. More

A micro:bit for Christmas

My youngest son surprised me at Christmas 2017, by buying me a micro:bit go — shouldn’t it have been the other way around?! A few weeks earlier, he’d noticed that I was interested in the micro:bit when we were having a look around our local Maplin store.

(For Christmas 2016, I’d bought him an Arduino kit; but that’s a story for another article.)

I was curious about the micro:bit when it first came out, but didn’t investigate further — so it was great to finally get my hands on one.

Even though I’ve worked with a wide range of microprocessors and microcontrollers since the 80s, the novelty of playing with such devices still hasn’t worn off — even (or perhaps especially) at the simpler end of the scale!

The 5 x 5 display on the micro:bit. More

Starting Simple

I wanted to get the micro:bit to do something of my choosing as quickly as possible. Normally, people would write a program which displays ‘Hello World’. But I decided to display one of two images for a fixed time, depending on which of the buttons was pressed.

It doesn’t sound like much, but I prefer to do something quick and simple to begin with. I’ve tried to recreate what I did, for the purpose of this article and the video.

Looking on the various micro:bit websites today, there seem to be quite a few options for creating programs. Some involve writing code in text form, and others take a more graphical approach, where blocks are arranged on the screen, to implement the required functions. With everything being aimed at children, the websites seem to contain a lot of rather large text and images.


ADVERTISEMENT

Using the JavaScript Blocks Editor

Website: makecode.microbit.org

With this website, you simply drag and drop blocks into place, to create your program. It can take some time at first to find the blocks you need, so I tend to use the search feature.

I think I used a different programming environment last December, but this one seems very easy to use, which is why I chose it for this article and the associated video.

JavaScript Blocks Editor for BBC micro:bit
JavaScript Blocks Editor for BBC micro:bit at makecode.microbit.org

Once you’ve got your blocks arranged, you can try it immediately it in the web browser, thanks to the simulation area on the left. If you want to run your code on a real micro:bit, you just download a .hex file, and copy it over a USB cable — the micro:bit shows up rather like a flash drive, and you simply drag the file across to it.

The hex file generated for this simple project was 568 KB in size, which seems quite a lot considering how little code was written. However, the hex format is not designed to be compact, and is just a text-based method of representing a binary file. Also, there is a lot of overhead when programming at a high level (meaning quite far removed from the hardware). But the benefits are ease and speed of development, so it is still a good approach, especially when first starting out.

Conclusion

The micro:bit is very easy to use, and has a lot of potential uses. Despite its ‘simple’ appearance, there is quite a lot of clever technology beneath the surface. I hope it encourages a new generation to become interested in developing embedded systems.

Related Articles

Showing random numbers and temperature:
BBC micro:bit – First Steps (Part 2)

Remembering the BBC Micro
Memorable 1980s Home and Personal Computers

External Links

BBC micro:bit Wikipedia Page
BBC Make It Digital

The website used in this article and video:
makecode.microbit.org

Even more ways to create code can be found at:
microbit.co.uk/create-code

Purchase Links

BBC micro:bit go (with accessories) at Amazon
BBC micro:bit (no accessories) at Amazon

(Disclosure: Using Amazon links found here helps support this site.)


ADVERTISEMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here