Project tutorial

Arduino Due Arbitrary Waveform Generator © GPL3+

Arbitrary waves can be drawn, edited, saved, opened and uploaded to the Due via USB, or the Due can run alone controlled by pots & switches.

  • 5,343 views
  • 30 comments
  • 14 respects

Components and supplies

About this project

General Description

Analogue wave max freq: 100kHz. Square wave max freq: 42MHz.

Duty cycle adjustable from virtually 0% to 100%

Very easy to build - see Installation below.

This is a two part project: The Arduino Due board itself, and a controller GUI to be used on your PC, although the Arduino board can also be used on its own using pots, switches and LEDs.

No circuitry is needed, although an optional output protection circuit is offered which should protect the Arduino board from accidentally connecting the outputs to voltages of up to plus and minus 30V or so. (perhaps more)

By using the controller GUI, arbitrary waves can be drawn, edited, saved, opened and uploaded to the Arduino Due, automatically connected via the USB port. A comprehensive help file is included.

A "stepped" wave feature allows any number of sharp (one sample) steps in the wave to be easily produced if desired. Additionally, the output can be switched to sinewave or triangle / sawtooth instead.

Also, a square wave is simultaneously produced which can be either synchronized or completely independent. The waves can be controlled by the frequency or period. The duty cycle can be set from virtually 0% to 100%. Or the pulse width can be set constant. (within the confines of the period, of course)

The new settings can be directly typed via the PC's keyboard or the program's keypad. Or, pressing "MODE" allows a sliding adjustment.

An Exact Mode is available for the analogue wave, which avoids the "frequency steps" normally associated with direct digital synthesis (DDS) waveform generators. This makes a more precise frequency possible by allowing access to frequencies in between those "frequency steps" because the output is not a division of the Arduino clock frequency when Exact Mode is on.

A (log) frequency sweep feature for either or both waves is included, and there is also a timer with positive or negative Arduino output.

Specifications

Analogue Wave:

Resolution is 12 bits with up to 4096 waypoints.

Freq range is: 0.05mHz (20,000 secs) to 100kHz.

Sample rate: (above 1kHz using DMA) Up to 1.6MHz.

Sample rate: (up to 1kHz) 400kHz.

Sample rate in Exact Mode: (any freq) 400kHz.

Minimum pulse width: (half wave cycle)

At 0% duty cycle: 350 nanosecs (approx.) at any freq.

At 0.01% duty cycle: Up to 2.5 - 25 microsecs. (approx.)

- if freq is over 1kHz AND Exact Mode or Sync is on,

- otherwise 350 nanosecs.

Square Wave:

Freq range is: 0.05mHz (20,000 secs) to 42MHz.

Minimum pulse width:

Synchronized: [Freq: 0.05mHz (20,000 secs) to 100kHz]

At 0% duty cycle: 48 nanoseconds at any freq.

At 0.01% duty cycle: 2.5 - 25 microsecs. (approx.)

Unsynchronized: [0.093mHz (10,737 secs) to 42MHz]

12nS from 1.3kHz to 42MHz. (Using PWM)

24nS from 650Hz to 1.29999kHz. (Using PWM)

48nS from 325Hz to 649.99999Hz. (Using PWM)

96nS from 163Hz to 324.99999Hz. (Using PWM)

Below 163Hz: (Using interrupt)

At 0% duty cycle: 96 nanoseconds.

At 0.01% duty cycle: 5 microseconds.

Installation

The GUI program is "portable" so does not need installing. Simply extract the .rar file into a folder of your choice and make a short-cut to the .exe file. Note: The "DueArbitraryWaveformGeneratorController64.rar" file is intended for 64 bit systems, but the 32.rar file often works more reliably anyway since it has java embedded.

The Arduino sketch needs no special libraries, so you only need the normal Arduino IDE installed on your PC for the purpose of uploading the sketch to the Due. Provided that your PC has recognized the Arduino Due, (which it must have done if the sketch was uploaded) the GUI program should automatically find and connect to the Arduino when starting, so there's no need to set the COM port. Manual COM port selection is enabled if automatic selection fails.

There are a few example wave files in the Arbitrary Waves folder (just for fun) to help you get started. As well as the GUI program, the Arduino waveform generator can also be controlled by Arduino's serial monitor set to 115200 baud. Type ? for help.

Or if you prefer to use pots, switches & LEDs for control, the start of the Arduino sketch lists the pin connections.

Wave output pin connections are also listed there, or simply connect Arduino pins 3 and 7 together with a link, or if you're ultra cautious use a low value resistor (47 - 100 ohms). Take the square wave output from pin 7 and the analogue output from DAC0.

Code

IMPORTANT: Don't click the "Download as zip" button.
To download the files click "Read More" below. NOTE: Clicking "Download as zip" will only download a readme file.

Schematics

OPTIONAL output protection circuitry
This circuitry can be completely omitted, but if used it should protect the Arduino against accidentally connecting the outputs to voltages of up to at least plus and minus 25V without significantly increasing rise and fall times. D2 and D3 need to be high current, fast recovery diodes - I found that schottky diodes were too slow. The fuses (F1 and F2) can be polyfuses.
Awg output protection 6umel2h6it

Comments

Similar projects you might like

A Microwave Interface for the IKEA Duktig Kids Kitchen

Project showcase by Myles Eftos

  • 1,183 views
  • 7 comments
  • 6 respects

Servo Signals and Characterization

by 3 developers

  • 807 views
  • 4 comments
  • 11 respects

Music Adaptive RGB LED with Arduino and Processing

Project in progress by ounane mohamed elfarouk

  • 956 views
  • 6 comments
  • 10 respects

Cellular IoT with Blynk & Hologram

by Moheeb Zara

  • 4,946 views
  • 9 comments
  • 18 respects

Monitoring Temperature Remotely with Blynk for Dummies

Project in progress by Cmtelesann

  • 1,180 views
  • 2 comments
  • 4 respects

How to Make a Customizable Punchable Keyboard Button

Project tutorial by Amal Mathew

  • 1,513 views
  • 4 comments
  • 3 respects
Add projectSign up / Login