Data logging with the BBC micro:bit

With the XinaBox IM01 bridge and a BBC micro:bit you can build a powerful data logger capable of recording large data files onto an SD card.

Being able to easily record large data files unlocks activities and experiments that are not possible with the micro:bit's limited built-in memory and allows for the introduction of real data science into the classroom.

It is very quick and easy to build - the hardware can be assembled in seconds and the code required is provided for you. Get your data logger up and running in three quick, simple steps:

  1. Setting up the hardware
  2. Flashing the code
  3. Powering up and using the data logger 

1: Setting up the Hardware: 

You need the following hardware: 

  • 1x BBC micro:bit
  • 1x micro:bit USB cable
  • 1x IM01 micro:bit bridge
  • 1x microSD card

     

      To assemble the hardware:

      • Format the microSD card and insert it into the slot on the IM01. It is not always necessary to format the SD card first, but it is recommended.  If you are unsure how to format an SD card the process is explained on this wikihow page.
        •  There are different options you can choose when formatting your microSD card: choose "FAT32" (not "exFAT"; "FAT" works but the developers recommend FAT32)
        •  If the program you are using to format your card does not have FAT32 as an option consider downloading a free app that will provide you with more formatting options (e.g. this one).
      • Slide the micro:bit into the IM01:  It is very easy, you just need to make sure they are both facing the right way.  There is more detail on the getting started page. When connected together your micro:bit and IM01 should look like this:

        The video below shows the components being assembled:

      2: Flashing the code

      The code required to power the data logger is pre-compiled:

      • Download the hex file DataLogger v1.06.hex from this folder.
      • Flash it onto your BBC micro:bit (connect your micro:bit to your computer then drag and drop the file onto your micro:bit)

      3: Powering up the data logger

      For power you can use your micro:bit AAA battery holder or connect a USB cable to either the micro:bit or the IM01. There are also a load of battery pack xChip options that will work (check out the full range here).

      If you have worked through these 3 simple steps then your micro:bit data logger is ready to use!

      Using the micro:bit data logger:

      With your micro:bit data logger powered up and running:

      • press A to start logging data from the micro:bit internal sensors (accelerometer and magnetometer) to a csv file.
      • Press A again to stop logging.
      • Press A again to continue logging data to the same file.
      • While recording data the LEDs on the micro:bit will pulse on and off and a green light will show on the IM01.
      • While recording click the B-button to tag a record in the data
      • Data is recorded to csv and file sizes of >1gig are possible
      • When you are finished take out the SD card and put it into your laptop to access the data on the csv file.

      The data logger app also works with the XinaBox SL01 light sensor and the XinaBox SW01 weather sensor (both of which are included in the XK04 STEM kit for micro:bit). Just connect either or both of these sensors to the data logger and restart your micro:bit. Now when it runs the data logger will also record data from whichever sensor is attached.

      Troubleshooting:

      When you power up the circuit you should see the following:

      1. The blue power indicator on the right hand side of the IM01 turns on.
      2. The LED on the IM01 may flash blue for a short period.
      3. The LED on the IM01 will turn a solid blue when it is ready to record.

      If you do not see a solid blue light, the first thing you should try is removing the power, then powering it up again (yep, the classic turn-it-on-and-off).

      The most common issue that we encounter is with microSD cards that are not formatted in FAT. If you have problems please ensure your microSD card is correctly formatted - there are details further up this page that will help.

      The circuit may misbehave if you have a CW01 plugged into it. Remove your CW01 if you are having difficulties.

      If you continue to have issues please get in touch and we will try to help:  

       

      Find out more about XinaBox and micro:bit on our getting started page.