Go Down

Topic: Help using ArduinoFFT (Read 4604 times) previous topic - next topic

Arvis

Thanks a lot, it seems to work!
Only thing is that I probably described it a bit wrong. There's one line with OK brightness but others are dimmer, but now at least all lines are the same brightness (but dimmer than before using FHT). But I guess it should work afterwards, I've calculated resistors for 12V supply for LEDs while currently I use only 5V.

Quote

it looks like the way you set how long an LED is on for, is by the amount of time it takes to run 8 clock() functions.

Aren't LEDs on while the latch pin is HIGH? From this I understand it like they would be on when latch is LOW (when i call clock() functions)

Quote
is because it also has to run the fht() function, so it takes much longer

I thought this would only add more delay after drawing the whole matrix - LEDs would only be off for longer...

Also, do I really need this:
Code: [Select]

TIMSK0 = 0; // turn off timer0 for lower jitter


and do I need while(1) loop in the loop() function? (I have commented it out right now)

And one last thing:
If I use #define FHT_N 64, I assume I'll get 32 amplitudes (I need only 20), what would be the resolution of each amplitude? (Like it was 150hz before, I guess it would be larger now)

g_u_e_s_t

you set the latch low, do 8 clock() functions, then set latch high, and the LEDs light.  now, that particular LED pattern stays lit until you run the next set of 8 clock functions, and toggle the latch line again.  so each LED pattern is on for the amount of time it takes to shift the next pattern out.  this is why the fht() function call makes the last line so much brighter, because it takes so much longer to get to the next latch line toggle.

if you reduce your LED resistor values, it should be fine.  the LEDs are on for such a small amount of time, you can go above the reccomended 20mA if you want, as the average current will be much less than 20mA.

the TIMSK0, while(1), cli() and sei() stuff is not necessary, it just makes things run faster.  if you plan on using delay() or millis(), you need to get rid of TIMSK0 anyways.

Arvis

Yep, I noticed delays don't work with that thing.
Thanks again for explaining everything. :)

g_u_e_s_t

oh yeah, the new frequency bin size will be:

16MHz/32/13/64 = 600Hz

basically 4x what it was for 256 (256 = 4x 64)

Arvis

Yeah, some simple maths, thanks  :smiley-mr-green:

Go Up