Features and Hardware

Micro:bit hardware

!!! JARGON ALERT !!!

The BBC micro:bit is a Printed Circuit Board (PCB) with Integrated Circuits (ICs - commonly known as "chips", which is short for "microchips"), different physical connectors for power supply (battery) and data transfer (USB and edge connector pins), and other embedded components for input (e.g. buttons), output (e.g. LEDs), and attaching to or communicating with other external devices and components (e.g. radio, edge connector pins).

Let's break that down, shall we? Flip your micro:bit over to the back and let's have a look at it. You'll see that the main features are clearly labelled.

Printed Circuit Board

See all the little lines on the micro:bit going from one part to another? (you might have to hold it up to the light). These are wires which have been printed onto the board and covered (to protect them) - these are the "roads in this electric city" upon which electrons travel. Most circuit boards you normally see are green, but they can come in many colors.


The Processor (CPU)

The central chip which does all the hard computation is the biggest chip on the back of the micro:bit. You may have heard the term "CPU" (Central Processing Unit) for laptops and computers - this chip is the CPU for the micro:bit. It's also the ambient temperature sensor!

The Reset button

Normally, the reset button simply restarts your micro:bit program. It is also used to put the micro:bit into "maintenance mode" for when you are upgrading the firmware, which is the onboard software which drives all the hardware.

We'll go through the rest of the hardware and features during the rest of this lesson, but here's a more technical image for the techie teachers (see micro:bit hardware for super technical stuff):

Inputs & Outputs

Senses => Sensors = Inputs

We use our eyes, ears, mouth, nose, and skin to make sense of the world around us. We humans are so clever, we've been able to create artificial senses, called sensors which can detect many of the things we can and more, and sometimes with more accuracy than us!

Senses are our inputs; sensors are our computer's physical inputs - we read information from them. Being able to understand & identify these physical inputs on a digital device is part of DDDO PO1&2 and understanding and using the information they provide as input for coding is an important part of Computational Thinking PO3+.

Information from a physical input is usually read in the form of a number - either a digital (0 or 1) or an analog value (within a range, e.g 0-1023).

On the micro:bit there are 7 inputs:

  • Light sensor

  • Temperature sensor (we won't be looking at this in detail, so follow the link for more info)

  • Accelerometer

  • Compass

  • Radio

  • Bluetooth

  • Pins

Outputs

An output, in physical computing terms, is something that we can send some electricity to - that we can write to, e.g. a LED, a motor, or a speaker.

Being able to understand & identify these physical outputs on a digital device is part of DDDO PO1&2 and understanding how to write information to these outputs is an important part of Computational Thinking PO2+.

On the micro:bit there are 4 outputs:

  • LEDs

  • Radio

  • Bluetooth

  • Pins

Input or Output?

You may have observed that all the outputs are also inputs, ie, we can read from and write to them. This can be really useful, and we'll delve into this later on.

The LEDs - sensing and creating light

The micro:bit has 5x5 grid of red Light-Emitting Diodes (LEDs) which can create and detect light (even at the same time! 🤯). This makes them both an input and an output!

Output - creating light

The LEDs can be programmed to create/display:

Each LED has an XY co-ordinate with 0,0 being the top left LED (see image above) and can be turned on & off using the plot/unplot blocks in the LEDs drawer. You can also change the brightness of LEDs (see LEDs drawer > more), even individual LEDs.

See the following drawers for creating with LEDs:

  • Basic (the first 4 blocks)

  • LEDs

  • Advanced > Game

  • Advanced > Images

Input - sensing light

There is a single block in the Input drawer called light level. This provides a value between 0 (dark) and 255 (bright light) and can be used to detect the ambient light level of your surroundings.

Here's example code for graphing the light level:

Detecting movement - accelerometer + compass

Motion sensors

Just like our senses of balance and direction, the micro:bit has internal sensors for motion sensing - an accelerometer and a compass.

Accelerometer

This detects acceleration, ie. micro:bit movement, measured in milli-gravity or mg (heard of zero-G in space? This is similar). Using this, the micro:bit can detect a range of gestures, including shaking, free-falling, and tilt.

Try a project which uses the accelerometer:

Compass

The compass detects the earth's magnetic field, which allows us to detect the direction our micro:bit is facing and magnetic force (measured in micro-Teslas).

Try one of these projects which use the compass:

Radio & Bluetooth

The micro:bit can communicate wirelessly with other micro:bits using a simple radio protocol, and with other devices using Bluetooth.

These protocols both send and receive packets of data in the 2.4Ghz (GigaHertz - billion times per second) range of the electromagnetic spectrum so they can not be used at the same time.

Radio

Using the Radio Blocks, you can send and receive:

  • numbers

  • text (in programming, we call these "strings", because the datatype strings characters together)

  • name/value pairs

You can have different radio groups, so students can communicate on their own "radio channel"; and you can get information about each packet received, including time when sent, serial number of micro:bit, and signal strength.

As this feature requires multiple micro:bits, Radio Games are a fun group activity - if you have 2 micro:bits or are working with another teacher, try one of these out!

Bluetooth

Bluetooth is a wireless communication protocol commonly used by smartphones and laptops to communicate with a bunch of other devices. Using Bluetooth Low Energy , the micro:bit can:

  • share sensor information with your smartphone/computer (see the awesome Bitty data logger)

  • control your smartphone

  • receive information from your device

In order to use the Bluetooth blocks we have to add a Bluetooth extension. Extensions are MakeCode's way of extending the capabilities of the micro:bit, allowing anyone to create their own custom set of blocks.

We will talk more about extensions later, but for now, you can add a Bluetooth extension by going to the Settings Cog icon and clicking on Extensions

then click on Devices, which will also bring in the Bluetooth Services blocks:

You will see a warning that the Radio extension is incompatible (remember, they can't operate at the same time) - ignore the warning and click the big red button:

You should then see Bluetooth and Devices as new drawers:

See the mobile apps guide to download apps which can connect with your micro:bit.

Fun fact: you can wirelessly connect your micro:bit to Scratch (over Bluetooth) and use your micro:bit to interact with Scratch! Use it to create multimedia installations and more!

Some Bluetooth projects:

The Pins

The micro:bit has 25 external connectors on the bottom (the gold bits) which are called "pins".

5 of them have space for attaching alligator clips and holes for attaching banana connectors, so you can attach motors, LEDs, extra sensors, and other electrical components.

Pins 0-2 above can be used to read or write both digital and analog signals. Digital is on/off, true/false, 1/0; analog is a range of values, e.g. 0-255. There is an entire Pins drawer under Advanced:

You'll also see Pin blocks in the Input drawer and all Music is output on Pin 0 by default.

The 3V (3 volts) and the GND pins are like the positive and negative on a battery, so you can power other things with them.

Fun fact: the electric charge coming out of the micro:bit is Direct Current (DC), which is far less dangerous than the Alternating Current (AC) which comes out of a wall socket. Your computer has a transformer which turns AC to DC.

The Pins page on microbit.org is so good, that I want you to go read it now! (I hate reinventing the wheel)

Create a Love Meter

Now that you know all about Pins and aren't confused at all, try the Love Meter project - it's a good intro to using a "pin press" event for you and your students! It works by using our bodies' natural electrical conductivity to complete a circuit between Pin 0 and the GND pin.