• PicŪ Basic

  • Colour Organ using a fast 8-bit FFT routine

    A colour organ is a sound to light unit that splits the audio signal into bands of frequencies and illuminates a number of differently coloured lights, LEDs in our case, accordingly. This simple implementation of a colour organ uses only a microcontroller, a potentiometer and eight LEDs.

    I presented a fast fixed point 8-bit FFT routine in this article: Fast 8-bit FFT , in which the display was mainly on an alphanumeric LCD. This application of the FFT uses the audio bands to adjust the brightness of eight LEDs using a software, interrupt driven, PWM (Pulse Width Modulation) routine. Each LED is illuminated according to what frequency band it sees. i.e. Low frequencies, mid frequencies and high frequencies. It also illustrates a special event interrupt to continually sample the audio signal being fed into its ADC (Analogue to Digital Converter).

    Here's a video of the colour organ in action, remember, this has no pre-amp or filter, just the audio signal from a PC's headphone socket going into the device's ADC. The results for such a simple design are quite interesting:


    If youtube lose the video for whatever reason, it can be downloaded from here: Proton Colour Organ Video

    The colour organ was built using an Amicus18 development board, which contains an 18F25K20 microcontroller running at 16mips (Million Instructions Per Second). The LED and audio circuit for it is shown below:

    Attachment 1388

    Click on this link for a larger image of the above circuit: Large circuit image

    The source code for the colour organ can be downloaded from here: Proton_Colour_Organ_Source

    The code is for use with the proton compiler version onwards. Earlier versions of the compiler will not compile correctly with this implementation.

    Using the colour organ
    Connect the output from the PC's earphone socket to the AN0 pin of the microcontroller (PORTA.0). Set the music playing at a reasonable volume level, and adjust the potentiometer connected to the ADC's Vref+ pin so that the signal level does not overload its input. Some tweaking may be required, but once set, it usually does not require changing, and could even be replaced by a couple of fixed resistors.

    The response could be dramatically improved by the inclusion of a low pass filter and pre-amplifier preceding the ADC's input, and an Automatic Volume Control (AVC) would make it even better.
  • Recent Activity

    John Drew-26

    Tool chain

    Thread Starter: Peter Truman

    Hi All I've been a proton user many years now - I've not yet ventured into the realm of PIC24 or DSPIC so I thought I would ask some advise here....

    John Drew Today, 11:49 Go to last post

    thermal printer

    Thread Starter: mahmood

    Hi All I want to interface a thermal printer to a 18f452 but i don't know how to begin ! can any one guide me to start first step ? did any one...

    normnet Today, 07:31 Go to last post

    Question for Les Johnson.

    Thread Starter: Gerard

    Hi, The compiler does not recognize the PWM modules 12F1572. How to solve this problem? Thank you in advance, Regards.

    myeeplacee Today, 03:46 Go to last post

    12F1572 and PWM

    Thread Starter: Gerard

    Hello, when I write HPWM PORTA.0, 50, 100 I have the following message when compiling ERROR : Device does not contain any hardware PWM channels!...

    pic-ignorant Yesterday, 17:16 Go to last post