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

Thread: Using Teensy 4.0 as a AD converter and possibly Fourier Transform-er

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    1

    Using Teensy 4.0 as a AD converter and possibly Fourier Transform-er

    A bit of context that might be helpful. I'm looking to replace a very old system that took analog light intensity information from an interferometer and gave out voltage values (which corresponded to the intensity values) and the time at which the measurement was found. This data then underwent a Fourier transform (FT) on an external computer. My goal is to replace this system with a Teensy 4.0 or Raspberry Pi 4 that potentially could perform the FT on the data, rather than just taking the data and doing the FT on a laptop. However it is not essential that the Raspberry Pi or Teensy perform the FT. The old system contains a 12 bits AD converter with a linearity of 10 bits and a max sampling frequency of 100 kHz. It would be great to match those numbers but as long as I can get 4096 samples with a sampling frequency of ~150 Hz I would be happy. I need to be able to FT at least 4096 points of data and suspect the Teensy 4.0 may not be able to handle that, but being able to FT the data is not essential, it would just be icing. I am aware the Teensy only has a 10 bits AD converter.

    To test which (Raspberry Pi 4 (with ADC chip) vs. Teensy 4.0) would be better for this I am reading a 1000 Hz sine wave (max peak-to-peak voltage of about 1-2 V) from a function generator with both the Raspberry Pi and the Teensy. My question is about how to get the data off of the Teensy onto my laptop. Do I have to use an SD card? I would like to see the live readout, Fourier transformed or not, on my laptop. Is that possible?

    As well, I am having trouble understanding which pin outs (I do not understand all the acronyms or their implications on the pin out diagram even with google) I can use for the analog input from the function generator and the digital output to my computer. Currently I have been thinking Pin 19 for the analog input and possibly Pin 2 for the digital output. Any guidance or tips would be very helpful. I can find a lot about using a Teensy as a function generator but not so much about using a Teensy to read an output from a function generator.

    I have been using this project as a very rough guide: https://learn.adafruit.com/fft-fun-w...ier-transforms

  2. #2
    Junior Member
    Join Date
    Nov 2020
    Posts
    2
    Dear Rabbit,

    .. how to get the data off of the Teensy onto my laptop. Do I have to use an SD card? I would like to see the live readout, Fourier transformed or not, on my laptop. Is that possible?
    If you use the Arduino IDE with the Teensyduino you can utilize the "Serial Monitor" to see the sampled analog data (and not only) on your computer.

    As well, I am having trouble understanding which pin outs (I do not understand all the acronyms or their implications on the pin out diagram even with google) I can use for the analog input from the function generator and the digital output to my computer.
    If you are not already familiar with the great library from this thread I strongly recommend you do so .
    On the first page there are pictures with the different boards (incl. Teensy 4) illustrating which pins can be used as analog inputs.
    In your case (pins 14-23 named also as A0-A9) an apparently these can be accessed by the both ADCs. Its your decision which one to use.

    Currently I have been thinking Pin 19 for the analog input and possibly Pin 2 for the digital output.
    Your initial choice of pins would do the job.

    For quick ref guide on how to use the library you can check the examples in it.
    For instance, in the Arduino IDE go to Examples-->ADC-->analogRead.

Posting Permissions

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