Skip to content

活动

Sound insulation meter

中级 | MakeCode, Python | 无线电, 麦克风 | 变量, 测量, 科学地工作, 选择, 通信

第 1 步:制作

它是什么?

使用两个BBC micro:bit来测量声音强度,这个装置是用来测量不同隔音材料的特性。

介绍

编程指南

在这个项目中,您将使用计算机技术将micro:bit转换成工具来帮助您进行科学实验。

它使用两个micro:bit 和一个音源来测试不同材料的隔音特性。 所以即使传感器被遮盖的时候您依然能够读取到噪声值,它通过无线电把测量噪声值传输给附近的另外一块micto:bit.

您可以将不同的代码下载到发射和接收的micro:bits模块, 或者您可以自行编程并且了解它在上面的编程视频中是如何工作的。

发射器 / 传感器

必须使用 micro:bit V2作为发射模块,并且作为传感器包裹在不同的隔音材料中。 它使用麦克风来测量声音水平,然后通过无线电发送测量值。

Diagram showing the location of the microphone inlet to the right of the touch logo on the micro:bit V2

The microphone senses sound from a small hole on the front of the micro:bit. Make sure that materials you want to test are not touching or moving against this, as this may affect your sound level readings. You may find it helpful to place the sensor micro:bit inside a cardboard box lined with different materials, for example.

Sound source

Place a sound source a fixed distance from the sensor. This can be anything, such as a musical instrument that makes a sound at consistent volume, or a mobile phone ring tone. We’ve also supplied an audio file below that you can play from a phone or computer.

Having the sound source make sounds of the same volume and the same distance from the sensor ensures it’s a fair test.

接收器

The receiver micro:bit is where you view the sound level readings. You can place it anywhere within a few metres of the transmitter.

Starting the experiment

  • Wrap the transmitter / sensor in the material you want to test.
  • Press the reset button on the back of the receiver micro:bit when you start each test to set the sound level back to 0. Keep very quiet!
  • Make the sound using your sound source.
  • Press button A on the receiver to view the sound level on the LED display. This is shown in a scale from 0 (the quietest) to 255 (the loudest). It shows the maximum sound level measured since you pressed the reset button.
  • Make a note of the number using our data recording sheet or on another piece of paper.
  • Repeat the experiment, wrapping the transmitter / sensor in different materials.
  • You can then analyse your data to draw conclusions about which materials make the best sound insulators.

所需材料

  • 2个micro:bit主板. (The transmitter must be a micro:bit V2, but the receiver can be a micro:bit V1 or V2.)
  • At least one battery pack (recommended for the transmitter)
  • A constant sound source
  • Different materials to test, for example foam, bubble wrap, cardboard, and paper. A small cardboard box may also be useful
  • Sticky tape or rubber bands to keep the materials in place
  • A ruler or tape measure to measure a fixed distance between the sound source and transmitter
  • Data recording sheet or paper and pencil

Supporting resources

The data recording sheet can be used to record your measurements, and the sound file can be played from a phone or computer for use as your sound source.

Data recording sheet

第 2 步:编程

发射器 / 传感器

1from microbit import *
2import radio
3
4
5radio.config(group=1)
6radio.on()
7
8while True:
9    # turn the sound level into a string so we can send it over radio
10    radio.send(str(microphone.sound_level()))
11    sleep(200)
12    

接收器

1from microbit import *
2import radio
3
4
5radio.config(group=1)
6radio.on()
7max = 0
8
9while True:
10    if button_a.was_pressed():
11        display.scroll(max)
12    sound_level = radio.receive()
13    if sound_level:
14        if int(sound_level) > max:
15            max = int(sound_level)
16            

Multiple experiments in the same room

If you need to carry out multiple experiments in the same room, each pair of micro:bits will need their own unique radio group number. Modify the code to change radio group number. You can use any radio group number between 0 and 255, making sure that the numbers on each pair of micro:bits match.