BBC micro:bit
Getting Started With Components

Introduction

The micro:bit has 25 external connections that can be used to attach electronic components to use with your micro:bit programs. We call these pins. You might also see the initials GPIO in pages describing how to use the micro:bit. GPIO stands for General Purpose Input Ouptut and refers to the fact that you can use these pins for your own purposes.

It is a good idea to try some of these things out in clubs at school before spending money on something that you struggle to make work.

Large & Small Pins

There are 5 large pins. These are labelled on the micro:bit and are 0, 1, 2, 3V and GND. You can connect things to these pins using crocodile/alligator clips. The smaller strips of gold are also connected to pins on the microcontroller. These are a little harder to connect to. For less than £5, there are special connectors that you can buy that provide more convenient access to these pins. These are called edge connectors and would allow you to work with a solderless breadboard, a more convenient way to experiment with components.

The holes in the large pins are a nice fit for 4mm banana connectors. I have made some custom cables with spare banana connectors so that I have breadboard friendly pins on the other end of the cable. Buying 5 banana connectors and some cable costs around the same as an edge connector.

Solderless Breadboard

When experimenting or prototyping with a microcontroller, the solderless breadboard is your best friend. The image shows an example of one the types of breadboard you might buy for a few pounds,

Solderless Breadboard

You place the metal pins of your components into the holes in the breadboard and connect them to the microcontroller using jumper wires (wires with metal pins at each end). The following diagram shows how the holes on the breadboard are connected to one another,

Solderless Breadboard

The vertical lines are the power rails. These work the same way on both sides of the breadboard. We normally use the red strips for power (3V3 on the micro:bit) and the blue ones for GND. Each group of 5 holes is connected together.

Pinning Diagram

Here is a large diagram of the edge connections with labels to show what each one represents.

micro:bit Pin Diagram

The diagram can be a little confusing if you are new to working with microcontrollers. Let's try to make sense of some of that information.

Pins 5 and 11 are connected to the two buttons on the micro:bit. This allows you to register or trigger a button press using an external component. You could connect a different (larger/better) button to the one of these pins and GND. When the button is pressed, the voltage on the pin goes to 0. This suggests that internal pull-up resistors are used on these pins to pull the digital signal high when the switch is open. This is the normal way to work with switches. Even though it seems odd to get a high signal when the switch is closed (ie circuit is complete), this tends to provide a more reliable way to read the button and avoids an effect with switches that is called bouncing.

Some of the pins are labelled to show that they are being used for the LED matrix. It will be possible to connect to those pins if the matrix is not being used for the program. Otherwise, they need to be avoided.

Power

3V3 is the way that 3.3 volts is normally written. It is written this way so that the decimal point cannot be missed in small print. All of these connections are the positive power connection you make when you connect a component. GND is short for ground. This is our 0 volt or negative connection when we want to connect things. Connecting these two things together is a bad thing - it causes a short circuit and might damage the board.

Analog & Digital

Electronic components rely on either digital or analogue signals. A digital signal means that the input to or output from the component is either 3V3 or 0V. Digital information is like a bit in binary - it can be one of only two values. Pushbuttons or switches are good examples of digital inputs. The button is either being pressed or it is not. There is no in between for these two states.

Analogue components accept input or produce output consisting of a range of voltages from 0V to 3V3. The microcontroller contains an ADC (Analogue to Digital Converter) to convert these analogue signals into a value that can be used by the microcontroller. The micro:bit has a 10 bit ADC so it converts analogue input into a value in the range 0 - 1023. Potentiometers and light sensors are good examples of components that rely on analogue signals.

More Terminology

Pins 19 and 20 are labelled I2C1. These two pins are used to connect devices to the microcontroller using a protocol called inter-integrated circuit or i2c. Whilst you will be able to connect on these lines when the code editors and libraries have been developed further, it is useful to know that the accelerometer and compass on the board are already connected on these pins.

Pins 13 - 16 are used for the SPI or Serial Parallel Interface. This is another standard for communication between electronic devices and is often used for communicating with sensors or displays.

In Summary

You can connect analogue components to pins 0, 1 and 2. You can connect digital components to any of these as well as using pins 8, 12 and 16. That gives you 6 ways to connect to the microcontroller without any effect on the built-in components.