Noise sensor

The Calliope mini contains a tiny little microphone. It allows you to listen to the noise level of the environment and let the computer react to it. The LED of the Calliope mini switches to red above a certain noise level. Below this level the LED ist green.

1instructions

After starting the program, the computer should listen to the environmental noise as long as it is running, that means, we use the block ‘repeat infinitely’.

Then the computer has to make a decision. If it is quiet, the LED lights green, otherwise it turns red.

Now a decision has to be included. To do this, take the first block from the Logic section and choose > from drop-down menu. Two values can be compared.

The microphone query is selected from the *Sensors: get sound % microphone.

From the category Mathematics you get the first block, the number. The block is installed and the number is set to 20 (or a number of you choice between 0 and 100).

Transfer your program to Calliope mini and test it! If it is quiet, the LED lights green, it should turn red when it is noisy.

2optimization

Unfortunately, the red LED is only visible for a very short time in case of a short volume increase. Therefore, insert a pause of 1 s after the command to switch on the red LED.

From the category Control you get the block Wait ms… and put it under the command switch LED on coulour…. The number 500 indicates that for 500 ms (= 0.5 s) the red light will stay on. Change the value to 1000 to prolong it a bit, the light will turn red for one second.

This text is published under a CC BY-SA 3.0 DE license. It was originally published in German by Karsten Beuche and translated into English by the Calliope team.