Hello,
I am trying to get the FHT converted to frequency. I saw that the formula was k*(samples/FHT_N) but I can't seem to get what I want...
1. Does k need to be unsigned? I am getting negative values when ever I try to print it out to the serial monitor.
2. How do you find out what the sampling rate is? I have read that you need to look at the prescalar but I am not sure what that is.
I am just trying to write a high on a digital pin when a certain frequency is present. Any help will be appreciated!
Also, will I need to set a magnitude threshold somehow? I only want the high on the digital pin when there is an intentional sound.
(I just realized that I did not bias the signal so that maybe a cause for off numbers.)
- It is currently Sat Jan 28, 2023 10:12 pm • All times are UTC - 8 hours [ DST ]
FHT to frequency
Moderator: guest
Forum rules
Due to heavy spam, new user registration has been disabled. Hundreds of posts from this sub-forum were accidentally lost in the pruning process.
Due to heavy spam, new user registration has been disabled. Hundreds of posts from this sub-forum were accidentally lost in the pruning process.
10 posts
• Page 1 of 1
Re: FHT to frequency
so to figure out which bin relates to what frequency, you need to know the sample rate. if you are using the default example from the library, that is 38kHz.
Frequency(k) = (k)*(sample_rate)/(FHT_N)
k is just the bin number.
if you want a pin to go high based on a certain frequency, just figure out which bin that is, and then check the value in that bin compared to a threshold, and set the pin high if its above the threshold
Frequency(k) = (k)*(sample_rate)/(FHT_N)
k is just the bin number.
if you want a pin to go high based on a certain frequency, just figure out which bin that is, and then check the value in that bin compared to a threshold, and set the pin high if its above the threshold
- guest
- Site Admin
- Posts: 449
- Joined: Thu May 20, 2010 11:58 pm
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests