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.

    // Como la señal es muy baja,utilizamos la referencia interna
    // de 1.1 V en vez de la de defecto de 5 V.


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


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.




Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story