Music is always more interesting when you have visual feedback to go along with it, and this ATtiny85-based device lets you inject a VU meter into your audio input in (quite small) style. The unit takes in a signal via an audio jack, and after some filtering, sends it to an ADC pin on the ATtiny85 chip.
Once received on the ATtiny, the fix_fft library is employed to break the signal down into its frequency components for output. To deal with the MCU’s limited amount of RAM, the 128×32 pixel SSD1306 OLED screen used for visualization is populated in 32×32 chunks with this ssd1306 library. The ATtiny85’s internal oscillator calibration register (OSCCAL) is set to 240 for a frequency of around 30MHz, and input values are mapped and pre-scaled, giving a sampling frequency that works out to roughly 2MHz.
The device is housed in a 3D-printed enclosure, and in addition to the ATtiny85 input, the unmodified sound signal is passed along to another audio jack for your listening enjoyment! A short demo of the spectrum is seen in the video below with animated lines pulsing to the music. Code, print files, and a circuit diagram for the build are available on GitHub.