FHT Audio Spectrum Visualizer

This project is similar to my previous one but uses the FHT library which turns out to be at least 4 times faster than the FFT.

Jun 22, 2020

26209 views

15 respects

Components and supplies

2

Capacitor 100 nF

1

1N4007 – High Voltage, High Current Rated Diode

1

Capacitor 1000 µF

1

WS2812B 8X32 RGB LED MATRIX

1

Arduino Nano R3

2

Pushbutton switch 12mm

3

Resistor 4.75k ohm

1

Through Hole Resistor, 390 ohm

1

PCB Stereo RCA Female Plug

2

Resistor 100k ohm

1

4x6 cm generic prototype board

2

Resistor 10k ohm

Tools and machines

1

3.5 mm Audio Jack Cable to Stereo RCA Connector

1

Soldering iron (generic)

Project description

Code

FHT Code Version

arduino

FHT Code Version

arduino

Downloadable files

Breadboard

Breadboard

Schematic

Schematic

Breadboard

Breadboard

Comments

Only logged in users can leave comments

arsdaniel

8 months ago

ahoj Janux. rozhodol som sa vyskusat tvoj projekt na baze arduino nano (avr). bohuzial kompilator hlasi chybu: fht_input was not declared in this scope... snazil som sa vycitat informacie z Readme.txt v kniznici fht, ale nic mi to nepomohlo. preto sa obraciam s prosbou o pomoc na teba

axo123

a year ago

Can i use 1n4001 instead of 1n4007 or 1n4004 like shown in schematic?

polaarofficial

2 years ago

I built out the breadboard, and im having issues. I tested to confirm the LED's work, and they do on a separate board. I plugged in the board to the computer or power source, and i see the green light light up on the arduino board. I am a bit frustrated, and was hoping if you can provide some personal insight. Is there a way to test the set up without an rca input?

polaarofficial

2 years ago

I built out the breadboard, and im having issues. I tested to confirm the LED's work, and they do on a separate board. I plugged in the board to the computer or power source, and i see the green light light up on the arduino board. I am a bit frustrated, and was hoping if you can provide some personal insight. Is there a way to test the set up without an rca input?

polaarofficial

2 years ago

I built out the breadboard, and im having issues. I tested to confirm the LED's work, and they do on a separate board. I plugged in the board to the computer or power source, and i see the green light light up on the arduino board. I am a bit frustrated, and was hoping if you can provide some personal insight. Is there a way to test the set up without an rca input?

polaarofficial

2 years ago

I built out the breadboard, and im having issues. I tested to confirm the LED's work, and they do on a separate board. I plugged in the board to the computer or power source, and i see the green light light up on the arduino board. I am a bit frustrated, and was hoping if you can provide some personal insight. Is there a way to test the set up without an rca input?

polaarofficial

2 years ago

I built out the breadboard, and im having issues. I tested to confirm the LED's work, and they do on a separate board. I plugged in the board to the computer or power source, and i see the green light light up on the arduino board. I am a bit frustrated, and was hoping if you can provide some personal insight. Is there a way to test the set up without an rca input?

Anonymous user

2 years ago

Hi the FHT library cannot be installed. in none of the three ways arduino says there are no valid files, advice? i had tried to load your previous vmeter the one with FFT, only the first three columns work but with arduino uno. the power supply delivers 5A.

Anonymous user

2 years ago

hi is it possible to add other matrix to make a 16X32 display instead of 8x32? what changes need to be made to the code? I would like to control arduino with a microphone maybe amplified, in the wiring diagram. can I do this? I delete on trs1un channel, I delete C1 and R1, instead of R2 I put a 10K trimmer. it's right? I don't see in the code where you tell arduino that the signal enters on pin A0. goodbye

Anonymous user

2 years ago

If i use a 10K pot trimmer do I need a different cap value? Thanks,

janux

2 years ago

Hi Mauro, Just change #define yres 8 to #define yres 16, that's it. The two pairs R1-C1 and R2-C2 are intended to avoid putting the left and right audio channels directly in parallel and avoid losing the stereo effect in the audio source. If you remove R1 and C1 the circuit uses the audio information from only one channel, there will be no problem but the represented audio spectrum will be incomplete. A trimmer instead of R2 only changes the input impedance, if you want to add an input volume adjustment you can insert a 0.1 µF capacitor and a 50K trimmer between the jack and C2. Connect the signal from the jack to one side of the new capacitor, the other side of this capacitor to one side of the trimmer, the other side of the trimmer to ground and the central pin to the side of C2 that in the diagram is connected to the jack. Analog input A0 is set by the instruction: ADMUX = 0b00000000 If you want to read up on the use of ADC registers you can visit this page http://microelex.blogspot.com/p/1.html

Anonymous user

2 years ago

Hi I double checked everything, everything regular measured 2.8V. from your link you are unable to download the library. I went directly to the site and downloaded the .zip file. from the attachments at the bottom (the FHT one). i tried to load the library in arduino, without success. i tried to install directly from zip file but for arduino there are no valid files. in the zip I saw that there is an FHT folder and inside there is the FHT.H file. I will try to install it by hand.

Anonymous user

2 years ago

Hi! I’ve been trying to recreate your project. I’ve got a long neopixel matrix set up. It’s 31 wide and 14 tall. The pattern is horizontal serpentine, starting in the bottom left (oops). I know that’s the opposite starting point of your code but if we can get it working while reversed then I can fix that in code. I’ve got the hardware side connected and have some level of progress, but it’s not working properly. To preface, I have tested the hardware as best I can. All the neopixels can be controlled by the pro micro, and aref is at approximately 2.8 volts. If I have an Xres of 31 and yres of 14, no LEDs activate at all. Not one. If I do a yres of 13, it appears some random LEDs activate it when I turn on the device, then I get what appears to be some kind of spectrum analyzer, but the lines are horizontal and appear to be in random locations. If I set Xres to 14 and Yres to 31, then I get a somewhat functioning spectrum analyzer, but it’s sideways. If I then (while keeping the flipped x and y resolution setting) go to the getLEDfromMatrix function and reverse the x and y inputs so it’s (byte y, byte x) then I get half of my LEDs lighting up with a vertically inverted spectrum analyzer. The bars come from the top, and only the left half of my matrix is activated. Please can you shed some light on any of these issues? I don’t understand your code well enough to diagnose further. Thanks, Trek.

Anonymous user

2 years ago

FYI, if anyone finds this comment and has a similar issue, I rewrote the GetLedFromMatrix function as follows: //================================================================ // Calculate a led number by x,y coordinates // valid for WS2812B with serpentine layout placed in horizzontal // and zero led at bottom LEFT!!(DIN connector on the LEFT side) // input value: x= 0 to xres-1 , y= 0 to yres-1 // return a led number from 0 to NUM_LED //================================================================ int GetLedFromMatrix(int x, int y) { int led; if (y & 0x01) { //odd columns increase backwards led = xres*(y+1)-x-1; } else { //even columns increase normally led = x+xres*(y); } return constrain(led, 0, NUM_LEDS); } //================================================================ This is for a bottom left horizontal serpentine arrangement. However I had to disable the button functions as they crash my arduino, still debugging. Also all of my audio is crammed over on the left side for some reason.

Anonymous user

2 years ago

Hello, verry nice projeckt !! i have a question how can i set which colum show which frequency when i have only 7 colums for example and i like to show 100Hz 200Hz 300Hz.... or something other and what exactly do this " #define FHT_N 128 " ?

janux

2 years ago

Hi gusemugisch, Define FHT_N 128, defines (as the name implies) the number of samples that will be used by the sampling process. After each sampling cycle the FHT library returns, in this case, 64 values (FHT_N/2) obtained from the sampling and saves them in the fht_input[ ] array. But since we only have 32 columns (64/2), the samples are added two by two, so as not to lose information. 7 columns is a strange number, usually led arrays are multiples of 2, however, with so few columns you would have to change all the sampling and arrangement code. I suggest you look for a project designed for a smaller matrix, there are several around, search on youtube. Bye

Anonymous user

2 years ago

This project is great. Thank you for putting this out there. The matrix I bought was a bit different so I had to modify the code similar to one of the other commenters. I'm wondering if there is a way to constrain the frequencies it displays say to a max of like 10khz and a low of maybe 300hz. I've been looking over the code and I just don't see where to do it. Also can you explain what the EQ does?

Anonymous user

2 years ago

Thank you janux for this excellent project and documentation. This was a goldmine and a good starting point for my jukebox development: https://www.thingiverse.com/thing:4810229. I added dynamic input adjustment by changing line 146 _fht_input[i] = value / 8;_ to _fht_input[i] = value >> fhtDivisor;_, where fhtDivisor is controlled by the mean amplitude on the input.

Anonymous user

2 years ago

hi, can i change the number of columns from 32 to 18, 20, 22 or 24? And does the number of rows change from 8 to 10?. What do I have to do to change it and does it have any effect?

Anonymous user

2 years ago

But , inspired by the original project of Shajeeb can be added displaymode ? or can someone help me to implement this function? or put the peack function it would be something more that would be very nice

janux

2 years ago

Hi macximo204, the original version of Shajeeb was based on the MAX72xx led matrix this has specific commands to drive rows and columns. Implementing these functions via code is not easy and at the end of the game there is the possibility that the code is too long to fit in Arduino's memory. I leave the thankless task of trying to others. Bye

Anonymous user

2 years ago

First, thanks for making this tutorial. I've followed your tutorial except some changes, I used 10kΩ resistors instead of 4.7kΩ , no buttons and Arduino Mega. It's working but I can see that the first 2 rows are more "concentrated", music mainly being there. Is it because of the FHT library ?

janux

2 years ago

The division by 8 is not essential, it has the purpose of compressing the amplitude of the sampled signal, subsequently in the code this is further reduced to adapt the sampled peaks to a scale from 0 to 7 (for matrices with 8 LEDs per column). You can experiment by changing the value from 8 using multiples of 2 if you have signal amplitude problems. You don't find this in the examples of the FHT library because those are generic and have one purpose: to illustrate the functions of the library. The use of the data obtained after sampling must be adapted to the purpose of the specific project. Personally to solve this problem in some cases I used one of these (I bought 5 for 10 € on Amazon). https://www.amazon.it/gp/product/B07WRS76K2/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1 Even if they are equipped with a trimmer to adjust the volume and we apply a high impedance load to the output, in some cases the output signal may still be too wide. However to reduce the gain from 200 to 20 just remove the resistance named R1 or the capacitor named C1 (they are in series) with a touch of the soldering iron. Hello

janux

2 years ago

Resistance R3 is critical and must be around 5K, it is calculated to supply the AREF Pin from the internal 3.3V of Arduino, with very different values the sampling works badly. Measure the voltage on the AREF Pin, there must be approximately 2.75 Volts. Use two 10K in parallel. If you cannot get all the LEDs on but only the first two at the bottom of each column, it means that the input signal has a too low level, use the values suggested for R1 and R2. Try connecting the circuit to your computer's audio output so you can test it by turning up the volume. If you cannot increase the amplitude of the input signal in any other way you can try using a small additional 5 Volt powered amplifier such as those based on the LM386 that you find on Amazon.

Anonymous user

2 years ago

I've changed the 10KΩ resistors by adding another 10KΩ in parallel like you suggested. Now the voltage between AREF to ground is 2.77V. Wasn't the case previously. On PC audio line it looks much better I guess it's like you said, a problem of amplitude. I have LM386 lying around but not sure I will use it as it's not rail to rail, I also have MCP6002 which I might use instead. By the way, why you do this in the code: fht_input[i] = value / 8; // copy to fht input array after compressing I didn't see this in the example library you are using.

Anonymous user

2 years ago

Hi I found an FHT library somewhere. now it starts to work only with arduino UNO. the problem is that only three columns are displayed but they work perfectly following the rhythm of the music. now this is due to bad FHT library? I don't think since your previous vmeter worked like that (the one with FFT) always and only with arduino UNO. could it depend on the fact that I use arduino NANO with ATMEGA 128? now for the three column problem I use a 5V 5A power supply so I don't think that's that. do you have any idea? Mauro

Anonymous user

2 years ago

hi i am using an arduino nano v.3 with atmega 128, while i see that you are using an arduino nano v.3.1 with atmega 328. with v.3 it compiles and loads correctly. What is strange is that I tried the two versions of the program, the one with FFT and the one with FHT since the only hardware difference is the non-use of D10 but nothing works. Mauro

janux

2 years ago

Hi Mauro, sorry if I answer you very late. The voltages are quite correct, but I suggest you still check the connections and especially the values of the resistors by measuring them with a hommeter because the VREF is better to be accurate. Arduino works great even with 4.2 Volts so I suggest you leave the diode where it is. 0.8V voltage drop seems to me too much for a silicon diode, did you connect the 1000µF capacitor? Are you powering everything with a power supply capable of supplying at least 1 or 2 Amps? You are probably using the wrong library, below you will find the link to the OpenMusicLab site from which to download the correct one. The file is called "ArduinoFHT.zip" about 25Kb. http://wiki.openmusiclabs.com/wiki/ArduinoFHT?action=AttachFile&do=get&target=ArduinoFHT.zip

Anonymous user

2 years ago

hi I mounted the circuit on the proto board and double-checked the wiring three times, but it doesn't work, the LED matrix does not light up at all. since I had 3.05V on VREF I took the R3 from 4K7 to 10K and now on VREF I have 2.8V. the voltage after the diode 4001 and 4.2V but passing the diode does not change anything. I doubt that the two libraries I found FHT and NEOPIXEL are not working well. on pin A0 with the oscilloscope there is a signal of 0.05V amplitude, on D6 nothing. on the two 100NF capacitors I send the headphone output of a radio. if you think the problem is the libraries can't you attach them to the project? Thanks for your help. Mauro

Anonymous user

2 years ago

the three columns that work are the first three columns starting from the IN input. the brightness and color change also works.

Anonymous user

2 years ago

Can i use the program with vertical led strips? If so, what i have to change in the code?

Anonymous user

2 years ago

Hi, had the same quetsion here. I solved it! There are just a few things you need to change, but i guess it still depends on how you matrix is build... (My Matrix starts from the left side with serpentine layout placed in vertical) Change the existing definition of GetLedFromMatrix with this one: int GetLedFromMatrix(byte x, byte y) { int led; led = ((x + 1) * yres - yres + y); return constrain(led, 0, NUM_LEDS); }

Anonymous user

2 years ago

Can you share a video showing its work?

Anonymous user

2 years ago

This work amazing! However, I have to bypass C1, C2, R1, R2, and R4 to get the matrix to display any consistent results. This project is pretty far outside of my realm of tinkering, so I can't really weigh in on how or why, but I wanted to share this. I tried multiple audio sources with varying volumes. Any thought on this? Should I finish the final assembly while bypassing the aforementioned components? Thanks for making this, definitely made for a fun project for me and my kids! -dan

Anonymous user

2 years ago

Hi! I put everything together as specified and the hardware works very well. Both buttons work, the input sensitivity is very good. Likewise the separation of the individual frequencies. So far so good or bad.... Unfortunately, the alignment of my LED matrix does not match. The first 4 columns are arranged one after the other in row 1, in row 2 then columns 5-8, in row 3 the columns 9-12 etc. The columns are not columns but 1/4 row. In addition, every two columns (for example 2+2 lying in row 1) are mirrored (the impulses move towards each other). I've searched the code for 5 hours and swapped X + Y, made 32x8 lines 8x32 lines and a lot more. Unfortunately, I can't get any further and I need your help !! PS: I think i use a TOP LEFT (not right) horizontal serpentine arrangement, but I'm not shure. This code works, but all Colums are mirrored: int GetLedFromMatrix(int x, int y) { int led; if (y & 0x01) { //odd columns increase backwards led = xres*(y+1)-x-1; } else { //even columns increase normally led = x+xres*(y); } return constrain(led, 0, NUM_LEDS); } So it must be modiefied to mirror it from right to left. But I still don't know how....

Anonymous user

2 years ago

Hi Janux thanks for your project working fine, for now i try to change value #define xres 32 #define yres 8 i want to make a bigger display with some ws2812b led strip, instead of standard 8x32 panel for xres 32 i can't change 32 for 64 not working for yres i can put 12 instead of 8 .... is it possible to put like 16 or 18??? Thanks again and also thanks for your great project Regards!!!!! Daniel....

Anonymous user

3 years ago

Can you share a video showing its work?

Anonymous user

3 years ago

Thanks for the inspiration to use FHT janux. I made some changes implementing my own version of a 32 band music visualizer. You find the complete source code at my blog: https://emumannen.blogspot.com/2021/09/arduino-goes-to-town-part-5.html

Anonymous user

2 years ago

Hello, I read the project on your blog. I am very new to Arduino. Can you write me your e-mail address so that I can ask a question?

janux

2 years ago

WOW very very very nice! You did an amazing job! Unfortunately I don't have a lot of time to devote to the mechanical construction and basically this project was born to experiment with Arduino and with LED matrices rather than to create a real living room device like you did. A really great job, congratulations!

Anonymous user

3 years ago

hi, can i change the number of columns from 32 to 18, 20, 22 or 24? And does the number of rows change from 8 to 10?. What do I have to do to change it and does it have any effect?

Anonymous user

4 years ago

Thank you janux for this excellent project and documentation. This was a goldmine and a good starting point for my jukebox development: https://www.thingiverse.com/thing:4810229. I added dynamic input adjustment by changing line 146 _fht_input[i] = value / 8;_ to _fht_input[i] = value >> fhtDivisor;_, where fhtDivisor is controlled by the mean amplitude on the input.

Anonymous user

4 years ago

This project is great. Thank you for putting this out there. The matrix I bought was a bit different so I had to modify the code similar to one of the other commenters. I'm wondering if there is a way to constrain the frequencies it displays say to a max of like 10khz and a low of maybe 300hz. I've been looking over the code and I just don't see where to do it. Also can you explain what the EQ does?

Anonymous user

4 years ago

Hi! I put everything together as specified and the hardware works very well. Both buttons work, the input sensitivity is very good. Likewise the separation of the individual frequencies. So far so good or bad.... Unfortunately, the alignment of my LED matrix does not match. The first 4 columns are arranged one after the other in row 1, in row 2 then columns 5-8, in row 3 the columns 9-12 etc. The columns are not columns but 1/4 row. In addition, every two columns (for example 2+2 lying in row 1) are mirrored (the impulses move towards each other). I've searched the code for 5 hours and swapped X + Y, made 32x8 lines 8x32 lines and a lot more. Unfortunately, I can't get any further and I need your help !! PS: I think i use a TOP LEFT (not right) horizontal serpentine arrangement, but I'm not shure. This code works, but all Colums are mirrored: int GetLedFromMatrix(int x, int y) { int led; if (y & 0x01) { //odd columns increase backwards led = xres*(y+1)-x-1; } else { //even columns increase normally led = x+xres*(y); } return constrain(led, 0, NUM_LEDS); } So it must be modiefied to mirror it from right to left. But I still don't know how....

Anonymous user

4 years ago

Hi! I’ve been trying to recreate your project. I’ve got a long neopixel matrix set up. It’s 31 wide and 14 tall. The pattern is horizontal serpentine, starting in the bottom left (oops). I know that’s the opposite starting point of your code but if we can get it working while reversed then I can fix that in code. I’ve got the hardware side connected and have some level of progress, but it’s not working properly. To preface, I have tested the hardware as best I can. All the neopixels can be controlled by the pro micro, and aref is at approximately 2.8 volts. If I have an Xres of 31 and yres of 14, no LEDs activate at all. Not one. If I do a yres of 13, it appears some random LEDs activate it when I turn on the device, then I get what appears to be some kind of spectrum analyzer, but the lines are horizontal and appear to be in random locations. If I set Xres to 14 and Yres to 31, then I get a somewhat functioning spectrum analyzer, but it’s sideways. If I then (while keeping the flipped x and y resolution setting) go to the getLEDfromMatrix function and reverse the x and y inputs so it’s (byte y, byte x) then I get half of my LEDs lighting up with a vertically inverted spectrum analyzer. The bars come from the top, and only the left half of my matrix is activated. Please can you shed some light on any of these issues? I don’t understand your code well enough to diagnose further. Thanks, Trek.

Anonymous user

2 years ago

FYI, if anyone finds this comment and has a similar issue, I rewrote the GetLedFromMatrix function as follows: //================================================================ // Calculate a led number by x,y coordinates // valid for WS2812B with serpentine layout placed in horizzontal // and zero led at bottom LEFT!!(DIN connector on the LEFT side) // input value: x= 0 to xres-1 , y= 0 to yres-1 // return a led number from 0 to NUM_LED //================================================================ int GetLedFromMatrix(int x, int y) { int led; if (y & 0x01) { //odd columns increase backwards led = xres*(y+1)-x-1; } else { //even columns increase normally led = x+xres*(y); } return constrain(led, 0, NUM_LEDS); } //================================================================ This is for a bottom left horizontal serpentine arrangement. However I had to disable the button functions as they crash my arduino, still debugging. Also all of my audio is crammed over on the left side for some reason.

dannardini

4 years ago

This work amazing! However, I have to bypass C1, C2, R1, R2, and R4 to get the matrix to display any consistent results. This project is pretty far outside of my realm of tinkering, so I can't really weigh in on how or why, but I wanted to share this. I tried multiple audio sources with varying volumes. Any thought on this? Should I finish the final assembly while bypassing the aforementioned components? Thanks for making this, definitely made for a fun project for me and my kids! -dan

Anonymous user

4 years ago

Can i use the program with vertical led strips? If so, what i have to change in the code?

Anonymous user

2 years ago

Hi, had the same quetsion here. I solved it! There are just a few things you need to change, but i guess it still depends on how you matrix is build... (My Matrix starts from the left side with serpentine layout placed in vertical) Change the existing definition of GetLedFromMatrix with this one: int GetLedFromMatrix(byte x, byte y) { int led; led = ((x + 1) * yres - yres + y); return constrain(led, 0, NUM_LEDS); }

Anonymous user

2 years ago

Hi schumbert, could you give me some more details of everything that was changed? I accidentally put mine starting in the bottom right corner, with serpentine placed in vertical. I have been looking for a while and cannot figure it out. I tried putting the code you recommended into my project and instead of the analyzer displaying bottom to top, it is coming out from both the left and right side. Hopefully you are still able to help me. Thanks!

Anonymous user

4 years ago

the three columns that work are the first three columns starting from the IN input. the brightness and color change also works.

Anonymous user

4 years ago

Hi I found an FHT library somewhere. now it starts to work only with arduino UNO. the problem is that only three columns are displayed but they work perfectly following the rhythm of the music. now this is due to bad FHT library? I don't think since your previous vmeter worked like that (the one with FFT) always and only with arduino UNO. could it depend on the fact that I use arduino NANO with ATMEGA 128? now for the three column problem I use a 5V 5A power supply so I don't think that's that. do you have any idea? Mauro

Anonymous user

4 years ago

Hi the FHT library cannot be installed. in none of the three ways arduino says there are no valid files, advice? i had tried to load your previous vmeter the one with FFT, only the first three columns work but with arduino uno. the power supply delivers 5A.

Anonymous user

4 years ago

Hi I double checked everything, everything regular measured 2.8V. from your link you are unable to download the library. I went directly to the site and downloaded the .zip file. from the attachments at the bottom (the FHT one). i tried to load the library in arduino, without success. i tried to install directly from zip file but for arduino there are no valid files. in the zip I saw that there is an FHT folder and inside there is the FHT.H file. I will try to install it by hand.

Anonymous user

4 years ago

hi i am using an arduino nano v.3 with atmega 128, while i see that you are using an arduino nano v.3.1 with atmega 328. with v.3 it compiles and loads correctly. What is strange is that I tried the two versions of the program, the one with FFT and the one with FHT since the only hardware difference is the non-use of D10 but nothing works. Mauro

janux

2 years ago

Hi Mauro, sorry if I answer you very late. The voltages are quite correct, but I suggest you still check the connections and especially the values of the resistors by measuring them with a hommeter because the VREF is better to be accurate. Arduino works great even with 4.2 Volts so I suggest you leave the diode where it is. 0.8V voltage drop seems to me too much for a silicon diode, did you connect the 1000µF capacitor? Are you powering everything with a power supply capable of supplying at least 1 or 2 Amps? You are probably using the wrong library, below you will find the link to the OpenMusicLab site from which to download the correct one. The file is called "ArduinoFHT.zip" about 25Kb. http://wiki.openmusiclabs.com/wiki/ArduinoFHT?action=AttachFile&do=get&target=ArduinoFHT.zip

Anonymous user

4 years ago

hi I mounted the circuit on the proto board and double-checked the wiring three times, but it doesn't work, the LED matrix does not light up at all. since I had 3.05V on VREF I took the R3 from 4K7 to 10K and now on VREF I have 2.8V. the voltage after the diode 4001 and 4.2V but passing the diode does not change anything. I doubt that the two libraries I found FHT and NEOPIXEL are not working well. on pin A0 with the oscilloscope there is a signal of 0.05V amplitude, on D6 nothing. on the two 100NF capacitors I send the headphone output of a radio. if you think the problem is the libraries can't you attach them to the project? Thanks for your help. Mauro

macximo204

4 years ago

But , inspired by the original project of Shajeeb can be added displaymode ? or can someone help me to implement this function? or put the peack function it would be something more that would be very nice

janux

2 years ago

Hi macximo204, the original version of Shajeeb was based on the MAX72xx led matrix this has specific commands to drive rows and columns. Implementing these functions via code is not easy and at the end of the game there is the possibility that the code is too long to fit in Arduino's memory. I leave the thankless task of trying to others. Bye

Anonymous user

4 years ago

Hello, verry nice projeckt !! i have a question how can i set which colum show which frequency when i have only 7 colums for example and i like to show 100Hz 200Hz 300Hz.... or something other and what exactly do this " #define FHT_N 128 " ?

janux

2 years ago

Hi gusemugisch, Define FHT_N 128, defines (as the name implies) the number of samples that will be used by the sampling process. After each sampling cycle the FHT library returns, in this case, 64 values (FHT_N/2) obtained from the sampling and saves them in the fht_input[ ] array. But since we only have 32 columns (64/2), the samples are added two by two, so as not to lose information. 7 columns is a strange number, usually led arrays are multiples of 2, however, with so few columns you would have to change all the sampling and arrangement code. I suggest you look for a project designed for a smaller matrix, there are several around, search on youtube. Bye

Anonymous user

4 years ago

hi is it possible to add other matrix to make a 16X32 display instead of 8x32? what changes need to be made to the code? I would like to control arduino with a microphone maybe amplified, in the wiring diagram. can I do this? I delete on trs1un channel, I delete C1 and R1, instead of R2 I put a 10K trimmer. it's right? I don't see in the code where you tell arduino that the signal enters on pin A0. goodbye

janux

2 years ago

Hi Mauro, Just change #define yres 8 to #define yres 16, that's it. The two pairs R1-C1 and R2-C2 are intended to avoid putting the left and right audio channels directly in parallel and avoid losing the stereo effect in the audio source. If you remove R1 and C1 the circuit uses the audio information from only one channel, there will be no problem but the represented audio spectrum will be incomplete. A trimmer instead of R2 only changes the input impedance, if you want to add an input volume adjustment you can insert a 0.1 µF capacitor and a 50K trimmer between the jack and C2. Connect the signal from the jack to one side of the new capacitor, the other side of this capacitor to one side of the trimmer, the other side of the trimmer to ground and the central pin to the side of C2 that in the diagram is connected to the jack. Analog input A0 is set by the instruction: ADMUX = 0b00000000 If you want to read up on the use of ADC registers you can visit this page http://microelex.blogspot.com/p/1.html

Anonymous user

2 years ago

If i use a 10K pot trimmer do I need a different cap value? Thanks,

Anonymous user

4 years ago

First, thanks for making this tutorial. I've followed your tutorial except some changes, I used 10kΩ resistors instead of 4.7kΩ , no buttons and Arduino Mega. It's working but I can see that the first 2 rows are more "concentrated", music mainly being there. Is it because of the FHT library ?

Anonymous user

2 years ago

I've changed the 10KΩ resistors by adding another 10KΩ in parallel like you suggested. Now the voltage between AREF to ground is 2.77V. Wasn't the case previously. On PC audio line it looks much better I guess it's like you said, a problem of amplitude. I have LM386 lying around but not sure I will use it as it's not rail to rail, I also have MCP6002 which I might use instead. By the way, why you do this in the code: fht_input[i] = value / 8; // copy to fht input array after compressing I didn't see this in the example library you are using.

janux

2 years ago

Resistance R3 is critical and must be around 5K, it is calculated to supply the AREF Pin from the internal 3.3V of Arduino, with very different values the sampling works badly. Measure the voltage on the AREF Pin, there must be approximately 2.75 Volts. Use two 10K in parallel. If you cannot get all the LEDs on but only the first two at the bottom of each column, it means that the input signal has a too low level, use the values suggested for R1 and R2. Try connecting the circuit to your computer's audio output so you can test it by turning up the volume. If you cannot increase the amplitude of the input signal in any other way you can try using a small additional 5 Volt powered amplifier such as those based on the LM386 that you find on Amazon.

janux

2 years ago

The division by 8 is not essential, it has the purpose of compressing the amplitude of the sampled signal, subsequently in the code this is further reduced to adapt the sampled peaks to a scale from 0 to 7 (for matrices with 8 LEDs per column). You can experiment by changing the value from 8 using multiples of 2 if you have signal amplitude problems. You don't find this in the examples of the FHT library because those are generic and have one purpose: to illustrate the functions of the library. The use of the data obtained after sampling must be adapted to the purpose of the specific project. Personally to solve this problem in some cases I used one of these (I bought 5 for 10 € on Amazon). https://www.amazon.it/gp/product/B07WRS76K2/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1 Even if they are equipped with a trimmer to adjust the volume and we apply a high impedance load to the output, in some cases the output signal may still be too wide. However to reduce the gain from 200 to 20 just remove the resistance named R1 or the capacitor named C1 (they are in series) with a touch of the soldering iron. Hello