Tutorial: Using micro:bit and Make Code with Data Streamer


Microsoft Make Code is a helpful tool to learn or teach beginners of all ages how to code with the added bonus of allowing you to use software to control hardware devices.

This tutorial will teach you how to use the Make Code platform to write a simple program that sends live data from the BBC micro:bit to Microsoft Excel using the Microsoft Data Streamer add-in.

The example program we use in this tutorial prints the micro:bit accelerometer data into Excel. You can modify and adapt the basic program to work with other micro:bit sensors or external sensors.

What you will need for this project


  • micro:bit microcontroller


Windows 8 and newer do not need an additional driver. If this is your first time programming a micro:bit on Windows 7, you'll need to download the mbed drivers for your computer.

  • microUSB to USB cable


  • Microsoft Excel O365
  • Data Streamer Excel add-in enabled
    • Data Streamer is free with all subscriptions to O365

Using the Make Code Blocks to Print Data to Serial

The serial port on your computer is how Microsoft Data Streamer gathers data from external devices. This section shows you how to use the Make Code blocks to print data to the serial port.

  1. Plug in your micro:bit and go to the Make Code website.

  2. Select the “micro:bit” option and create a new file. This will take you to the MakeCode block interface.

  3. Add the HackingSTEM Data Streamer extension.

    Data Streamer Add-In.

    Go to Extensions, located at the bottom of the code blocks, and search for Data Streamer. Click on the HackingSTEM Data Streamer add-in to enable it.

    Set Baud Rate.

  4. Back in the Block section of MakeCode, locate and open the yellow/orange Data Streamer blocks in the top section.

    Set Baud Rate On Start.

  5. Set the Baud Rate by dragging the “Set Baud Rate” block into “On Start”. Use the default setting (9600).


    Baud Rate is the speed at which the computer and the micro:bit communicate.

    Write Number Array 1.

  6. Next, print data to serial with the write number array block. Drag this into the forever block.

    Write Number Array 2.

  7. In the array of slots, insert the data you want to print to serial. For this example, we are printing the micro:bit accelerometer x, y, and z values.

    Accelerometer Change Axes.png.

    Accelerometer blocks are in the “Input” section. Remember to change the selected variable from “x” to y and z accordingly.

    Write New Line.

  8. Print a new line after the array to denote the end of the data packet in Data Streamer. Do this by dragging the “write line” block from the Data Streamer section.

    Add Pause.

  9. Optional: Add a pause to more easily see the data as it is printed.

Downloading Code onto the micro:bit

Once you've got the Make Code block program, you are ready to upload it to your micro:bit! There are two ways to do this which are outlined below.


Option 1 is faster as it involves fewer steps. However, some computers may not permit you to download files directly onto the micro:bit, so you may need to use Option 2.

Option 1

Download Code Onto Micro:bit.

Download and save the code file directly onto the micro:bit drive.

Option 2

Download Code Into Downloads 1.

Download and save the code file into a folder on your computer.

Download Code Into Downloads 2.

Open File Explorer, navigate to the folder in which you saved the code file, then drag the code file onto the micro:bit drive.

Using Data Streamer

You are ready to use Data Streamer! Open Excel and navigate to the Data Streamer tab.

Connect A Device.

  1. Click “connect your device” to select the micro:bit USB device.

[!!NOTE] If you see more than one device listed, unplug your micro:bit and observe which one disappears, then reconnect and select that USB device.

Start Data.

  1. Click “start data” in the Data Streamer tab and navigate to the Data In sheet to see micro:bit accelerometer data printed in three separate columns.

  2. You can plot the data to more easily observe changes over time and do data analysis with Excel’s built-in functions.

More to Explore

Excel Data Analysis

Experiment with different data visualization tools and built-in equations for data analysis. Here are some helpful Excel guides:

  1. Visualize Streaming Data in Excel
  2. Create Macros for Streaming Data
  3. Creating a Data Table
  4. Create a Trial Storage Table

HackingSTEM Projects

Looking for project ideas? The Microsoft HackingSTEM team has tons of open-source projects and curriculum! Below are some of the HackingSTEM projects that use the micro:bit.

  1. Electroconductivity Meter
  2. Flex/Pressure Sensor

Check out the full HackingSTEM activity library here.

Please reach out to us if you have any questions, comments, or ideas! We also love seeing what folks build with our projects, so please share your creations and tag us on social media!