Skip to main content

DIY Data Science with microbits

DIY Data Science: A Complete Guide to Data Logging with the Micro:bit V1

Whether you are a STEM teacher looking for a classroom lab solution, a parent seeking a weekend project, or a maker building an environmental monitor, the Micro:bit V1 is a hidden gem for data logging.

While the newer V2 has built-in logging memory, the V1 is incredibly capable when paired with a computer. By using the Serial (USB) Connection and Radio Communication, you can turn these pocket-sized boards into useful sensors.

The Equipment List

To get started, you will need:

  • For Local Logging:

    • 1x Micro:bit V1.

    • 1x Micro-USB cable (high quality, data-capable).

    • A computer with a Chrome-based browser (to use the WebUSB feature in MakeCode).

  • For Remote Logging:

    • 2x Micro:bit V1s.

    • 1x Battery pack (2xAAA) for the "Remote" Micro:bit.

    • 1x Micro-USB cable for the "Receiver" Micro:bit.

  • Optional (For Experiments):

    • A strong magnet (to test the Compass/Magnetometer (see later in this post).

    • A flashlight (to test Light Level).

    • An ice pack or hair dryer (to test the Temperature sensor).



Method 1: The "Direct Link" (Local Logging)

The simplest way to log data is to keep your Micro:bit tethered to your computer. The Micro:bit senses the environment and "talks" back to the computer through the USB cable using Serial Communication.

The Setup:

  1. Code it: In MakeCode, go to Advanced > Serial. Use the serial write value "label" = [sensor] block.

  2. Flash it: Connect your Micro:bit via USB and download the code.

  3. View it: A purple "Show Data Device" button will appear under the simulator. Click it to see a live scrolling graph of your data!

  4. Save it: Use the "Export" button in the top right to download your data as a CSV file, which can be opened in Excel or Google Sheets for analysis.



Method 2: The "Messenger" (Remote Logging)


What if you want to measure something 20 feet away from your laptop? We can use two Micro:bits: a Sender and a Receiver.

1. The Sender (The Remote "Probe")

This Micro:bit is powered by a battery pack and placed wherever the "action" is.

  • The Logic: It reads a sensor and broadcasts it over the radio.

  • Key Blocks: radio set group [number] and radio send value "name" = [value].

2. The Receiver (The Data Bridge)

This Micro:bit stays plugged into your computer via USB. It acts as a translator, listening for radio signals and passing them to the PC.

  • The Logic: "When I hear a radio message, write that value to the Serial (USB) port."

  • Key Blocks: on radio received name valueserial write value [name] = [value].



Project Spotlight: Detecting and Logging Magnetism

One of the most exciting uses for this setup is exploring invisible forces. By using the built-in magnetometer (compass sensor), you can track the strength of magnetic fields as a magnet moves closer or further away.

For a specific step-by-step on setting up this experiment, check out our deep dive: Detecting and Logging Magnetism with the Micro:bit V1.


Teacher & Parent Pro-Tip: The "CSV" Advantage

The real magic happens when students export their data. Instead of just looking at a screen, they can:

  • Calculate the Average, Min, and Max in Excel.

  • Create charts for a science event or just for interest.


Conclusion

The Micro:bit V1 may be the "older" model, but for data logging, it remains a powerhouse. By teaching kids how to move data from a sensor to a radio, then to a cable, and finally into a spreadsheet, you are teaching them the fundamentals of the Internet of Things (IoT) and data capture.


For more detailed technical steps and code snippets, visit the original guides:

 



All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Comments

Popular posts from this blog

Robot Software

In the previous blog posts for this 'series' "It is a good time...."  Post 1  looked at the hardware unpinning some of this positive rise in robots; Post 2  looked at social robots; Post 3  looked at a collection of small robots; Post 4 looked at further examples of small robots Robots, such as the forthcoming Buddy and JIBO, will be based some established open sourceand other technologies. Jibo will be based around various technologies including Electron and JavaScript (for more details see:  http://blog.jibo.com/2015/07/29/jibo-making-development-readily-accessible-to-all-developers/ ). Buddy is expected to be developed around tools for Unity3d, Arduino and OpenCV, and support Python, C++, C#, Java and JavaScript (for more details see http://www.roboticstrends.com/article/customize_your_buddy_companion_robot_with_this_software_development_kit ).  This post contin ues with some of the software being used with the smaller robots.  A number ...

Speech Recognition in Scratch 3 - turning Hello into Bonjour!

The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , that is a brilliant use of Scratch 3 - Speech Recognition to control a sprite in an alien language. Do the activity, and it is very much worth doing, and it will make sense! I  would also recommend going to the  machinelearningforkids.co.uk   site anyway it is full of exciting things to do (for example loads of activities  https://machinelearningforkids.co.uk/#!/worksheets  ) . Scratch 3 has lots of extensions that are accessible through the Extension button in the Scratch 3 editor (see below) which add new fun new blocks to play with. The critical thing for this post is  Machine Learning for Kids  have created a Scratch 3 template with their own extensions for Scratch 3 within it  https://machinelearningforkids.co.uk/scratch3/ . One of which is a Speech to Text extension (see below). You must use this one ...

Scratch and web-cams in Scratch 3

Scratch 3 was launched on 2nd January 2019, so I wanted to know would Webcams still work with Scratch 3 as it did with Scratch 2. For example, in a previous post  Scratch, webcams, cats and explosions  the cat (Scratch) moved across the screen and a button burst when the object moved in the camera onto it.  Can the same thing be done in Scratch 3? The short answer is yes, but it is done slightly differently. The first change the video capture is not there in the blocks automatically; but is an extension that needs to be added. First, you need to add the extension blocks for video sensing. Go to the little icon at the bottom left of the screen (as shown below) this takes you to the extensions menu. Next, find the Video Sensing option and selected. The webcam, if enabled, with start automatically. A video sensing set of blocks is now in the list of block options.  The rest is very similar to doing this in Scratch 2. Moving ...