Posted on Wednesday, May 25, 2011 • Category: Arduino
Arduino Sine wave Generator using the direct digital synthesis Method.
Here we describe how to generate sine waves with an Arduino board in a very accurate way. Almost no additional hardware is required. The frequency range reaches form zero to 16 KHz with a resolution of a millionth part of one Hertz! Distortions can be kept less than one percent on frequencies up to 3 KHz. This technique is not only useful for music and sound generation another range of application is test equipment or measurement instrumentation. Also in telecommunication the DDS Method is useful for instance in frequency of phase modulation (FSK PSK).
The DDS Method (digital direct synthesis).
To implement the DDS Method in software we need four components. An accumulator and a tuning word which are in our case just two long integer variables, a sinewave table as a list of numerical values of one sine period stored as constants, a digital analog converter which is provided by the PWM (analogWrite) unit, and a reference clock derived by a internal hardware timer in the atmega. To the accumulator , the tuning word is added, the most significant byte of the accu is taken as address of the sinetable where the value is fetched and outputted as analog value bye the PWM unit. The whole process is cycle timed by an interrupt process which acts as the reference clock. Further details of the DDS Method are described in web of course.
Circuit-Zone.com © 2017. All Rights Reserved.