micro:bit Sound Logger

This activity introduces students to data logging by creating a loop that constantly compares the current sound level with a variable ‘maxSound’ storing the loudest sound. If the current sound is louder than the loudest previous sound, it resets maxSound to the new loudest sound value. This program turns the BBC micro:bit to act as a real-time sound monitoring device that uses its built-in microphone to measure sound levels (0–255) and continuously compare the current level to a stored maximum value, allowing it to track how loud an environment becomes over time.

Grade Levels: 3 - 12
Subject Matter: Algorithms, Data Science, Physical Computing, Programming, Cross-Curricular Integration: Math, Cross-Curricular Integration: Science
Concepts: Programs and Algorithms, Computing Devices and Systems, Data and Information
Standards: 6-8.PA.2, 3-5.CD.2, 6-8.CD.3, K-2.PA.1, K-2.PA.2, K-2.PA.3, K-2.PA.4, 3-5.PA.2, 3-5.PA.3, 6-8.PA.1, 6-8.CD.2, 6-8.PA.3, 3-5.DI.1, 3-5.DI.2, 3-5.DI.3, 3-5.DI.4, 6-8.DI.1, 6-8.DI.2, K-2.CD.2, K-2.DI.4, K-2.DI.3, 3-5.CD.1
  • Average Rating: 0.0 (0 ratings)

Activity Instructions

  1. Introduce the activity
    • Discuss: Have you ever wondered how loud your classroom gets during the day?
      1. When is it the loudest?
      2. When is it the quietest? 
    • Conclude by telling students – Today, you’re going to build a device that remembers the loudest sound it hears.
  2. Introduce the Concept 
    • Instead of just measuring sound once, we’re going to track it over time.
    • Explain:
    • “This is called data logging—recording data as it changes.”
    • Data logging means collecting data over time for analysis 
  3. Build the Code 
    • Let’s create a program that keeps track of sound.
    • Walk students through creating the following code or use the provided link to share the completed code with students. 
  4. Test the Logger 
    • Let’s see how loud things get!
    • Students:
      1. Make different sounds (clap, talk, tap desk)
      2. Walk to different locations
      3. Press button A to check max value 
    • Reflect on the data test -What kinds of sounds gave the highest readings?
  5. Explore & Investigate 
    • Now use your sound logger like a real tool.
    • Try:
      1. Quiet vs noisy areas
      2. Group work vs silent reading
      3. Sudden loud sounds vs background noise
  6. Analyze & Discuss
    • What patterns do you notice over time?
    • When was it loudest?
    • Why did that happen?
    • Did your data match expectations?

Tips for Running Activity

  • This is a strong introduction to data logging + variables as memory
  • Students often struggle with:
    • Understanding variables updating over time
    • Difference between current value vs stored value
  • Emphasize:
    • The micro:bit is constantly “listening”
    • The variable is like a memory of the loudest moment

Extension Opportunities

Students can:

  • Track minimum (quietest) sound levels
  • Add a visual bar graph display
  • Log data over a longer time period
  • Compare results between groups
  • Use radio to send data to another micro:bit
  • The project can be extended to track minimum values or send data remotely

Elements of this resource were created by BBC micro:bit, then curated by the team at Nextech.

Learn More