AD9850 is it possible to generate a square wave with variable duty cycle ? - Page 1
Forum section: electronics / general

author: legacy
author_rank: Super Contributor
timestamp: November 23, 2013, 01:42:09 am
content: hiis it possible with AD9850 or AD9851 ?i need to produce a variable frequency square wave in where software could also change the duty cycle from 1% to 99%i need this for testing purpose

author: c4757p
author_rank: Super Contributor
timestamp: November 23, 2013, 01:43:43 am
content: The AD9850/1 is a sine wave synthesizer. Why would you want to use them to generate a square wave?!

author: edavid
author_rank: Super Contributor
timestamp: November 23, 2013, 01:55:19 am
content: Quote from: legacy on November 23, 2013, 01:42:09 amYou can connect the output to a comparator... the internal comparator is probably not good enough, but it depends on how accurate the duty cycle has to be. The comparator threshold would be set by a 10-12 bit DAC.Quote from: c4757p on November 23, 2013, 01:43:43 amWhat chip should the OP use instead?

author: dannyf
author_rank: Super Contributor
timestamp: November 23, 2013, 02:09:43 am
content: The internal comparator has both its inputs routed out, and is fairly fast, so it is possible to use it to generate variable dc square wave - assuming you can control a reference voltage.However, as others have pointed out, it is an overly complicated way of doing simple things.

author: vk6zgo
author_rank: Super Contributor
timestamp: November 23, 2013, 03:09:34 am
content: By definition,once you change the duty cycle,it is no longer a square wave--it becomes a rectangular wave!

author: daveatol
author_rank: Regular Contributor
timestamp: November 23, 2013, 03:13:06 am
content: From the datasheet, regarding the reason someone might do this:Quote

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 23, 2013, 07:34:17 am
content: ad9850 module from ebay china got trimpot to adjust comparator threshold, if you want software configurable, i believe you need to tap the threshold line and connect to DAC.Quote from: c4757p on November 23, 2013, 01:43:43 ambecause it can.

author: legacy
author_rank: Super Contributor
timestamp: November 23, 2013, 02:25:50 pm
content: Quote from: dannyf on November 23, 2013, 02:09:43 amcause i have 10 modules AD9350/AD9351 in lab =Danyway, can i change my question into: what do you suggest to do it simpler ?i need a square wave generator from 200Hz to 2Khz with duty cycle variable from 1% to 99% with a step of 1%, but i need the MPU able to change it automatically by software

author: Unknown
author_rank: Unknown
timestamp: November 23, 2013, 02:28:39 pm
content: Triangular wave + comparator fed by a DAC?

author: Andy Watson
author_rank: Super Contributor
timestamp: November 23, 2013, 02:40:58 pm
content: Quote from: legacy on November 23, 2013, 02:25:50 pmWobbling an I/O pin at 2 kHz with 1% resolution is well within the capabilities of most MPUs, why try to complicate things? If you don't want to devote software -run time to the task, add another single-chip mpu.

author: c4757p
author_rank: Super Contributor
timestamp: November 23, 2013, 02:52:46 pm
content: Quote from: Andy Watson on November 23, 2013, 02:40:58 pmYes, this is what I would suggest as well. A cheap microcontroller with a timer or two would be a very good way to get a variable duty cycle.Quote from: Mechatrommer on November 23, 2013, 07:34:17 amI should have read the datasheet more carefully! It does seem like awful overkill, but if OP has ten of them and it's just a one-off... Of course, I still can't think of a reasonable way to getdigitallycontrolled duty cycle without complicating it even more.

author: legacy
author_rank: Super Contributor
timestamp: November 23, 2013, 03:12:27 pm
content: Ok, i will add a dedicated chip (probably an AVR8 tiny, i mean something in dip8 package), i have no resource available on the main MPU, full at 97% of its schedulable task's list (it is a poor 328 @ 8Mhz) =Palso the AD9350 is already onboard of this equipment, each PCB has one AD9350 on it because it is needed by an other kind of test in where 16 tones must be provided to the circuit under test.anyway i will add a tiny MPU mounted on a tiny PCB inpiggy backto the "mother" pcb, i should have enough spaceumm, just an other question: what is the easiest way to build a "custom wave" synthesizer ? Today i was thinking about the USB-audio board, building a wave on PC then putting it into a .wav file, then using a linux machine (such as an usb router with usb-sound driver) to "play" the custom wave.i also need a custom wave cause i'd like to test an "event detect" algorithm i am implementing on dsPIC33F that should be able to a seismic signal, and seismic signal is not definable as "sinusoidal" or "triangular" or "square" wave, unfortunately

author: dannyf
author_rank: Super Contributor
timestamp: November 23, 2013, 03:13:29 pm
content: QuoteThe simplest would be a mcu with hardware pwm.

author: G0HZU
author_rank: Super Contributor
timestamp: November 23, 2013, 04:37:36 pm
content: QuoteThat's a fairly similar requirement to a basic car engine management system that has to control and time fuel injectors. This can be done with a fairly basic 8 bit MCU provided it has a decent 16 bit timer and has the required interrupt/port functions built in.However, if you absolutely 'want' to use the AD9850 and an MCU then one (wacky) method would be to use the DDS to clock the MCU with the MCU set to a 16 bit PWM mode.Obviously you would have to come up with a scheme where the MCU is initially clocked by something else or it won't be able to program the DDS at the start of the whole processBut the end result would be 16bit PWM and ultra fine frequency resolution via the DDS. But as you only want 200Hz to 2kHz o/p you can do the whole thing with a fairly basic MCU chip and keep the DDS chips for something else...

author: legacy
author_rank: Super Contributor
timestamp: November 23, 2013, 04:42:30 pm
content: Quote from: Pippy on November 23, 2013, 04:08:44 pmYes, ATmega328, but unfortunately all the hw resources are already used for other stuff, in particular all the timers are used, no one is free (one timer is used to schedule things, for example), this is the reason why i need to add an external MPU.

author: legacy
author_rank: Super Contributor
timestamp: November 23, 2013, 04:45:29 pm
content: Quote from: G0HZU on November 23, 2013, 04:37:36 pmyou are right, that's for an automotive test equipment, unfortunately the PCB was already engineered and i was asked to modify it "adding" the new testing functions. That's the reason why i found a AD9350 already soldered on the PCB and partially used by 3 of the testing functions in the firmware i found aboard the main MPU =Pin other words, i was asked to to fix the jam =P

author: legacy
author_rank: Super Contributor
timestamp: November 23, 2013, 05:06:24 pm
content: what do you think aboutthiskind of equipment (very low price, may be … too low price) ?

author: dannyf
author_rank: Super Contributor
timestamp: November 23, 2013, 10:11:32 pm
content: QuoteI think you want to ask yourself,1) what you are trying to do; and2) how using the parts you have proposed will help you do what you are trying to do.Lay them out on a piece of paper and hopefully it will be clearer to you.

author: legacy
author_rank: Super Contributor
timestamp: November 24, 2013, 12:28:44 am
content: hey?@dannyfabout me and what i am trying to do, i was already fine with the suggestion provided me in the previous page: MPU used like PWM generator with duty cycle variable from 1% to 99%we are doingbrainstorming(1) now, so i can point out thatDDS300is a cheap function generator module with two output signals, one is for PWM signal, the other is for the DDS signal. The module is TTL and has a 232 port, we can connect it to arduino (or to host computer) in order to choose a variety of waveform output ,respectively {sine wave, square wave , triangle wave, heart} waveIt may be helpful if you need such a signals to be probed, and I was asking what do you think about this module, in order to keep attention to a low cost and very cheap tool that may help others, too. Also the DDS300 needs to be hacked, more specifically it needs to be reversed about the protocol, just cause the .exe application provided is for Windows Only without any sources, and this is the second reason i was asking about: more specifically, "has anyone already hacked this module ? does anybody know something about this module's protocol ?"(1) is a group or individual creativity technique by which efforts are made to find a conclusion for a specific problem by gathering a list of ideas …about PWM, something similar may be of any interest followingthissuggestion (that's about an arduino PWM library)

author: WarSim
author_rank: Frequent Contributor
timestamp: November 24, 2013, 12:32:10 am
content: Quote from: legacy on November 23, 2013, 04:42:30 pmConsider making a timer multipurpose.Or alter your method and use gating of you DSS instead of Duty scheduling and use your DSS clock.Depending on the configurability of your chip I may use zero to two more pins.Sent from my iPad usingTapatalk

author: legacy
author_rank: Super Contributor
timestamp: November 26, 2013, 01:03:26 pm
content: i am also evalutaing AD9834 which has much more features about the waves it can produce =P

author: legacy
author_rank: Super Contributor
timestamp: November 26, 2013, 01:30:03 pm
content: The AD9833 comes as an incredibly small (M-SOP package) chip with an onboard 10 bit DAC, and it's a serial programmable DDS (SPI with a 25 MHz master) with 28bit resolution which can output from 0 to 12.5 MHz {sinusoidal, triangular, square} waveConnections are as follows:MOSI ==> SDATASCK ==> SCLKPB0 ==> FSYNCeasy powerful chip !

author: Crazy Ape
author_rank: Regular Contributor
timestamp: November 26, 2013, 02:27:10 pm
content: Quote from: legacy on November 26, 2013, 01:30:03 pmAt least there are not many pins to solder.If this is just a one-off / hobby project, grab a module with all the support circuitry already on board, that way you can avoid the possibly tricky soldering (though it's really not that hard).Example of a couple of modules from random on-line vendors:http://www.goodluckbuy.com/ad-9833-module-dds-singnal-generater-module-sine-wave-square-wave-triangular-wave-.htmlhttp://www.edoomart.com/dds-module-ad9833-signal-generator-with-circuit-diagram-p-844.html

author: legacy
author_rank: Super Contributor
timestamp: November 27, 2013, 08:46:16 am
content: what do you think about the quality of these circuits ? i am wandering about the Q factor of the smd inductors and capacitors mounted around the tiny module, what do you think about ?correct me if i am wrong, may be that an smd inductor has an inferior Q factor ?have you ever bought these modules ? and what do you think about theDDS60?

author: Crazy Ape
author_rank: Regular Contributor
timestamp: November 27, 2013, 09:30:06 am
content: Quote from: legacy on November 27, 2013, 08:46:16 amUmmmm, I only see capacitors on the modules I linked. I've never bought or used them personally so can't help with specifics.Not sure about the DDS60 kit, though I have used the AD9851 in a radio modification project and it worked well for that.

author: legacy
author_rank: Super Contributor
timestamp: November 27, 2013, 10:51:25 am
content: the output filter should have inductors, differently they must be provide externally.

author: legacy
author_rank: Super Contributor
timestamp: November 27, 2013, 10:52:27 am
content: See L1,L2

author: Crazy Ape
author_rank: Regular Contributor
timestamp: November 27, 2013, 11:50:09 am
content: Yep, I see em. But I hadn't looked at it at as you seemed to be asking about the modules I linked to. I imagine the modules I linked to are to be designed to be used as part of a bigger design, which would include the filter. The filter specifications are going to change depending on the application, therefore I suspect it's usually left to the designer.The DDS-60 looks to be a more completed, hobbyist targeted design.It all comes down to your application.