Author Topic: ad8933 function generator  (Read 1360 times)

0 Members and 1 Guest are viewing this topic.

Offline BoschiTopic starter

  • Regular Contributor
  • *
  • Posts: 85
  • Country: it
  • just a arduino-guy
ad8933 function generator
« on: September 11, 2019, 11:09:02 am »
i bought an ad9833 and i want to turn it into a decent function generator.

i want to get 0-2Mhz (or more, maybe up to 3Mhz if the waweform doesnt look too bad, but im not sure about how to filter the waveform)
+- 12 volt  offset
12Vpp of voltage swing (if its a bit less when the dc offset its at its maximum its not a problem)
AC/DC coupling
0 - 20dB attenuation at the output (not pictured in the schematics yet)
a pushbutton to switch on/off the output (the switching its effettuated by a relay)


 my main concern is, this would be my first signal generator, are the specs wide enough to make it usefull? in software im thinking about adding logaritmic mode in order to test filters (at least in audio frequency).

thanks,
Boschi
 

Offline brabus

  • Frequent Contributor
  • **
  • Posts: 330
  • Country: it
Re: ad8933 function generator
« Reply #1 on: September 11, 2019, 11:28:19 am »
I would say: it all depends on what you need to do.
For example, I definitely would need a square wave with precisely tunable duty-cycle (1...99%); you can easily obtain it from the triangle wave using a comparator.
And a sync output for the oscilloscope, of course.

If we are talking about audio frequencies, I would not bother too much with frequencies and amplitudes (100 kHz, 2 Vpp is usually enough for a line signal), and concentrate the effort on distortion.
If you want to characterize a control loop frequency response, frequency becomes relevant, but most of all you need to galvalically insulate the output.

At the end of the day, it really comes down to the output amplifier spec. Have you already idenfitied a suitable part number?

I would start with the specs you drafted and refine them later, once you already have the device on your desk. Once you designed the first version, you can easily work out the improvement you need and build a second one.
« Last Edit: September 11, 2019, 11:30:57 am by brabus »
 

Offline BoschiTopic starter

  • Regular Contributor
  • *
  • Posts: 85
  • Country: it
  • just a arduino-guy
Re: ad8933 function generator
« Reply #2 on: September 11, 2019, 01:12:58 pm »
I would say: it all depends on what you need to do.
...
At the end of the day, it really comes down to the output amplifier spec. Have you already idenfitied a suitable part number?

well... kinda. as now i already designed a circuit to get the job done, and as the output stage it has a AD811, but its a bit exotic.
another possible alternative could be LM7171 (3.5€ in single quantity), which is also pin compatible with the AD811.
(the AD8051 is going to be a different op amp, ill search RS later)

about the pwm i really didnt consider it. i agree that its very handy. ill just use a comparator and the triangular wave, and then square it with the help of a not gate (to also met the 50 ohm output impedance)

the sync its not really useful for me, i have a 4 channel scope and no dedicated sync input, the same goes for the isolated output as the instrument will be battery powered.

anyway, attached there is what i came up with. not drawn there is the switch for the -20 gain, i also want to digitally control the offset with a dac and a differential amplifier.

the idea is to have in the first stage a variable gain of 0.5-5, in the second stage a fixed 4 gain and last a 0.1 gain selectable on the output. this way i can have a output swing that vary from 0.2*0.6V =120mVpp to a 20*0.6V = 12Vpp

any thoughts?
« Last Edit: September 11, 2019, 01:15:42 pm by Boschi »
 

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: ad8933 function generator
« Reply #3 on: September 11, 2019, 03:13:30 pm »
I did some check up of my ad9833 from ali., and get -65dBc THD all over from 2-nd to 20-th + something. So, talking about low distortion with this DDS does not make much sense, and consequently highly priced AD & TI OPA are out of scope.

Dual LM4562 for $2 is more than adequate, or even NE5534 up to 100-200 kHz. If 1-2 MHz 12 Vp-p is really required, than TSH82 from STM for $1+.  My test shows -95dBc at 100 kHz , the best price /THD value I've seen.
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2762
  • Country: us
Re: ad8933 function generator
« Reply #4 on: September 11, 2019, 03:44:30 pm »
I used an AD9834 and a 48MHz master clock in my design with a programmed frequency of 1Hz to 10MHz.

A few comments:
  • The diode for the relay should be across the coil and not the transistor.  Not sure what a physical relay is going to do to your signal at high frequencies.
  • I didn't think the AD9834 needed much of a filter on its output.  However, I did a small filter at the output with an online LC Filter Design program.  You could add more poles if you wish.
  • You can also do a frequency sweep with a high speed interrupt in the Arduino and updating the AD9833 fast.  My update rate is 500Hz to change the frequency while sweeping up or down.
  • I used a PIC18F2550 for my MCU and switched one of its PWM outputs into the signal path.  Either AD9833 output or PWM.  Not both.

839488-0

832452-1
« Last Edit: September 19, 2019, 07:43:47 pm by MarkF »
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2762
  • Country: us
Re: ad8933 function generator
« Reply #5 on: September 11, 2019, 03:51:28 pm »
Oh.
I don't think you want RB on the non-inverting input in your DC offset op-amp.

Edit:  Simplified circuit in previous post.

If you implement a sweep, you may want to allocate a second Arduino pin with a pulse to indicate "start of sweep".


Have you seen GreatScott's design?  https://www.instructables.com/id/DIY-FunctionWaveform-Generator/
« Last Edit: September 11, 2019, 06:11:55 pm by MarkF »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf