This activity aims to create a robot that follows a sound source. Use the sound file provided on a phone or portable speaker. When holding the sound source close (~50 cm) to the robot, the robot should turn towards the sound and approach the source. The robot will do this by comparing the sound intensity between a left and a right microphone. If the strength of the sound at the left receiver is larger than at the right, we will turn left and vice versa. This is a form of phonotaxis.

In principle, the robot should be able to approach a sound source placed somewhere in the environment. However, as discussed earlier, the microphones are not very sensitive, so the robot might not be able to approach sound sources further away.

<aside> ⚠️ This robotic activity works best if the sound source the robot is supposed to approach is the only sound source. This implies that it is difficult to do this activity with different groups in the same room.

</aside>

<aside> ⚠️ Because the robot's sensors are not very sensitive, the volume of the speaker or phone should be turned up quite high. However, care should be taken not to turn the sound up so much that it is uncomfortable or that you need to raise your voice to be understood by someone three feet away. Too loud noise can damage hearing. If in doubt, students could wear hearing protection.

</aside>

<aside> ⚠️ In the programs provided for this activity, we assume that the left microphone is plugged into port 3 and the right microphone is plugged into port 4.

</aside>

Step 1: measuring the directionality of the microphones

<aside> ℹ️

If time is limited step 1, in which the directionaly of the robot is measured without external ears, can be skipped. However, we still recommend discussing the lack of directionality of the bare microphones so that students understand why they have to add external ears to the robot.

</aside>

If we wish to find the sound by comparing the intensity of the sound at both receivers, the left microphone must be more sensitive than the right one for sound coming from the left. However, this is not necessarily so. Remember, we discussed the properties of the microphones and compared them with our ears? We said that the microphones are almost (but not entirely) omnidirectional. Therefore, they pick up sound almost equally well from all directions. In fact, they might be so omnidirectional that a sound at the left of the robot stimulates the left and the right microphone equally. In this case, the robot could not tell whether to turn left or right.

In the first step of this activity, the students will measure the directionality of the microphones. For this activity, we will provide the robot with two microphone sensors. Sensors can be mounted, as seen in the images below.

<aside> ⚠️ If you mount the sound sensors, as shown below, do not tighten the screws too much. This might damage the sensors.

</aside>

Untitled

Untitled

The sound sensor

The sound sensor

Next, have students build a setup like the one shown below. You can have students put a large sheet of paper or a whiteboard on the floor (as in the example below) and draw several compass directions. Below, angles from -40 to 40 degrees have been drawn in 20-degree steps. Place the sound source at angle 0, about 50 cm from the robot. The sound source can be a phone or a speaker. The speaker is not shown in the image below.

Untitled

Have the sound source play the following sound on repeat. The sound consists of bursts of white noise. The reason why this sound is pulsed is explained here. Click on the link below and then on the 3 dots in the sound player to download the file.

pip_exported.mp3

Students should align the robot with each marked direction. Run the program below. In the program, make sure the block "set left_scale" has a number 1 in it. You can change this number by clicking in the small oval with the number.

Untitled

When they click the green flag, the robot will perform 20 measurements of the sound intensity of the left and the right microphone. Finally, it will calculate the average of the 20 measurements. The robot will beep when it is done. Once the robot beeps, they should write down the number for left_sound and right_sound.

Next, turn the robot to align it with the next direction and click the green button again to measure the next angle. In this way, the students will obtain the loudness of the sound as picked up by the robot's two microphones (or ears) for different positions of the sound source with respect to the robot.