Running FHT library on the Digispark ATTiny85

Yes but somehow the FHT decides how to distribute the output buckets by frequency. I can't see how it's doing that unless it's detecting the sampling rate somehow. One of the first questions I ever asked about this library was how to set the frequency buckets to your choosing (22 khz split into 128 buckets for example) and very few people knew the answer to that. Eventually it was revealed that there's no setting for it and it's automatically adjusted to the highest frequency you're sampling at. Therefore changing the ADC prescalar was enough to recalibrate the frequency buckets. However the biggest prescalar doesn't get you down to the vicinity of 30 or so hz so you'd have to introduce your own delay to get that resolution but my question is whether this is a valid working method of getting that output of 0.5 Hz per bucket. I can't see how simply presenting an array of integers to the FHT function in any way tells it what frequency you sampled it at. That's why I'm curious how the guts of the function work and how they're able to calibrate the output to the frequency range of the input.

The library knows nothing about sampling or sampling rates. It merely transforms the data from the time domain to the frequency domain.

You interpret the output data array in terms of the number of samples and sampling rate that you choose.

This discussion of FFT length versus frequency resolution might be helpful. Google will show you many more.

The FHT library (in this case) defines the array as 128 units large... it can only contain 128 data points before you perform the FHT calculation. The link you provided suggests that in order to change the resolution of the FHT bins you have to collect more samples but I can't actually do that here. So how would I "choose" these parameters. If you could provide a code snippet demonstrating how to change the bin resolution from say 10khz split into 64 pieces to 1 khz split into 64 pieces (because the output array is 64 units long), that would really be helpful.

You choose the sample size by setting FHT_N. Allowable values are 16, 32, 64, 128, 256.

You choose the sample interval or frequency.

The combination sets the output frequency bin size as described in the link posted in reply #21.

Keep in mind that the FHT results may be uninterpretable, if frequencies higher than (sample frequency)/2 are allowed to reach the analog input.

Ok I think I get what you're saying (though it seems a little bit like magic but perhaps that's just how the math works).

I still think you can't change the number of bins for the tiny (I know you can for the generic flavor that works on the mega). So if I'm stuck with 64 bins and want 0.5Hz resolution I need to sample at 64 Hz. 64/2 is 32 and 32/bins is 0.5Hz so that's how I could achieve the resolution I want. Only way I can think to sample at 64 Hz is by introducing a delay of some sort. Hopefully this does the trick. The other thing is I'm going to need some pretty big capacitors to cut out all frequencies above 64 Hz to prevent harmonics from getting into the data. That'll suck since I'm working with a small packaging space. Oh well, gotta roll with the punches. Thanks for explaining this.

I doubt that you are correct about being "stuck" at a sample size of 64.

Yes, use a delay between samples to set the sample frequency.

If the sample frequency is 64 Hz, your input low pass filter must exclude all signals with frequency above 32 Hz.