Implementing Discrete Fourier Transform in Atmega32 to make an audio spectrum analyzer

"All waveforms, no matter what you scribble or observe in the universe, are actually just the sum of simple sinusoids of different frequencies."

I am just refreshing the basics of fourier transform. I am not an expert. Now I did a small audio spectrum analyzer(0 - 10KHz) on a 16x2 character lcd using an atmega32 microcontroller. Since I am refreshing from the basics, so I started with simple DFT. Also, I believe I should learn to walk before running. So I am not straight away going towads the FFT, which is nothing but the fastest and a bit complicated algorithm to find DFT.(I will try it later, as soon as possible)
        DFT is too slow compared to FFT. My lcd spectum analyzer doesn't need a great speed like that of an FFT, now if it is capable of providing a speed of around 30 frame/second, then it is more than enough for visualizing the audio spectrum on an LCD. But any way, in my case I can roughly achieve around 100 frames/second(any way it is too high refresh rate for a 16x2 lcd, not recommended also :-)). My audio sampling rate is 20KHz for 32 point DFT. Since the transform result is symmetric, I need to use only the first half, ie the first 16 results. So, it means, it can display upto 10KHz spectrum. So the resolution is 10KHz/16 = 625Hz.
         I have tried to improve the speed of DFT computation. If it is an N point DFT, it needs to find (N^2)/2 sin and cos values. For a 32 point DFT, it needs to find 512 sine and cosine. Before finding the sine and cosine, we need to find the angle(degree) which takes some processor time, so I implemented a lookup table for that. Next two tables are for sine and cosine. I didn't used any float or double since it takes more processing time in 8 bit avr, instead I implemented the sine and cosine lookups as 16bit intiger, by multiplying the real sine and cosine values by 10000. Then after finding the transform, finally I need to divide each result by 10000. This eliminates the need of using float or double and makes it more faster. Now I can calculate 120  32-point DFT operation/sec which is more than enough for my small spectrum analyzer.

Generating AUDIO ECHO using Atmega32 microcontroller

(video demo of echo generation using atmega32)
While I was studying at 10th standard, I used to play with small electronic circuits mostly based on transistor bc547 - bc557 pair. At that time, I just asked myself, I can amplify audio signals using few transistor combinations, but how can I make an echo effect which I used to hear in almost all loudspeaker announcements? I can't imagine what I can do with few transistors and resistors to make such an effect! I have no answer at that time because it was beyond my limitation..
  But now I can do this very easily by a simple digital signal processing using a microcontroller. It's concept is very simple, ie we need to apply a proper delayed feedback in digital samples with in a circular buffer. I did this using an atmega32 microcontroller and it worked fine. This is simple but really an interesting project. Not only an echo, but we can do a lot of fun with this type of small DSP experiments if we have considerably large RAM in the mcu...

An attempt to mount an SD/MMC connected at parallel port of PC (a linux device driver)


Hi, for the last few days, I was engaged on a mad project, ie I was trying to access as SD card directly via parallel port of my desktop PC with linux. At first, I successfully did the SD/MMC initialization and tested it by reading and writing few sectors. Later I got a simple demo block driver code (kernel module) from net. Then I modified it and used my SD card code along with it and made a driver for the parallel port - SD/MMC card. Then after connecting the card to parallel port and inserting the module, a new device file is generated (/dev/sbd). After that I successfully mounted it and accessed it similar to that of a usb pendrive or any other external memory device. I have tested it with 64MB MMC, 512MB SD and a 1GB MMC and all worked fine.. But the only drawback is the speed of data transfer is around 200kbps only..:-( It takes 1 minute for transferring 1.5MB file to or from the card. Also the entire system may get hanged while the data is transferring...
But any way, it worked, that's enough for me..... :-)