a31cf8db96
And create the still unused Hardware folder |
||
---|---|---|
Firmware | ||
.gitignore | ||
README.md |
README.md
Teensy 3.5 DDS Function Generator
Using a Teensy 3.5 and the integrated DAC to generate arbitrary periodic waveforms
How it works
The Teensy 3.5 is a powerful Arduino-compatible microcontroller running an ARM Cortex-M4 at 120 MHz
For the purpose of this project, it has been overclocked to 168MHz, running with the Fastest Pure Code+LTO optimizer
It has two integrated DACs whose output can vary between 0v and 3.3V
Using classical techniques from DDS (Direct Digital Synthesis) the Teensy can become a fully functional function generator
In particular, the technique used here is the classic Phase Accumulator, together with a Lookup Table. This allows to precompute arbitrary periodic waveforms and then output them at the wanted frequency.
Square waves of variable duty cycles can be generated by simply toggling a digital pin high and low and the correct time
Despite both sine and square wave being output by the teensy are quite clean and seem to have low noise and spurs levels at naked eye, advanced filtering techniques, like Chebyshev, Butterworth or Bessel filters with multiple stages are required.
The desired waveform, frequency and duty cycle can be selected using the I2C LCD Display and an incremental encoder with pushbutton
Amplification and offset
Sill WIP
Filters
Still WIP
Credits
A lot of choices come from following this Degree dissertation paper (Direct Digital Synthesizers: Theory, Design and Applications by Jouko Vankka, Helsinki University of Technology, November 2000): http://lib.tkk.fi/Diss/2000/isbn9512253186/isbn9512253186.pdf
Analog Devices offers a lot of cool guides and papers about DDS, this is one of them: https://www.analog.com/media/en/training-seminars/design-handbooks/Technical-Tutorial-DDS/Section8.pdf
The website ZipCPU offers a variety of articles about sine wave generation using FPGAs
- https://zipcpu.com/dsp/2017/08/26/quarterwave.html
- https://zipcpu.com/dsp/2017/07/11/simplest-sinewave-generator.html
Stackoverflow and the rest of the internet of course
- https://stackoverflow.com/questions/13466623/how-to-look-up-sine-of-different-frequencies-from-a-fixed-sized-lookup-table
- https://stackoverflow.com/questions/16889426/fm-synthesis-using-phase-accumulator
- https://electronics.stackexchange.com/questions/438935/how-to-calculate-sampling-rate-for-dac-from-its-data-sheet
- https://www.daycounter.com/Calculators/Sine-Generator-Calculator.phtml