empowering creative people

Sound Reactive Lights using MakeCode: Adafruit Circuit Playground Express

The Adafruit Circuit Playground Express comes equipped with an onboard microphone that is capable of sensing both amplitude and frequency. This tutorial will walk through a quick sketch using MakeCode to turn the lights on the board into a mic activated VU-meter-like display! The microphone is located on the lower right side of the board, marked with an ear.


Programming sound reactive lights in MakeCode only takes a few steps. Programming a similar sketch in other languages would be quite complex even for some basic operation, so this is the sort of project where MakeCode really shines.

MakeCode Screen Adafruit Circuit Playground Express

For this example, I have used the Adafruit MakeCode app so we can see live data from the microphone on the Circuit Playground Express. All it takes to get the lights to act as a sound reactive VU meter is drag the graph command into the forever loop, and then change the first variable to a sound level input. The second number in the graph is the high limit of detection. The microphone returns an analog value between 0 and 255. You should set the second number to no higher than 255 because the mic cannot detect anything louder. In the example, the upper limit is 100, because I found that most of the sounds I made didn’t exceed 100 so setting it lower makes for more motion on the NeoPixels.
I have also added a slide switch actions. When the slide switch is left the brightness is set to low, and when the slide switch is right the brightness is fully bright.

Show Console Device

MakeCode Console Screen Adafruit

The Show Console Device option within the Adafruit MakeCode App (available free on the Windows App Store) allows us to view real-time data coming from a connected Circuit Playground Express. This screenshot shows the levels detected on the microphone while I was speaking. This allows you to set the upper limit of the graph function to a reasonable level to get the most dynamic looking lights. We don’t want to have to shout to get all the lights on!
MakeCode makes programs like this easy, but don’t be fooled by its simple appearance, its still a very capable editor! For more tutorials on the Adafruit Circuit Playground Express, check out our Circuit Playground Tutorial page. If you are interested in learning how to program sound reactive lights in CircuitPython, we have a tutorial for that too!

The Adafruit Circuit Playground Express comes equipped with an onboard microphone that is capable of sensing both amplitude a...