Maker.io main logo

Audio-Reactive Artifact with Arduino–Part 1: The Initial Hardware Setup

2021-03-16 | By Clive Maxfield

License: See Original Project

Editor’s Note: This two-part series shows how to turn an interesting valise and an even more interesting set of defunct vacuum tubes and tricolor LEDs into an utterly mesmerizing audio-frequency-synched visual array. Here, Part 1 focuses on the initial hardware setup. Part 2 will discuss how to enhance our audio-reactive capabilities using an envelope generator and an electret microphone.

I’ve said it before, and I’ll say it again, “Show me a flashing LED, and I’ll show you a man drooling”. One of the things I like doing is creating hobby projects that respond to sound. For example, although I don’t like to boast (I pride myself on my humility), I’m particularly pleased with my Audio-Reactive Artifact (Figure 1).

Audio-Reactive Artifact with Arduino Part 1 Setup_1

Figure 1: The finished Audio-Reactive Artifact boasts a cornucopia of defunct vacuum tubes illuminated from beneath by tricolor NeoPixels. (Image source: Max Maxfield)

“Wow! That’s amazing! How did this project come to be?” I hear you cry. Well, I’m glad you asked because I will be happy to expound, explicate, and elucidate. This all started several years ago when I was presenting at the Embedded Systems Conference (ESC). The topic of my talk was how radiation affects electronic components and systems. As part of this, I purchased a cheap-and-cheerful decorative antique-looking case. When it arrived, and I looked inside, I discovered that the main case came with a smaller counterpart (Figure 2).

case_2

Figure 2: A cheap-and-cheerful decorative antique-looking case waiting to discover its mission in life. (Image source: Max Maxfield)

This smaller valise sat in my office looking plaintively at me for quite some time until, one day, while visiting a local electronics surplus store, I observed a plastic bag full of defunct vacuum tubes that were destined for the dustbin. I wasn’t sure what I would do with them, but it seemed a shame for them to be discarded. So, I offered to give them a new home and take care of them. Later, when I returned to my office, the small valise caught my eye and I started to think, “Hmmm…”.

As is often the case, trying to make something that doesn’t appear to have an actual function can be somewhat tricky. The first thing I did was select a subset of the tubes, after which I spent an inordinate amount of time arranging them in different configurations until I finally settled on a version I found to be aesthetically pleasing (Figure 3).

tubes_3

Figure 3: The final tube arrangement involves three groups to represent base frequencies (left), middle frequencies (center), and treble frequencies (right). (Image source: Max Maxfield)

I arranged the tubes in three groups, which were ostensibly intended to be associated with the base, middle, and treble frequencies from an audio source (in reality, using software, the audio stream can be subdivided into multiple frequency bands, which can be displayed on different groups of tubes). I also arranged the tubes in size from largest (rear left-hand corner) to smallest (front right-hand corner).

The next step was to take a piece of thin plywood, drill holes corresponding to the tube diameters, and spray paint it matt black. I also chopped the pins off the bottoms of the tubes, and then attached them to the board with thin smears of epoxy (Figure 4).

board_4

Figure 4: Using epoxy to attach the de-pinned tubes to a supporting board with holes drilled in it. (Image source: Max Maxfield)

The next task was to wire up the NeoPixels to be mounted under the tubes. In my original implementation, I used NeoPixels with red, green, and blue (RGB) sub-LEDs (Figure 5). However, if I were to create a new version of this project, I would use the more recent devices with red, green, blue, and white (RGBW) sub-LEDs. In this new implementation, the largest tube would be illuminated using a 2854 ring with 16 pixels as shown in the upper right-hand corner of Figure 5, while the next largest tube would be lit using a 2852 ring with 12 pixels.

wire_5

Figure 5: Illuminating the various tubes with NeoPixels requires one 16-pixel ring, one 12-pixel ring, thirteen 7-pixel ‘jewels,’ and 26 individual pixels cut from a strip. (Image source: Max Maxfield)

Also required are thirteen 2859 “jewels,” each with 7 pixels, for the medium-sized tubes. In the case of the ten smaller tubes, I used pairs of individual pixels cut from a 2842 strip containing 60 pixels per meter. Similarly, the six smallest tubes each require a single pixel cut from the same strip.

For this particular project, I decided to employ the always popular Arduino A000066 Uno R3 development platform for the ATMEGA328P microcontroller from Microchip Technology. I augmented this with a microelectromechanical systems (MEMS) microphone breakout board (BOB), the BOB-09868, and an 8-pin, 7-channel COM-10468 audio tone processor chip (better known as the MSGEQ7), both from SparkFun Electronics.

schemeit_6

Figure 6: The Audio-Reactive Artifact is powered by an Arduino Uno R3 in conjunction with a BOB-09868 MEMS microphone and a COM-10468 audio tone processor. (Image source: Max Maxfield)

The audio tone processor constantly monitors the audio input stream and splits it into seven frequency “buckets” centered on 63 Hertz (Hz), 160 Hz, 400 Hz, 1 kilohertz (kHz), 2.5 kHz, 6.25 kHz, and 16 kHz. At any time, the Arduino can latch the current relative frequency amplitudes by pulsing the RESET signal, and then read them out as analog values by pulsing the STROBE signal.

The final step for this initial build was to write the software to take the values read from the audio tone processor and to use them to control the color and intensity of the NeoPixels mounted under the vacuum tubes. I created this software in such a way that the audio signal can be divided and displayed as 3, 5, 7, or 13 different frequency bands (Listing 1). The full software for the project is available at www.clivemaxfield.com.

Copy Code
void ReadMSGEQ7 ()
{
// Pulse the latch signal to latch the current MSGEQ7 values
digitalWrite(PinLatch, HIGH);
digitalWrite(PinLatch, LOW);

// Delay to meet minimum reset-to-strobe time (72us)
delayMicroseconds(80);

// Cycle through the MSGEQ7's seven spectrum bands
for (uint8_t iBand = 0; iBand < NUM_MSGEQ7_BANDS; iBand++)
{
// Read current band (then increment to next band)
digitalWrite(PinStrobe,LOW);

// Wait for outputs to settle (min 36us)
delayMicroseconds(40);

// Read & store current values from MSGEQ7
MSGEQ7Amplitudes[iBand] = analogRead(PinAudioIn);

digitalWrite(PinStrobe,HIGH);
// Pad delay to meet min strobe-to-strobe time (72us)
delayMicroseconds(40);
}
}

Listing 1: This is the routine that’s used to access the seven bands of frequency data from the MSGEQ7 (COM-10468) chip. (Listing source: Max Maxfield)

Also, all of the tubes representing a particular band can be illuminated with the same intensity, or the intensity can be varied such that the tubes light up from front to back as the sound increases in volume.

Recommended Reading

Conclusion

I must admit to being rather proud of this project, which has received extremely positive reviews from everyone who has seen it, but there’s always room for improvement. For example, the volume of the audio source must be presented within certain bounds to achieve the best effect. If the volume is too low, the unit doesn’t respond at all; if the volume is too high, the unit saturates with all the tubes full on. In Part 2, we will consider how to enhance the audio processing capability using an envelope generator and an electret microphone to respond more meaningfully to a wider dynamic range of sound.

制造商零件编号 2854
ADDRESS LED RING SERIAL RGBW
Adafruit Industries LLC
¥100.69
Details
制造商零件编号 2852
ADDRESS LED RING SERIAL RGBW
Adafruit Industries LLC
¥80.04
Details
制造商零件编号 2859
ADDRESS LED MODULE SERIAL RGBW
Adafruit Industries LLC
¥58.56
Details
制造商零件编号 2842
ADDRESS LED STRIP SERIAL RGBW 4M
Adafruit Industries LLC
¥908.30
Details
制造商零件编号 A000066
ARDUINO UNO R3 ATMEGA328P BOARD
Arduino
¥190.97
Details
制造商零件编号 ATMEGA328P-PU
IC MCU 8BIT 32KB FLASH 28DIP
Microchip Technology
¥23.52
Details
制造商零件编号 BOB-09868
ADMP401 MEMS MICROPHONE
SparkFun Electronics
¥89.13
Details
制造商零件编号 COM-10468
IC AUDIO TONE PROCESSOR 8DIP
SparkFun Electronics
¥44.77
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum