Posts: 1
Joined: Tue Feb 28, 2017 12:14 pm

Traffic Lights with Sound Sensor for noisy class

Tue Feb 28, 2017 12:19 pm


I'm looking to build a Pi with a sound sensor that is linked to a traffic light system. This will hopefully pick up the noise of the class and with the correct sound thresholds, alert the kids that they need to keep the noise down if it triggers amber or red.

Do able?


Posts: 22
Joined: Fri Mar 25, 2016 1:53 am

Re: Traffic Lights with Sound Sensor for noisy class

Wed Mar 01, 2017 2:47 pm

Yes it is doable but you will need more than just the Pi. Also it would seem to me that unless you are in the class that it would just be a challenge for the kids to make the light RED.

Look at this website ... detection/ or just google/bing/duck duck go "pi sound threshold detector"

Posts: 23
Joined: Sun May 10, 2015 5:27 am
Location: Shanghai

Re: Traffic Lights with Sound Sensor for noisy class

Wed Jun 07, 2017 1:56 am

I do a very similar project in Scratch with my KS2 pupils, using a Picoboard. ... t=6#detail

You can use a PC if it has a built in Microphone, most of the flat panel PCs do.

The scratch 1.4 Extra Blocks allow Sensing to read the inputs from the Picoboard or a microphone.

Everything base on ... -activity/

you may have to register to find the resource.
My other computer is a VIC20.

User avatar
Posts: 335
Joined: Thu May 26, 2016 10:36 pm

Re: Traffic Lights with Sound Sensor for noisy class

Wed Jun 07, 2017 1:25 pm

Yep - doable.

The trick would be to calibrate the sound level. For that you may need a sound level meter of some sort which isn't on the Pi.

The idea would be to do the following :
1] Use a sound card with a microphone either USB or GPIO.
2] Either write some software to implement a sound level meter or search for "ALSA sound level meter" and use some pre-existing software.
3] Calibrate the system using the sound level meter. You would have to see what the sound level meter software produces in dB SPL for a particular sound and find the difference between the sound level meter and the Pi's software sound level meter.
4] Work out how to get the output from the software sound level meter add the difference you found in step '3]' to get the actual dB SPL and activate one of three GPIO pins which drive some LEDs of some sort ... red, yellow and green. You will need to work out what thresholds you need to switch between colours ... 60 dB SPL is strong speech, 120 dB SPL is a jet airplane up close, here are more descriptions.
5] Work out how to set the GPIOs high and low in order to implement step '4]'.

Sounds like an involved but doable project !
The Ultra 2 sound card - Preview now on kickstarter :
Sound card for the Raspberry Pi with inbuilt microphone :
Audio Inector Octo multitrack GPIO sound card :

Return to “Staffroom, classroom and projects”