We're entering a new chapter for the Perpetuum-Ebner turntable. The practical things are sorted out and the once defect table spins again.
Time for some enchantment. I'm going to build a light organ.
Digital Light Organ
There are a number of projects around that use an equalizer display chip to detect bass, mids and highs.
But I found one curious project on Cool Arduino that is fully digital. The Arduino light Organ uses FFT to detect low, mid and high.
There isn't a lot of coding needed - 11% program and 16% dynamic on a UNO - and it works excellent.
Here's a 10 seconds demo that shows how it reacts on a sweep of 20 Hz -> 20 kHz.
When you click on the link to the project above, you see a photo of an Elektor magazine, March 1982, Spanish version.
I have the Dutch edition of that same month lying around somewhere. I'll post a front cover scan if I manage to locate it.
The Program
In the setup, the ADC is configured for 38 kHz sampling, and the reference is set to the internal one. Grease up your Spanish and read further:
// Configuramos el prescaler a 32 -> 16Mhz/32 = 500 KHz // como cada conversion son 13 ciclos 500/13 ~ 38.4KHz // Es decir podemos medir en teoria hasta unos 19KHz, // que para este proyecto sobra. bitWrite(ADCSRA,ADPS2,1); bitWrite(ADCSRA,ADPS1,0); bitWrite(ADCSRA,ADPS0,1); // Como la señal es muy baja,utilizamos la referencia interna // de 1.1 V en vez de la de defecto de 5 V. analogReference(INTERNAL);
In the loop, the code takes an array of samples, applies Hann windowing function, and then sends the result to the FFT library for processing.
The result is data on 64 bands across the range.
// Realizamos el muestreo for( int i=0; i < MUESTRAS; i++) { data[i] = analogRead(0)/4 -128; //Convertimos de 0..1024 a -128..127 im[i] = 0; // parte imaginaria = 0 } // Aplicamos la ventana de Hann aplicaVentana (data); // Calculamos la FFT fix_fft(data,im,LOGM,0);
The code splits that up in 3 bands, and does some smart stuff to make the LEDs work across a dynamic range of input strength.
The light organ functions well for silent and loud parts of sound. It adjusts its behavior.
Visit the Cool Arduino blog to see that part of the code. The article has an in-depth explanation of the flow from sound sample to flashing LEDs
Demo Signal
I used my function generator in sweep mode. It scans the audio band (the human band, not the dog audio band).
You can see the bass, mid and high LEDs switch on when the signal is in range.
My DC offset is a bit high here, 2.7 in stead of 2.5, and the amplitude is on the high side too.
But it's all in the safe range for the microcontroller.
Bass is active around 450 Hz, Mid approx 1400 Hz and High kicks in close to 9 kHz.
I'm going to check how I can turn this demo setup into an Infineon Led Shield powered show, and where I can mount the LEDs in the player for an enchanted look-and-feel.
There was supposed to be a video here with a walk-through, but the rendering takes a bit long today.
Top Comments