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:
Code it: In
, go to Advanced > Serial. Use theMakeCode serial write value "label" = [sensor]block.Flash it: Connect your Micro:bit via USB and download the code.
View it: A purple "Show Data Device" button will appear under the simulator. Click it to see a live scrolling graph of your data!
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]andradio 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 value→serial 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:
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:
No comments:
Post a Comment