0% found this document useful (0 votes)
126 views

Arduino DDS Sinewave Generator

This document describes how to generate sine waves using an Arduino board and the direct digital synthesis (DDS) method. The DDS method uses an accumulator, tuning word, sine wave table stored as constants, a digital-to-analog converter via PWM, and a reference clock from a timer to generate frequencies from 0-16kHz with high resolution. Software implements the DDS algorithm to output signals from an analog pin. Results show the output can generate clean sine waves up to 3kHz with distortions below 1% according to analysis from an oscilloscope and spectrogram. Additional circuits like a lowpass filter can be used to remove sampling frequencies from the output.

Uploaded by

Santiago Cordero
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

Arduino DDS Sinewave Generator

This document describes how to generate sine waves using an Arduino board and the direct digital synthesis (DDS) method. The DDS method uses an accumulator, tuning word, sine wave table stored as constants, a digital-to-analog converter via PWM, and a reference clock from a timer to generate frequencies from 0-16kHz with high resolution. Software implements the DDS algorithm to output signals from an analog pin. Results show the output can generate clean sine waves up to 3kHz with distortions below 1% according to analysis from an oscilloscope and spectrogram. Additional circuits like a lowpass filter can be used to remove sampling frequencies from the output.

Uploaded by

Santiago Cordero
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Arduino DDS Sinewave Generator

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. This article published by
Analog Devices is one of many good references.

MT-085: Fundamentals of Direct Digital Synthesis (DDS)

 
Software implementation

To run this software on an Arduino Diecimila or Duemilenove connect a potentiometer


to  +5Volt and Ground and the wiper to analog 0. The frequency appears on pin 11
where you can connect active speakers or an output filter described later.

AQUI VA EL PROGRAMA EN C, QUE ESTA EN EL ARCHIVO .TXT

Results

In the upper part of the picture you see  PWM signal on pin 11 and in the lower part
what the filter makes out of it. The sinewave looks not so clean but thats mainly the
limited resolution  of the digital oscilloscope.

The spectrogram shows a surprisingly good result. The big peak is the output frequency
of about 1000 Hz. All unwanted distortions are below 50 dB which is roughly what we
expect from a signal what is generated by an 8-bit DAC. ( 1/256 = 48dB).

 
DDS Spreadsheet

dds_calc A little worksheet around the DDS formula to calculate the tuning word.

PWM Output lowpass Filter

For a start you can just connect the output pin 11 to active speakers. But usually you
need lowpass filter is to get rid of the 32KHz sampling frequency in the output signal. A
Chebyshef lowpass with a cutoff at 12 KHz build with standard component values is
shown here.

PWM DDS dedicated Hardware

This software implementation of DDS has of course several drawbacks in case of signal
purity and frequency range due to the limited speed of the software algorithm and
analog capabilities of the atmega chip. DDS modules which are using dedicated DDS
chips are the state of the art in signal generation and offer a frequency coverage from
zero up into the 100MHz range.

WSPR Application

WSPR “Weak Signal Propagation Reporter” pronounced Whisper is a system which


reports the propagation of very weak radio signals over the world. The DDS Method
was used here to generate a tone sequence where four frequencies (1497,8 1499,3
1500,7 1502,2 Hz) are used code a message in a very robust manner. This message is
transmitted with a low power radio beacon and can be observed worldwide via
wspr.net .

wspr_beacon_dds_dcf_f4

 
 

Forum

Further questions to this topic can be discussed here:

Arduino Forum :: Using Arduino :: Audio :: Arduino DDS Sinewave Generator

http://arduino.cc/forum/index.php/topic,64217.0.html

Contact

Martin Nawrath, nawrath@khm.de

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy