Micro:bit Data Logging | How to Log Data in Micro:bit?
- Pallabi Mohanty |
- May 30, 2024
Updated By
Reviewed By
Micro:bit Data Logging: The micro:bit V2 device can be used as a data logger. It means we can use micro:bit device to record data for various purposes with its built-in sensors. Data logging is like keeping a record of the data over the period of time. When data is stored in the micro:bit, it stays there even when it is disconnected from the power sources. It will be erased when the micro:bit is cleared or erased. There are many interesting data logging projects that can be created with micro:bit. In this article, we will discuss data logging with micro:bit in detail.
Looking to learn Robotics? Explore Wiingy’s Online Micro:bit Classes For Kids to learn from top micro:bit experts.
What is Data Logging in micro:bit?
Micro:bit data logging means recording data over a period of time for various purposes. It records environmental and physical data over a period of time, such as temperature, sunlight level for a week, etc. It can be a great project for school students as there are lots of applications for recording, visualizing, and analysing data in math, science, and geography. You can collect data on your micro:bit device and visualise it to get a better understanding of the world around you.
Working of BBC micro:bit Data Logging
In the BBC micro:bit, you can log in data manually by pressing a button, just like recording answers to questions in a survey. You can also log in data automatically at regular intervals of time with the help of the micro:bit built-in sensors, like recording temperature on a given day, which can be data logged in over a couple of hours or days.
Data can also be recorded over a short period of time, such as recording movement data to calculate how many steps you take in a day. Logging data can help you visualise and analyse data in order to understand the world around you a bit better.
The micro:bit V2 device has many environmental built-in sensors for light, temperature, magnetism, sound, and acceleration. There are several MakeCode data logging projects that you can try. In this section, we will discuss how to capture and analyze data logged into your micro:bit.
How to Log Data in Micro:bit?
Now that we know what data logging is and how it can be useful in everyday life, let’s understand how to log data in micro:bit. Read the below steps to get started in data logging with micro:bit.
Step 1: What You Want to Collect
Before starting out with any project, it is important to narrow down the objectives of the project. Similarly, with data logging in micro:bit, you need to start deciding what kind of data you want to collect. For example, you might collect data on how many steps you walk in a day. Once that is determined, other basic issues such as how to collect the data, how long the data will be collected for, and so on can be addressed.
Step 2: MakeCode Editor Extensions
To add the data logging feature in your MakeCode editor, you need to add the ‘datalogger’ extension from the extension tab in the MakeCode editor, as shown in the image below. Simply click on the extension block and search for “datalogger” in the search tab and you will see the data logging extension. Add it to your MakeCode editor.
Step 3: Manual Logging
Whenever you are working on data logging in micro:bit, it is good practise to label your columns so that you will know what the numbers represent. For example, we have named our columns “sound” and “movement,” so we are going to log sound and movement data. Add the “log data” block from the “datalogger” extension.
This block will log data when button A is pressed. You can add an icon so that every time data is logged, the icon will glow on the LED display, letting you know that the data logging is working. This is for manual logging. Now let’s understand automatic logging.
Step 4: Automatic Logging
To log data automatically at regular intervals, add the “every” block from the “loops” category. This will log accelerometer readings in 3 dimensions (x, y, and z) ten times every second. Start and stop the data logging by pressing button A. You can add an icon so that every time data is logged, the icon will glow on the LED display, letting you know that the data logging is working.
Step 5: Reading the Data
Once you are done with logging data on the micro:bit, plug the micro:bit device into your laptop or computer. Micro:bit will appear as a USB drive named “micro:bit”. Click on it and you will find a file named “MY_DATA.”. A table with your data will appear when you double click on the file and open it in the web browser. You can now preview the table in the web browser, copy the entire data onto your Excel or Google Sheets, or download the data as a CSV file which can be imported into a spreadsheet.
Looking to learn Robotics? Explore Wiingy’s Online Micro:bit Classes For Kids to learn from top micro:bit experts.
FAQs on Micro:bit Data Logging
How to log data on the micro:bit using Python?
You can log data on the micro:bit using Python. You need to use the Beta micro:bit Python Editor for this. Now, first, add the import log to the start of your program. Set your data log column headings using log.set_labels(). Then add records to your data log with log.add(). For retrieving your data, follow the steps mentioned above.
Can I download micro:bit?
Yes, you can download the micro:bit MakeCode offline application by Microsoft. You can download the application to your phone from your app store or you can directly download it from the micro:bit official site for your computer.
What is micro:bit data logging?
Micro:bit data logging means recording data over a period of time for various purposes. It can record various kinds of data, like the temperature of a place for a given day, or how noisy a particular place was for a given period of time, etc.
What is a micro:bit device?
The micro:bit device is a pocket-sized computer that introduces kids to how software and hardware work together. It is an interactive and programmable device that consists of various input-output features such as an LED light display, sensors, buttons, etc.
Do I need to log in to micro:bit?
There is no need to create an account or log in to micro:bit. You can just open the micro:bit in your browser, select what programming language you want to work with (MakeCode, Python, etc.), and start creating projects.
We hope the above article has guided you to creating your own data logging project with micro:bit. Start by creating your own data logging project and share your experience with us in the comment section below!