• 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:

    http://youtu.be/n1s1-yhgnb4

    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 3.5.3.1 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

    Maxim-24715

    Having issues with arrays

    Thread Starter: Maxim

    If I create an array 255 bytes in size(Dim fdat As Byte) then I load the first 10 locations with abcdefghij.I then use hserout str fdat\5, I should...

    Maxim Today, 07:38 Go to last post