Showing posts with label DAC. Show all posts
Showing posts with label DAC. Show all posts

Friday, November 7, 2014

At the tone...

Fun with Arduinos and scopes in XY display mode...  Looks good on good old analogue and high end digital scopes.  Not so much on my $400 digital model.


Dual channel 8 bit DACs and a bunch of table look-up data, and a cheap RTC if you want accurate time.



Commercial versions of hardware able to produce such a display are available.  

Sunday, February 27, 2011

Fun with DACs

Today I have been playing around with an AD5330 8 bit DAC (datasheet) and generating different waveforms.  For inspiration, I am using a document from Analog Devices (MT-085 Tutorial) on the Fundamentals of Direct Digital Synthesis (DDS).  This is an excellent primer on the subject and I recommend it highly.

The setup is an Arduino Uno and a breadboarded AD5330 DAC from SparkFun.

From a block diagramme perspective, I have implemented a Numerically Controlled Oscillator as shown below (from MT-085 referenced above):

The "System Clock" initially in my software implementation is just the main loop of the Arduino sketch.  Each time through the loop, the phase accumulator contents is updated.  The tuning word (M stored in the delta phase register) is added to the number in the phase accumulator.  I use the upper 8 bits of the phase accumulator as the address of a lookup table containing the digital amplitude information for whatever waveform I am generating.  This table maps the phase information from the phase accumulator to a digital amplitude word which then drives the DAC.

As you can see from the photographs below, this prototype is only a proof-of-concept implementation and the system clock will need be a much more granular (and stable) implementation.  The next step is to implement the system clock in a timer interrupt handler firing at about a 32KHz rate to make the waveform output much smoother.

I can change the waveform by just filling the digital amplitude lookup table with appropriate values.  I have implemented SIN, Square, Triangle, Sawtooth with a positive slope, Sawtooth with a negative slope and random waveforms.  It should be a simple matter to allow for a custom waveform to be uploaded in a general purpose function generator implementation (a project for another day perhaps...).

Off to figure out Arduino timers.  I have used them to generate PWM output, but now need to figure out how to just generate an interrupt a precise intervals without interfering with the various digital output pins I require for DAC purposes.