• 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


    P-ICD V3.0.1.5b Released

    Thread Starter: DaveS

    What's new in Version A PayPal donate button added to menu> Help>About I have spent about 3 months on upgrading/improving(I hope)...

    DaveS Today, 18:13 Go to last post


    Thread Starter: teo

    Hi, "PulseIn waits a maximum of 0.65535 seconds for a trigger, then returns with 0 in variable" It is possible that PulseIn waits a maximum of 0.08...

    teo Today, 17:41 Go to last post

    ADin 12 bit?

    Thread Starter: Klr650

    Apologies if I'm being a pillock but does the ADin command work with 12 bit ADCs? I'm trying out the 24EP128MC202 for the 1st time and have got it...

    Klr650 Today, 15:10 Go to last post

    Re: ADC with Resistive Touch Screen Reading Issue.

    Thread Starter: craig

    Hi All I am using Compiler version with windows 7 X 64 and a Pic 18F6622 (10 Bit ADC) with a 20Mhz Crystal Connected to a Resistive Touch...

    Henk57 Today, 20:29 Go to last post