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 on your PC, 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.
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.
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.
The GUI program for your PC is "portable" so does not need installing.
For Windows users, simply extract the .zip file into a folder of your choice and make a short-cut to the .exe file. Note: The "DueAWGController-Win64.zip" file is intended for 64 bit systems, but the 32.zip file often works more reliably anyway since it has java embedded.
For Linux users, extract the DueAWGController-LinuxXX.zip file into a folder, then double click the DueAWGControllerLinux file or add it to the system menu.
You may need to install OpenJDK 8 (java 8) for Debian, Ubuntu, etc: On the command line (in Terminal), type: sudo apt-get install openjdk-8-jre (Newer versions might not work.)
You might also need to gain permission to access the USB before you can connect to the Arduino. Type: sudo usermod -a -G dialout $USER
Also included are two "arm" files for Raspberry Pi etc, but they have not been tested. Please let me know if they work.
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. However, 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.