Sound Map of Cities | IoT Cloud Kit for microbit-MakeCode-Tutorial

Meimei Aug 03.2023

Lesson 5: Sound Map of Cities 


1. Understand what communication is

2. Understand the wireless communication technology of micro:bit

3. Understand what networking technology is

4. Use networking and wireless communication technology to collect the sound intensity in every corner of the city

5. Understand advanced sensing technology

Learning Process


Teachers: A computer, good internet, IoT internet kits.

Students: A computer, good internet, IoT internet kits.

Learning Content

Lead-in: Compared with rural areas, cities appeared later. As a new type of living style, cities often come with more convenient transportation, richer social activities, more prosperous industries, and so on. While, at the same time, urbanization tends to produce more noise pollution. And researchers have found that people who are exposed over long periods of time to a certain noise level are at a much greater risk of damaging hearing and affecting the nervous system. In response to this kind of "chronic poison", various countries have also formulated different environmental noise pollution prevention and control laws.

What is communication?

What is communication? Communication refers to the exchange and transmission of information, and it also includes wired communication and wireless communication.

Wired communication: refers to communication in the form of wires, cables, optical cables, waveguides, nanomaterials, etc. as the transmission medium. The characteristic is that the medium can be seen and touched.

Wireless communication: refers to a communication method that does not use wires, cables, optical fibers and other wired media, but uses space to transmit signals.

micro:bit Communication 

As we all know, the micro:bit board comes with Bluetooth 4.0 and 2.4GHz RF antennas, so the micro:bit can perform Bluetooth and 2.4G wireless communication. Today we will take a look at the difference between 2.4G and Bluetooth in the micro:bit wireless communication mode.

Both Bluetooth and 2.4G belong to wireless communication. Bluetooth is essentially a 2.4GHz wireless technology, and they both use the 2.4G frequency band. However, the Bluetooth standard is in 2.402-2.480G frequency band.

2.4G wireless technology is a short-distance wireless transmission technology, which has the advantages of two-way transmission, strong anti-interference, long transmission distance (referring to short-distance wireless connection technology), and low power consumption; Bluetooth technology, on the other hand, based on the wireless transmission protocol of 2.4G technology, is called Bluetooth technology because it uses different protocols and Bluetooth technology is not free, so it is different from other 2.4G technologies.

2.4G wireless connection technology is more powerful and stable in connection performance (millisecond response technology, plug-and-play, low power consumption, etc.). 2.4G wireless products must be equipped with NANO receivers to achieve one-to-one working mode. The Bluetooth wireless connection technology does not require a receiver, instead, it needs devices with Bluetooth function to realize connection, and it can achieve one-to-multiple working mode at the same time, but it must be connected when the pairing codes are matched. Limited by the Bluetooth protocol, it cannot compete with 2.4G in terms of point performance.

How to use micro:bit’s wireless communication

2.4G wireless communication

First introducing micro:bit’s 2,4G wireless communication, and before using it, we need to know some commonly  used blocks:

micro:bit’s 2.4G wireless communication technology will be demonstrated throughout the later project practice part.


Bluetooth is generally used to send data to mobile phone APPs, or to receive remote control data sent by mobile phones. micro:bit cannot use Bluetooth and 2.4G wireless communication at the same time. By default, only 2.4G wireless communication is used and Bluetooth communication is disabled. If you want to use Bluetooth communication, you need to add the Bluetooth communication software package, and the 2.4G wireless communication software will be automatically disabled. The method of adding the Bluetooth software package is as follows:

If interested in Bluetooth function, you may do some research about it after this lesson.

Next, we will use 2.4G wireless communication technology combined with sound sensors to collect the sound intensity in every corner of the city. Then analyze whether there is noise pollution in the place you live around.

Project practice: Using a mic to collect sound intensity

Through the previous study, we know that micro:bit has the function of wireless communication, then we are able to carry out wireless data transmission through wireless communication. In this lesson, we will learn how to use 2.4G wireless communication technology to collect the sound intensity in different places, and then use the Internet of Things platform to help us analyze whether the surrounding living environment contains noise pollution.

Task 1: One-to-one wireless communication

In communication, there are usually two roles, the transmitting end and the receiving end. In the process of programming, the transmitter and receiver programs are different, so we must distinguish the transmitter and receiver equipment.

Hardware Preparation

Prepare hardware shown in the following diagram.

Hardware Connection

Insert a micro:bit V2 into a micro:IoT Board for Cloud.

Program Design

Function analysis

What we need to achieve in this task is one-to-one wireless transmission, that is, two devices are needed: one as the transmitting end and the other as the receiving end. We use the micro:bit V2 board as the transmitting end; micro:bit V2 + micro:IoT Board for Cloud as the receiving end.

Next, we start programming. The function of the transmitter is to collect the sound intensity in the market, and then send the collected data to the receiver. After the receiving end receives the data from the transmitting end, it will be displayed on the OLED screen.

Program flowchart
Example program

Transmitting end

Program website:   

Receiving end:

Program website:  

Operating Effect

Download the program at the transmitting end to a separate micro:bit V2 board, and download the program at the receiving end to the V2 board on the micro:IoT Board for Cloud. Then the transmitting end collects the sound intensity, and transmits the data to the receiving end through wireless communication, and the receiving end displays it on the OLED screen.


In this case, we have learned one-to-one wireless transmission. Through learning, we know that if two micro:bits want to achieve wireless communication, two micro:bits need to be kept in one wireless communication channel. For example, devices A and B are in channel 1. Devices C and D are in channel 2. Then A can only communicate with B. So when we design a project, we must remember how the devices communicate. In this way, the data can be effectively transmitted.

Problem: Trying multi-to-one wireless communication. For example, sending the sound intensity of market and road to the main device.

Task 2:Multi-to-one wireless communication

In the previous section, we learned about one-to-one wireless transmission, that is, the communication between two devices. At the same time, the question is also raised, how to realize many-to-one wireless transmission?

We should all know that inter-city noise should not only appear in shopping markets, but may also appear in intersections, construction sites, schools, factories, and so on. What if we want to detect noise in these places at the same time? If the project is formulated in the way of task 1, it must be a waste of resources on the receiving end. If we use a device to receive the sound intensity of all areas, it will be very convenient. Next, we will learn how to implement multi-to-one wireless transmission.

How to achieve multi-to-one wireless communication?

In a city, there are bound to be countless shopping markets and intersections. These places will have their own equipment. In order to clarify the operation of equipment, we have proposed a solution, which is many-to-one wireless transmission. In fact, this is also star structure networking technology.

Hardware Preparation

Requires hardware devices as shown in the following diagram.

Hardware Connection

Insert micro:bit V2 into a micro:IoT Board for Cloud.

Program Design

Function analysis

What we need to achieve in this task is multi-to-one wireless transmission, so at least 3 devices are required. We use two micro:bit V2 boards as the transmitter; micro:bit V2+micro:IoT Board for Cloud as the receiving end.



Next, we start programming. Device A collects the sound intensity in the market, and device B collects the sound intensity of the intersection, and then transmits the collected data to the receiving end. After the receiving end receives the data, it is displayed on the OLED screen.

Program flowchart


Sample program

Transmitting end

Program website(market):  

Program website(road):  

Receiving end

Program website: 

Operating Effect

Download the programs of the transmitting end to a separate micro:bitV2 board, and download the programs of the receiving end to the V2 board of the micro:IoT Board for Cloud. When device A-"market" and device B-"road" detect the sound intensity, they will transmit the data to the receiving end through wireless communication, and then display it on the OLED screen. 

Problem: Try adding two more sending devices to realize the 4-to-1 wireless transmission function.


In this case, we have learned multi-to-one wireless transmission. Through learning, we know that it is a star structure networking method in networking technology. One master device (receiving end) can collect data from multiple slave devices (transmitting end). The pros of this method are: simple structure and easy to control, the cons: when the main device is broken, all data is lost, resulting in low utilization of communication lines. Based on what we have learned in the previous lessons, do we have a way to solve this problem?

Task 3: Use ThingSpeak to collect sound intensity values

In the previous section, we learned multi-to-one wireless transmission, that is, the communication between multiple devices and one device. At the same time, it also raised the question of how to solve the problem of data loss after the main device is broken. Through the study of the previous few lessons, students should know that device data can be saved on the IoT platform. So next we use ThingSpeak to save the data received by the main device.

Create channel

First, we set up a "Sound Map" channel in ThingSpeak. Proceed as follows:

1. Click "Channels" first, then click "My Channel", and finally click "New Channel"

2. Set the channel name as: Sound Map; channel description as: Sound Map; because you need to collect the sound intensity of two locations, you need to create two "Fields" to store the data, they are: Field1—market, Field2—road

3. Finally, pull the web page down to the bottom and click "Save Channel" to save the channel.

View keys

Go to my channel "Sound Map" and click API Keys to view the key.

Hardware Preparation

You need to prepare the hardware devices as shown in the figure below.

Hardware Connection

Insert the WIFI IoT SD card into the micro:IoT Board for Cloud motherboard. Then insert a micro:bit V2 onto it.

Program Design

Functional analysis

The function we need to achieve in this task is to send data from the devices "market" and "road" to the master device, and then the master device uploads the received data to the ThingSpeak platform via WiFi.

Program flowchart

After studying the previous few lessons, students should be able to draw flowcharts by themselves, right? Please complete the program flowchart of Task 3 according to the script in the sample program.

Sample program

Transmitting end:  

Receiving end:

Program link: 

Operating Effect

After successful networking, the slave device sends the detected sound intensity to the master device. Then after the analysis by the main device, the data of the corresponding device will be uploaded to the corresponding field in ThingSpeak (market corresponds to field1, road corresponds to field2).

ThingSpeak interface:

Note: In ThingSpeak, in order to conveniently check when the sound intensity is the highest, the data is displayed in the form of a histogram.

ThingSpeak will experience packet loss. In order to make the obtained data trustable, we need to keep the equipment running longer.


In this case, we use the multi-to-one wireless transmission method to send the sound intensity collected from the device to the main device, and then the main device uploads the data to the ThingSpeak platform via WIFI. Through actual operation, it is found that when two slave devices send messages to the master device at the same time, it is hard the receiving end to receive and data packet loss may occur. Therefore, we need to keep the device running longer so that the data obtained is more valuable.

According to the previous lessons, we can actually add a mobile phone automatic reminder service, so that we can always pay attention to the noise around our lives, and also remind us to check the data on ThingSpeak. Now can you make a "push sound intensity" project based on IFTTT's notification service? It could include functions such as: when the device's sound intensity value is >100, it will send a "Decibels above Reference Noise" message through IFTTT's notification service.



Through the previous study, we use the sound sensor to collect the sound intensity in every corner of the city. Then the data of each device is transmitted to the main device through wireless communication, and finally we use the data obtained by the main device to analyze whether there is noise pollution in the place where we live. In the link of data collection, the process of collecting information by sensors is called "sensing"; in wireless transmission, we call multi-to-one transmission as a star structure networking technology. Next, let's get a thorough comprehension of advanced sensing technology and networking technology.

Advanced Sensing Technology

What is sensing?

Sensing refers to collecting the state of the device itself and the state of the surrounding environment, and then notifying the system. The status mentioned here includes the opening and closing status of the door, the temperature and humidity of the room, whether there are people in the room, and so on. The device uses electronic components such as sensors to realize sensing.

What is sensing technology?

As mentioned earlier, the way to achieve sensing is to use sensors to collect the state of itself and its surroundings. What is the advanced sensing technology? It is to combine multiple sensors and processors to obtain more information. At this time, the device may no longer be an electronic part, but an object with powerful information acquisition capabilities. For example, in a smart refrigerator, the sensor in the refrigerator transmits the acquired external temperature to the microcontroller, and then the controller sets the temperature of the refrigerator by judging conditions, so that the set temperature of the refrigerator can be changed according to the environment, thereby achieving the effect of power saving.

Thinking: What other devices in life utilized sensing technology?


What is the networking technology of equipment

What is networking technology. Simply put, networking is a way to allow each device to communicate with each other. For example, a mobile phone of yours is connected to your home router, at this time, data transmission occurs between the mobile phone and the router. This is the networking, that is, the way the devices are connected. In Figure 1 on the right, it is the current state of our home. Most devices can connect to the main device (router) to access the Internet, and then the main device can interact with the outside world.                                                         


                                                                         Figure 1

This is similar to our multi-to-one transmission. Figure 2 shows the star structure networking. The star structure has the advantages of simple structure and easy-to-control. The disadvantage is that it belongs to centralized control, the main equipment is overloaded, and the reliability is low. If there is a problem with the main equipment, all data will be lost; and the utilization rate of the communication line is low. On the right is the topological structure diagram showing the star structure.

                                                                           Figure 2


In fact, there can be other networking methods. For example, if the projector, printer, etc. cannot be directly connected to the main device (router), the projector can be connected to the mobile phone first, and then the information can be transmitted to the main device through the mobile phone. As shown in Figure 3



                                                                             Figure 3


Figure 4 is a tree structure networking mode. The tree structure is a hierarchical centralized control network. Compared with the star type, its advantages are that the total length of the communication line is short and the cost is lower; more devices can be added to the network in a hierarchical manner. The disadvantage is that in addition to the leaf node and its connected line, any node or its connected line failure will affect the system.

There are many other networking methods, you need to choose according to different actual situations, each has its own pros and cons. It can also be used in combination with various structures to highlight advantages and avoid risks.      


                                                                                 Figure 4


In this lesson, we learned one-to-one wireless transmission and multi-to-one wireless transmission, which learned that only the main device needs to be connected to the network, and then it can save data on the IoT platform. In this project we use two IoT platforms, IFTTT and ThingSpeak, to help us analyze the noise around our lives. For the next project, we are going to use IFTTT and Easy IoT platform to help us prevent fires.



All Rights
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.publish_time]]