This post will be a bit different from my typical posts. I'm basically just writing documentation on a project that's just been completed.
What is a volume unit (VU) meter?
A VU meter is a device that visually displays the strength of an audio signal. In this case, the LEDs light up and change colors based on how loud sounds in the environment are.
How does it get used?
The light emitting diode (LED) strip should be attached with an adhesive on to a vertical surface. The microcontroller enclosure or “brain box” should be affixed similarly at the bottom of the LED strip. When the USB cable is plugged in, the device should start to operate. On the bottom left part of the enclosure there is a momentary push button that can pause the operation of the device and turn off the LED strip.
The lid can be removed so that the components and wiring are visible in case the user would like to see how it’s wired and better understand how it works.
The device requires standard 5 Volt USB power from a USB power supply. It draws a maximum of 1 amp so even low-end USB power supplies should be plenty to operate the device.
What are the troubleshooting steps?
If the LEDs do not light up when the device is plugged into a USB port, leave the device unplugged for 5 seconds and plug it in again and/or try a different USB power supply.
How does it work?
Let’s start with the hardware.
The microcontroller board contains an 8-bit ATMega328 running at 16Mhz, or 16 million cycles per second. It is connected to a component board that contains a microphone with a built-in amplifier and automatic gain control operated by a MAX9814 integrated circuit (IC). The microcontroller also drives a WS2812B LED (commonly called “Neopixels”) strip. Lastly, there is a momentary push button connected to the microcontroller to allow for user input.
On to the software.
The microcontroller allows a single program to be stored and it will run that program whenever it has power. By its nature, the microcontroller runs this single program in an infinite loop.
The program is written in C using the Arduino development environment. Upon booting, the software initializes the microphone and LED strip.
The heart of the program is an algorithm called a fast Fourier transform (FFT). A FFT quickly computes the discrete Fourier transform (DFT) of a signal. In essence, the algorithm converts the analog audio data from the microphone into the signal’s individual spectral components which produces the signal’s frequency information. It then computes those frequencies to find the delta between the baseline and the peaks of the input signal. The practical upshot of this is that you end up with a number that represents the loudest sound picked up by the microphone at a given moment.. This input and processing cycle happens approximately 15 times per second.
The program then takes the data from the FFT and uses it to compute the signal data that will be sent to the LED strip. It does this by using the numeric result of the FFT to determine how many LEDs need to be lit up and then looks up data in a rainbow color wheel table to determine the order of colors that should be displayed leading up to the last/top LED. With this information, it sends a digital signal to the LED strip telling it to light up from 0 to the Nth LED, and to fill the intervening LEDs the colors prescribed in the color wheel table. As a bit of flair, the microcontroller will also display a “falling peak” that will appear to drop down from the maximum level of the current cycle to the maximum position of the next cycle, lighting one LED at a time.
The “pause” functionality is pretty straightforward. If the microcontroller detects a push and release of the button within 200ms, the FFT processing will be suspended and the LED strip will set each element to be off until another button press is registered or the device is otherwise restarted.
It may be important to note that while this device measures volume from the environment, no audio data is stored and the device has no ability to connect to any data network such as WiFi.
Where did the case come from?
The case was designed in computer-aided design (CAD) software called Fusion360. The design of the lid of the case went through about 4 iterations while the base part that holds the electronics went through about 14. The design attempted to balance aesthetics with functionality. The case’s outside edges are all filleted, including the edges of the circular extrusions for the button and wiring. The lid provides vents for airflow and full access for the microphone to pick up sounds from the environment. The base provides stand-offs for the components and space for the wiring. The components are attached inside the case with thermoplastic adhesive and the lid attaches to the base via a self-centering friction-fit mechanism.
All of the enclosure iterations were printed on a fused deposition modeling (FDM) 3d printer using polyethylene terephthalate (PET) filament. PET is what most American beverage containers (such as 2 liter soda bottles) are made from and is 100% recyclable.
Why make this?
The primary goal of this project was to build a tool that could be helpful in classroom management. It’s also important to show young people that STEM areas can be neat and exciting. This tool provides a way to start a conversation about electronics and technology, mathematics, programming, CAD, and other engineering-related skills.
Who built this?
My name is Don Howdeshell. I’m a software engineer/systems administrator at Missouri S&T and I’m always looking for challenging projects that also have a practical use.
This project was started from a conversation with a 6th grade teacher looking for a way to allow students to self-monitor the volume level of their voices while working on projects within the classroom.
The prototype device has operated for the better part of a year and has been helpful both as a volume monitoring device and as a conversation starter with students who have a curious mind, are interested in STEM fields, and/or just think it’s interesting.