Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 29

Thread: Is it possible to have a high resolution FFT.

  1. #1
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17

    Is it possible to have a high resolution FFT.

    I am wondering if there is a way to get a high resolution FFT with the teensy. I am trying to find tones that are only 15 or so hz apart.

  2. #2
    FFT frequency resolution depends on sample rate and number of samples. More samples gives higher resolution.

  3. #3
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    This I understand but I was asking if the teensy had any build-in FFT that was of a higher resolution because its existing library only has as high as fft1024.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,476
    Maybe this can help?

    https://forum.pjrc.com/threads/42221...-on-Teensy-3-6

    But if your signal isn't perfectly phase sync'd to the FFT's 4096 samples (which pretty much never happens except when you generate test signals and then analyze them after they've gone through analog circuits and come back in), you still need a window scaling to avoid the FFT's spectral leakage problems. Different window shapes have slightly different properties, but they all end up smearing the bins. That's an unavoidable outcome to use FFT for signals that aren't perfectly phase synchronous with the FFT's window.

    Also consider 4096 points is nearly 1/10th of a second. If you're analyzing music or other natural sounds, consider whether the tone you want remain a consistent frequency for the FFT's entire 4096 points. Or if not all 4096, at least most of them in the middle that the window scaling allows to strong affect the results.

    For many uses where you just want to detect the fundamental frequency of a complex sound, the NoteFreq (YIN algorithm) analysis gives better results.

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,570
    Quote Originally Posted by kd9kck View Post
    I am wondering if there is a way to get a high resolution FFT with the teensy. I am trying to find tones that are only 15 or so hz apart.
    at which frequency?
    How many tones?
    there are different signal processing options that allow you to do that.

  6. #6
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    I am trying to get what frequency exists in an area from around 0hz to 2000Hz. Specifically I am trying to get the audio from my laptop from WSJT-X set to FT8 to drive an SI5351 for usage on the HF Bands.


    Tone spacing is specifically 6.25 Hz.
    And a delay between changing freqs of 159ms.

    Now that I think of it I am not sure a Teensy is even up to this task.


    I might be able to calculate the frequency of the tone but that locks my into specific freq in FT8. (Which would be fine, I think.)


    Also its annoying to not be able to log on or use this form while on campus at my college. Seems their whole block of public IPv4 Address they hand out devices on campus is IP banned here.

  7. #7
    You still haven't mentioned a sample rate. Assuming it is far above Nyquist you can decimate the data to reduce the sample rate. (Low pass filter to remove frequencies above the new Nyquist frequency first!)

    If that isn't enough, translate the frequency of interest to a lower frequency so you can use an even lower sample rate.

  8. #8
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,570
    Also, FT8 uses only 8 frequencies, so you may consider 8 DFT's with proper designed window length and variable base frequency.

  9. #9
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    Not sure what sample rate I will being using because I can't seem to find sampling rate information in the docs for AudioInputAnalog or AudioInputUSB.

    I am going to take a random guess at the sample rate being around 44100hz as that is the normal-ish sampling rate of PC sound cards.

    Also I am not sure how translating the frequency would help, its already between 0 Hz and 2Khz.

    Currently I have no code and also need to figure out where my Teensy went. (Somehow lost it while a USB cable was even plugged into it.)

    Yes I am aware FT8 uses only 8 frequencies also having a variable base frequency wouldn't help unless I could send that base frequency to the Teensy to update it. (I could try that possibly.)

  10. #10
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,570
    Quote Originally Posted by kd9kck View Post
    Not sure what sample rate I will being using because I can't seem to find sampling rate information in the docs for AudioInputAnalog or AudioInputUSB.
    yes the audiocard uses 44.1 kHz, but I would nobody prohibits to add your own custom modules. However YMMV.

    In principle you could do: find and decode all FT8 signals in passband. (I guess original SW does this)

  11. #11
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    551
    A great idea to perform FT8 decoding on the Teensy!

    Would love to see that! However, as far as I can see, this is not a particularly easy task, but I found some code on github, which looks rather mature and it should be possible to port to the Teensy, at least the T4 should have the memory and horsepower to do this:

    https://github.com/chillmf/STM32F769-FT8-Transceiver

    https://github.com/kgoba/ft8_lib

  12. #12
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,249
    FWIW - WSJTX uses a sampling frequency of 12000Hz when generating and decoding FT8 messages and the tone spacing is 6.25Hz - not 15Hz. The default sampling frequency of the audio board is 44100Hz but you can set it to other rates such as 12000Hz, or 8000Hz.

    Are you trying/hoping to decode FT8 on a teensy?

    Pete

  13. #13
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    I am hoping to just convert the audio from my computer to a RF signal using a SI5351 and some filtering. (Because harmonics are bad.)

    I can receive on 40m and 20m with my RTLSDR and wanted to finally get into HF with out having to spend alot of money on a base rig. (Been General for almost a year and I still have not done any HF.)

  14. #14
    Quote Originally Posted by kd9kck View Post
    (Been General for almost a year and I still have not done any HF.)

    There are fairly cheap ways to get into HF. https://www.hfsignals.com/

    Which is probably what I would do if I ever bothered to take the General test. Or perhaps even before since Tech does let me do some things on HF.

  15. #15
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    I was thinking of getting one of those eventually but right now its not very economical for me. Only have a part time job and i am in college. I have two Si5351 and a 40m band pass filter. I also have a Teensy and way to many ESP32s. (I should figure out how to port Teensys great audio libraries to it sometime for fun.)

    The ubitx is $160 shipped. Which is over a 1/4 of my two week paycheck.

    I am only on VHF and UHF because I already had the radios. (My dad and mom are hams.)

  16. #16
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    I am going to attempt to use FreqMeasure and mess around a bit and see how that goes.

  17. #17
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    As an update I had to order a new teensy because the one I had for this project disappeared. USPS says it should be delivered on Saturday. I have silly question. Is it be better to use the Arduino IDE with the changes to it or to just use VS Code with PlatformIO that I use for all my other microcontrollers (Arduino,ESP32)?

  18. #18
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    Okay So I did an experiment using the existing example for FreqMeasure. It appears that even with a 200hz signal from an audio jack. (Made sure to be 3.3 volts.) it can't find the freq very well at all.

  19. #19
    Use the existing 1024 point FFT on the 2KHz bandwidth data to find the 50Hz band of interest. Then perform a frequency shift (like an analog mixer) to move that down closer to DC. Perhaps centered on 100Hz. Then decimate to reduce the sample rate.

    FFT frequency resolution is fs/N so 1,000SPS would get you 1Hz resolution.

  20. #20
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    Okay. I will have to figure out how to write a decimate function because there is none built into the teensy audio library itself.

  21. #21
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,249
    For code to do decimation, see this post by DerekR.

    Pete

  22. #22
    Junior Member
    Join Date
    Dec 2019
    Location
    Bristol, UK.
    Posts
    3
    Quote Originally Posted by kd9kck View Post
    I have silly question. Is it be better to use the Arduino IDE with the changes to it or to just use VS Code with PlatformIO that I use for all my other microcontrollers (Arduino,ESP32)?
    Platformio with VS Code works well, but you first still have to add Teensyduino to the Arduino IDE to get it to work. Once you’ve got Arduino+Teensyduino to work okay, then you should be okay to run from within Platformio.

  23. #23
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    Thank you everyone so far for all the help. I will be working on some code to share over the next few days. (Mostly tomorrow.)

    I might also use this project as a starting point for making a WSPR decoder. (Way easier to decode that then FT8) As currently this project is to run a SI5351 off the audio output of my computer.

  24. #24
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,249
    to run a SI5351 off the audio output of my computer.
    Can you explain this in more detail? How does the audio output affect the clock generator?

    Pete

  25. #25
    Junior Member
    Join Date
    Feb 2020
    Location
    Chicago,IL
    Posts
    17
    I am going to listen to audio from my laptop. (From WSJT-X)

    While WSJT-X is transmitting will be the audio representation of the FT-8 (or other mode) signal that would normally go into a Single Side Band transmitter. This audio basically generates a FSK signal out from the transmitter. Where the frequency of the audio is about (slight offset) how far it is away from the tuned frequency of the radio.

    I plan on trying to get the dominate frequency during theses times from the audio to run a Si5351 instead of a full radio. Where the Teensy will have a base frequency that it then adds the audio frequency to. This new frequency is then what is used to tune the Si5351.

    I hope I am making sense. Quite often I find that I am not good at explaining things to people because I start rambling on about stuff.

    William Gaylord, KD9KCK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •