AVR Acoustic Spectrum Analyzer





Introduction: AVR Acoustic Spectrum Analyzer

AVR acoustic spectrum analyzer, based on Atmega8 AVR microcontroller, operational amplifier, and few other components. Use any HD44780 compatible LCD or VFD, connect audio signal, and enjoy the effect :) You can build in this into your amplifier, pc, car-audio, or other device. On this moment device support following displays: 16*2, 20*2, 24*2, and 20*4. If you have one which this device not support, please contact me and i will try to adapt code for it. There are two pcb's which exactly fits behind the display, one for the 8*2 connector displays, and one for 16*1. You can attach a small keyboard to change display brightness (vfd also supported), change sensivity, choice the display effect. Settings are saved to the eeprom memory.

Project site: diy.elektroda.eu/analizator-widma-akustycznego-v2/

And here is how it works on 20*2 VFD

"czulosc" and "janosc" are in polish, they means "sensivity" and "brightness" :) And they can be changed :)

Step 1: Make Board

Use the eagle project files or PDF's to make a PCB, choose 16*1 or 8*2 connector depending on your display. There is also top layer with components values. See schematic for part list. You can connect a small keyboard to 5pin connector, there is no pcb for keyboard, just use 5 buttons and connect all to the ground.

Step 2: Program the AVR

First of all you need to program your AVR with code from the attachment, if you are using 16*2 display you need to flash the 16*2 version code, etc. Use any avr proggramer. You will need to setup fusebits as shown, for example on burn-o-mat, the avrdude GUI. You need to set the external crystal 16MHz, and activate the CKOPT fusebit. That's it.

Step 3: Connect Audio Signal

There are 3 ways to connect audio signal:

a) Signal ground to “Agnd” on board, in this case analayzer ground and audio ground can not be connected together.
b) Analyzer can be powered symmetric, +-2.5V, “Agnd” will become power ground and audio ground.
c) If analyzer and our output device grounds must be connected together, and there is no way to power analyzer with symmetric supply, you must somehow raise signal to 2.5V height. You can do this by connect the grounds together, raise the signal up with R/R resistor divider (about 100Kohms) connecting them between gnd and supply, signal through 1uF capacitor to resistor divider and then to IN pin.

Step 4: Fast Calibration

You will need a “function generator” program, i use “FG Lite” (on download page). Connect and power-up analyzer, sound connect to line-out of your pc card, ground to Agnd. Attention – grounds can not be connected together! Function generator set to sine, frequency about 400Hz, gain at about 80%.

Left potentiometer set so that was leaning out just one bar (eventually two, depends on frequency), highest as possible. If gain be too large, you will see other leaning out bars – this is bad. Now, change generator frequency to 10KHz, and right potentiometer set in the exactly same way. Done.

Step 5: Precision Calibration

Or, you can make the precision calibration...

You will need two programs “function generator” and a “oscilloscope”. I use “FG Lite” and “Oscilloscope 2.51 for windows 95″ (on download page). Learn the basics of using a oscilloscope, how to setup line-in of your pc audio card, how to set a input gain of audio card and oscilloscope so that there was no overdrive – i will not describe that here – if you do not have an idea on what i am talking about, just make the fast callibration.

Function generator set to sine, frequency 5KHz, gain at about 80% (on picture there is 400Hz, don’t mind that).

Left potentiometer turn right to the end, connect line-in of your pc audio card to RED point.

3rd image show how should look a proper clean signal

And 4th image show how look a overdrien signal with tops cutoff

If potentiometer is turned right to the end and despite that signal is overdriven, you will have to reduce signal from your pc, or, if nalayzer will be working in other device, you will have to add R/R divider or extra potentiometer to reduce the signal strength to proper value. If the signal is nice and clean, try to raise it a little bit by turning the potentiometer in left direction – but do not overdive. Do the same with the right potentiometer and GREEN point. Now, connect your pc audio input to BLUE point and then to YELLOW to check if signal is ok. At the end check if low-pass filter is working corectly, connect your pc audio line-in to YELLOW point, and slowly move the frequency slider from left to right, signal should vanish near 800Hz – 1KHz.

Step 6: Jumper and Other Options

Components used in filter must be exactly as on schematic, and better if they will be new, especially capacitors. Two 470ohm resistors that makes the 2.5V reference voltage must be similar as possible. Some of avr’s (especially the new ones produced after 2008) are not susceptible to overclocking very good… program overclocks BADLY the ADC while measuring the high band signal. If you can’t see anything on the right side of display, this means that your ADC is not working. Solder the LOW PRESC jumper to reduce frequency of ADC, it will apply prescaler 4 instead of 2. If you are using VFD, solder the VFD jumper to send special brightness regulation commands instead of controlling PWM output. This can not be used together because the LCD wrongly recognize this command and its start to be unusable.

I am the author of hardware and part of the software, author of software is Hunterhouse user.

Source codes are included

All needed files are in the attachment. I know my english it's not too good, so ask if something is unclear.

Good luck!

Oh, and if you want fast response to your question, please ask in comments on my site or contact me.

ATTENTION ATTACHMENT WAS UPDATED. Previous contained a little bug in programms.



    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest
    • Oil Contest

      Oil Contest

    25 Discussions

    Hello, how is it possible to adapt this spectrum analyser to a another frequency range, for example 20 to 200 khz ?

    can i turn this project into like Samson D-1500 ? Sorry i'm new to Audio and electronic stuff, thank you very much


    what kind of input does this use? do you just plug your audio cable into it?

    If I do it with arduino uno how can i change code for? And I don't understand audio ground be conected .

    nice one buddy
    there are 2 things i want to know
    1- in which software u r simulating the avr chip
    2- what is the general circutary for a reset switch that is active low
    please reply indivusally and fast

    just the thing i was looking for but i am pretty much a beginner in the world of electronics so first of all how do i turn the egal files into a pcb and second of all what screen and what size did you use? thanks

    awesome project!
    i was thinking of something like this, remembered a similar project here (other one than this one) but this is exactly what i was hoping to make :D
    gotta get the parts someday, this is really something i wanna have :P
    are there plans for making a kit?

    Attachment updated, program codes in previous one contained a little bug, so please download it again.


    Excellent project, I have been looking for something like this for a while.

    I will try putting it together later today, I have a lot of Noritake VFDs that I need to put to use.

    There's just one thing I'm wondering about. I notice it uses the display in 4-bit mode. I have had some trouble with Noritake VFDs in 4 bit mode before, are there enough free IOs to make it use the display in 8 bit mode?


    3 replies

    Hi! There is no even one free pin left. I have problems with this VFD too, but i don't think that is 4bit bus mode fault. My VFD has problem with changing the definiable chars while running, i can change them on start with no problems. When i try to change them while working, display just don't release busy flag and program hungs up, as seen on my movie, its reseted by watchdog - and it happens very often. I have tried a lot of tricks to avoid this but vfd keeps hunging up :(

    And what are yours problems with VFD's? Can you test this analyzer on your VFD's and tell me if you have the same problems as me?


    I have had many strange problems with using the Noritake VFDs in 4 bit mode, also that it won't go out of busy, leading programs waiting for the VFD to crash and other strange stuff. I have had this problem with both new and very old HD44780-compatible Noritake VFDs. The problems have always gone away when I have switched to 8 bit mode. This is very frustrating, but I don't know about any other solutions.

    Are PB0-5 used for buttons? Maybe you could multiplex the buttons onto the VFD data bus.

    Anders M.

    You can throw away buttons and throw away two pins for selecting VFD and low prescaler - and you got 7 free pins. Maybe if i found some free time i will try to do this on 8bit mode and do more tests of these noritake vfd, which is, not 100% HD44780 compatible :( I don't know maybe there is some extra commands that pdf don't describes? I tried to switch off and on and do another init before sending definiable chars, i even edited compiler lcd library to make a little longer timings... same bug.

    Whats the name of 1st,2nd,3th song on the video?

     Hi, witch character are you using to print the bars in the display? have you reprogrammed the display eeprom? I hope not.
    I try to read the code but I'm a C18 kid and I don't get it...

    2 replies

    Hi gism, you can define up to 8 your own chars in the HD44780 displays, you just send a proper command and display saves it into the ram memory. Look on the bottom of the program, there are these commands "deflcdchar" and data for it. The are saved in 0 - 7 cells. The code is in BASCOM AVR compiler.

    thanks, I understand, I will have to read the datasheet to do this in C18.

    great job! have you thought about using nixie bargaphs, such as the in-13?
    5 stars!

    I am just wondering but where did you get the VFD display?  I like how they look but I have not seen any cheap suppliers.