AVR acoustic spectrum analyzer using Atmega8 microcontroller

Summary of AVR acoustic spectrum analyzer using Atmega8 microcontroller


This article describes building an AVR acoustic spectrum analyzer using an Atmega8 microcontroller and operational amplifiers. It supports various HD44780 compatible LCDs or VFDs (sizes 16x2, 20x2, 24x2, 20x4) and features adjustable brightness, sensitivity, and display effects saved to EEPROM. The device connects to audio sources via three specific grounding methods and includes a calibration process using a function generator for accurate frequency response.

Parts used in the AVR Acoustic Spectrum Analyzer:

  • Atmega8 AVR microcontroller
  • Operational amplifier
  • HD44780 compatible LCD or VFD display
  • Two custom PCBs (one for 8*2 connector, one for 16*1)
  • 5-pin connector for keyboard input
  • Five buttons for manual control
  • Resistor divider (approx. 100Kohms)
  • 1uF capacitor
  • External 16MHz crystal oscillator
  • Function generator software (e.g., FG Lite)

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

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

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.
For more detail: AVR acoustic spectrum analyzer using Atmega8 microcontroller

Quick Solutions to Questions related to AVR Acoustic Spectrum Analyzer:

  • How do I connect the audio signal if grounds must be shared?
    You must raise the signal to 2.5V height using a resistor divider of about 100Kohms between ground and supply, passing the signal through a 1uF capacitor.
  • What displays are currently supported by this device?
    The device supports 16*2, 20*2, 24*2, and 20*4 HD44780 compatible LCDs or VFDs.
  • Can I change the display brightness and sensitivity?
    Yes, you can use a small keyboard attached to the 5-pin connector to change brightness, sensitivity, and choose display effects.
  • What fusebits must be set when programming the AVR?
    You need to set the external crystal to 16MHz and activate the CKOPT fusebit.
  • How do I calibrate the analyzer for accurate readings?
    Connect a function generator at 400Hz and adjust the left potentiometer until one bar leans out, then switch to 10KHz and adjust the right potentiometer similarly.
  • Where are the settings stored on the device?
    All settings such as brightness and sensitivity are saved to the EEPROM memory.
  • Is there a specific PCB required for the keyboard?
    No, there is no PCB for the keyboard; you simply use five buttons connected to the 5-pin connector and ground.
  • What happens if I set the gain too high during calibration?
    If the gain is too large, you will see other bars leaning out, which indicates incorrect calibration.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top