Connecting the BBC micro:bit to Windows and adding code to it
Last updated: Nov 5, 2022
This page details how to connect the BBC micro:bit to Windows then install a pre-written program to it. This guide was written to support some of my ‘how-to’ guides for assistive technology devices I made using the BBC micro:bit.
Author: Matthew Oppenheim
email: matt.oppenheim@gmail.com
GitHub site: https://github.com/mattoppenheim
Summary
Connect the microbit using a micro USB cable from the microbit to the Windows device. You do not need a battery pack for the microbit. The microbit is powered from the USB connection.
- Install the driver for the microbit if you are not using Windows 10.
- Connect the microbit using a USB cable to the device with the communication software on it.
To install software, drag and drop the file, which ends with .hex, into the MICROBIT folder.
Connecting a microbit to a Windows machine
Connect your microbit to your Windows machine using a USB cable.
BBC microbit board connected using a micro USB cable to the Windows device. A battery pack is not needed.
Windows 10 should automatically detect the microbit. If you are using an earlier version of Windows, you will need to install the driver for the microbit.
If File Explorer shows that the microbit is attached, you are done. Success. The screenshot of File Explorer below shows that the microbit is connected as a drive called ‘MICROBIT’. A new microbit has a demo program installed which will scroll all kinds of things across the LEDs.
If the microbit does not automatically connect, download and run the microbit driver installer.
microbit showing as successfully connected in File Explorer.
How to install the microbit driver if the microbit is not detected
Windows 10 should recognise the microbit, but in testing, this was not found to always be the case. The driver can be manually installed using the instructions in this section.
I found that Windows 7 would find and download the driver for the microbit on its own when left for about 5 minutes. The microbit needs to be connected with the USB cable first.
If for any reason the driver is not found and installed by Windows automatically, then the driver can be downloaded and installed manually.
The name of the driver installation file is:
mbedWinSerial_16466.exe
A newer version may be available.
Get this file by clicking on the ‘Download current driver’ link on this page: https://os.mbed.com/handbook/Windows-serial-configuration
The microbit needs to be plugged in before the serial driver installer is run.
Follow the instructions on the webpage to install the driver. Once installed, the microbit should show up as a connected drive, as shown in the screenshot above.
Installing code on to the micro:bit
The micro:bit is programmed by placing .hex files onto it. This can be done by dragging and dropping these files onto the MICROBIT folder from File Explorer. For instance, if you are trying to install a file called ubit_flash.hex, the file called ubit_flash.hex needs to be dragged and dropped into the MICROBIT folder as shown in the screenshot below.
Drag and drop the file ubit_flash.hex to the MICROBIT folder.
Wait about 10 seconds for the microbit to start to program. The light on the back of the microbit will then flash for about 10 seconds as it loads the new program.
The code will remain stored on the microbit and run whenever it is powered. The microbit can be left unpowered and the code will stay on the device for when you next connect it to the Windows device.
As the microbits are being distributed to all 11-12 year-olds in the UK, if you get stuck installing code on to the microbit and live in the UK, find a friendly 11-12 year-old to help you out.
Problems
Microbit is connected, but the software tells you that no microbit is found
If a microbit is plugged in and you still get the message that there is no microbit connected, then the microbit driver is not installed. Look at ‘Installing the microbit driver’.