Acoustic spectrum analyzer – V2

analizator_animationAcoustic spectrum analyzer for HD44780 LCD. This is version 2 of this device, version 1 was popular and you asked for some effects and options, so here it is :)



Changes made scince v1:
– added 5pin connector to small keyboard
– you can change backlight brightness of LCD (PWM on OC2 output), included software VFD brightness change
– change sensivity
– choice display effect (bars, lines, poles, ovals, arrows)
– options are autosaved to the eeprom memory
– added jumper (solder pads under uC) to select the prescaler for adc, if your avr is not displaying higher band due to too hign overclock of adc (solder to lower the adc clock)
– added jumper to select if you using a VFD display – device instead of controlling PWM, will be sending special data command for brightness changing.
– PCB’s for both 2*8 and 16*1 connectors displays.

The speed of refreshing mostly depends on display model, most of cheap 16*2 LCD’s have slower controllers. The fastest displays that i saw are the VFD’s, refreshing is so fast that we can not be able to see difference if it will be even faster. To make this even faster, you can overclock uC with 20MHz or more, just update the $crystal constant in program. Note that above 16MHz uC can be unstable, and issues with ADC guaranteed (i explain this at the end). But if you have slow display, even overclocking will not give any good results. In that case i have used the noritake itron CU20029ECPB-W1J, which is, as it turned out, not fully HD44780 compatible, as can be seen on my movie, it makes some difficulties while changing the user definable chars.

Device is compatible backward and vice versa, so you don’t need to make new PCB. See schematic, just solder one NPN transistor and one resistor for backlight, and attach wires to keyboard. Let me know if you want firmware with english language. 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 – it’s not that hard, but i need you to test it, so i don’t make codes for displays that i can’t test.


8x2top 16x1top analizator2-1 analizator2-2

analizator2-3 analizator2-4 analizator2-5 analizator2-6

analizator2-7 analizator2-8 analizator2-9 analizator2-10

Video – Prezentacja na wyświetlaczu VFD.

There are 3 ways to connect audio signal:

  • a) Signal ground to “Agnd” on board, in this case nalayzer 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.
  • Calibration in target device:
  • Below i try to explain how to setup analyzer to work with pc signal. If you want build it in amplifier or other device, note that there might be different signal strength. If you have possibility to give signal from function generator (can be from pc, or even recorded on cd-audio) this is good. In other case you will have to do this setup by “watching” music on oscilloscope.

  • 1) 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 sinus, frequency 400Hz, gain at about 80%.
    gen

    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.

  • 2) 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 sinus, frequency 5KHz, gain at about 80% (on picture there is 400Hz, don’t mind that).
    gen

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

    That should look a proper clean signal
    good

    And like that will look a overdrien signal with tops cutoff
    bad

    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.

    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.

    Jumpers explanation :

    low_prescaler_vfd

    The author of program is user Hunterhouse, + some of my addons.

    ATTENTION on 09.02.2010 i updated the attachment, programs from previous have a little bug.

    DOWNLOAD – eagle 5.4.0 project files, schematic and pcb PDF’s and PNG for 2*8 and 16*2, firmware BIN and HEX and source code for displays: 16*2, 20*2, 24*2, and 20*4.
    .
    .


    Update 17.06.2011:
    MrShilov suggested few changes in schematic. Simple modification, but spectrum will be reproduced much better. Didn’t tested this.

    5.00 avg. rating (98% score) - 3 votes

    263 Comments

    1. Witam zbudowałem analizator ale mam pewien problem. Cały czas w górnej części wyświetlacza (używam 16×2) pokazuje się napis “Jasność: 50 (0)_” – tak jakby przycisk do zwiększania jasności był na stałe wciśnięty (sprawdzałem płytkę i nie ma na niej zwarć, tak samo na pilocie z przyciskami). Czy to jakiś błąd w programie? Bo czasami z niewiadomych przyczyn napis sam znika i za chwilę znowu się pojawia. Podobno w wersji C program miał taki problem, ale ja mam wersję D w której powinno to być naprawione. A może to dlatego że zamiast atmegi 8-16PU używam 8A-PU?

    2. Would you have the compiled 16×2 HEX file, in English, for the Acoustic spectrum analyzer – V2?

      Thank you

    3. analizator.V2_9d_16x2 nie skompilowany, produkuje błąd. Kod nie zmienia nic. Dla 20×2 prawidłowo i kompeliruetsya. Proszę mi powiedzieć, na czym polega problem?

    4. shows code mismatch after loading Hex file for 16×2 display. Tried different program and Atmega8a chip. No response in 16×2 LCD display while giving audio signal. Please check.

    5. Hej
      Poskładałem i ja , dwie sztuki od razu. I ciekawostka, na oryginalnej Atmega8-16 PU nie działa połowa wyświetlacza i do tego nie zapisuje ustawień do pamięci. Na Atmega8L , przy taktowaniu zewnętrznym kwarcem 16Mhz działa wszystko jak złoto, udało się ustawić czułość , w miarę poprawnie oddaje częstotliwość. Zauważyłem że przy pierwszym uruchomieniu na obu wersjach Atmegi ściemnianie jedzie od 256 do zera a potem już działa poprawnie 0-50 , to samo z czułością.

    6. Hejka. Fajny analizator. Czy ktoś ma płytki na handel ?

      • Ja płytki zamówiłem na allegro – poszukaj pod “PCB na zamówienie”, użytkownik lijon1. Wychodzi około 7 zł za sztukę, o ile dobrze pamiętam.

    7. Dobry, mam pewien problem. Mianowicie nie wiem, jak podpiąć sygnał, gdy masy muszą być połączone. Może ktoś wrzucić schemat? Mam podpiąć dzielnik 100kOhm/100kOhm pod stabilizowane 5v, a sygnał podpiąć między rezystory (a następnie do IN)? “Sygnał należy podać przez kondensator” – mam wpiąć kondensator szeregowo przed dzielnikiem, czy równolegle do masy?
      Drugim problemem jest dużo wyższa amplituda – jak ją zmniejszyć? Zwykły rezystor wystarczy?
      Pozdraiwam!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Please leave these two fields as-is: