3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Atmel Xmega USB/Serial Arbitrary Waveform Generator

Atmel Xmega USB/Serial Arbitrary Waveform Generator
This instructable walks you through programming and using the Boston Android Xmega evaluation board to work as a simple arbitrary waveform generator taking advantage of the integrated 12bit DAC and high speed DMA controller. I have provided precompiled firmware as well as source code which can be loaded onto the device and configured via a USB port on your PC or laptop.

You will need a computer (mac, pc, linux all supported) with an available USB port, free driver for the USB-Serial adapter, a Boston Android Xmega EVAL-USB-64 development board ($31.99) and an open source AVR chip programming utility called AVRDUDE.

Once set up, you can generate sine, ramp, triangle, square or any waveform you define from 5 to 20KHz with amplitude of up to 3.3Vp-p. It is possible to generate faster waveforms with the arbitrary waveform feature (up to 500KHz).

 
Remove these adsRemove these ads by Signing Up
 

Step 1What you need

What you need
1) Boston Android Xmega EVAL-USB-64 (or comparable) Development Board
2) PC with USB port
3) AVRDUDE (free AVR programing software)

Also recommended:

Oscilloscope (to view waveforms)
Headphone or small speaker (to listen to waveforms)
WINAVR and AVRSTUDIO to modify the source code and built your own version of the waveform generator software

Although this example walks through programming and using the EVAL-USB-64 board, you can use any of the EVAL-USB boards from Boston Android. And if you're very experienced you can download the example source code and build for other target hardware such as the Atmel XPLAIN evaluation board, or the Xmega boards available from chips45 and Mattair, Megavore. The xmega family allows effortless migration of code from one chip to another.


« Previous StepDownload PDFView All StepsNext Step »
26 comments
Sep 26, 2011. 12:41 PMkosmo!! says:
Is it possible to use the code for an Xmega128A1?
Sep 27, 2011. 6:07 AMkosmo!! says:
Ok, thanks for fast support. But I have an another question. Im using an STK600 board and I have no serial terminal. Which parameters can change the frequency? I need 20 khz sinewave.
Sep 23, 2011. 12:43 AMgustep12 says:
Very nice, thank you. Do you think it would be possible to extend this design to use an external 16-bit DAC, like the TI DAC8830, for improved 16bit resolution and better drift stability? Most DACs use SPI as the interface, what would it take to hook these up?
Jul 18, 2011. 11:26 AMcatxld says:
how would I boost the voltage amplitude of the frequency from 3V to 20V? if it uses opamps then what opamps would be best for boosting voltage which would cover all or most of its frequency ranges from 1hz ~ 500khz?
Jul 20, 2011. 4:04 PMcatxld says:
Basically I would be using it for all kinds of experiments, speaker, radio,EM , even experimental motor. but id be using the arbitrary waveform feature in most of these experiments, im wondering what is the range of the arbitrary function is it 140hz to 500KHz?
Dec 11, 2010. 9:07 PMbhudz062289 says:
how can i program the at89s52,,can you help
Nov 20, 2010. 11:50 AMwhstark says:
I loaded C program seems to be missing h file got 37 errors and 19 warnings. Can you help.
Sep 20, 2010. 1:40 AMkgkitchen says:
I found it necessary to tweak the baud rate in order to get reliable communication with hyperterminal  - Here's the code. 


// 9600 @ 32Mhz as calculated from ProtoTalk Calc
// see web page at: http://prototalk.net/forums/showthread.php?t=188

 USARTF0.CTRLC = USART_CHSIZE_8BIT_gc | USART_PMODE_DISABLED_gc;

int bsel = 3317;
uint8_t bscale = 12;

USARTF0.BAUDCTRLA = (uint8_t) bsel;
USARTF0.BAUDCTRLB = (bscale << 4) | (bsel >> 8);
 
Jul 19, 2010. 2:22 PMganzziani says:
Cool Stuff, also check out my own XMEGA oscilloscope, arbitrary waveform generator and calculator: Xmegalab
http://www.gabotronics.com/development-boards/avr-xmegalab.htm
Jul 16, 2010. 2:56 PMslick8086 says:
How do I do this on OS X 10.5.8?
Jul 16, 2010. 5:17 PMslick8086 says:
So I tried this on my mac first and I thought that my terminal program wasn't working... So I tried it on a winxp box with hyperterm and I'm getting the same issue. When I connect to the device and type 'h' an 'o' shows up and pressing enter gives me a 'm'. I wrote the program to the device with AVRDUDE on my mac and I didn't get any errors. What could be my problem?
Jul 19, 2010. 1:44 PMslick8086 says:
Woohoo got it working with the new hex file:
http://www.bostonandroid.com/binaries/xmega-waveform-serial2.hex

When I tried uploading with avrdude on my mac I got:

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
               0x0c != 0xff
avrdude: verification error; content mismatch
avrdude done. Thank you.

but using avrdude in win xp worked.
I was able to connect and control with my mac though using screen:

sexybeast:avrdude aaron$ screen /dev/tty.usbserial-A800cAoo 9600
Mar 28, 2010. 4:21 PMmathman47 says:
Nice job.  I just studied waveforms as part of my Amateur Extra class Ham license.  Now I can make them.  Like the evaluation board.  I was unaware of this source.  Thaks.
May 20, 2010. 1:50 AMfagnelli says:
Really nice.  I was just wondering whether you could use an Arduino for that.  Thanks for sharing.
Mar 27, 2010. 8:02 PMmarc.cryan says:

Nice - Make an Empire State building waveform!!

Mar 31, 2010. 6:34 AMmarc.cryan says:

Awesomeness knows no bounds!!


Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
10
Followers
2
Author:wandererwolf(Boston Android)
I grew up in upstate NY where I speant many hours with my brothers playing with legos (I once attempted to test relativity by connecting a large number of gears to a small lego motor.. results inconcl...
more »