EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: richcj10 on June 19, 2012, 02:48:42 am

Title: How to make a function generator with variable duty cycle..
Post by: richcj10 on June 19, 2012, 02:48:42 am
I was thinking of using the Tone() fcn of Arduino but can't find out how to alter the duty cycle...
Any suggestions?

Thanks,

rick
Title: Re: How to make a function generator with variable duty cycle..
Post by: mwhooker on December 02, 2013, 12:42:51 pm
You need the arduino duo which can call http://arduino.cc/en/Reference/AnalogWriteResolution (http://arduino.cc/en/Reference/AnalogWriteResolution)

tone() by definition has a 50% duty cycle.

See this article http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator (http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator)
Title: Re: How to make a function generator with variable duty cycle..
Post by: Six_Shooter on December 02, 2013, 02:55:38 pm
You need the arduino duo which can call http://arduino.cc/en/Reference/AnalogWriteResolution (http://arduino.cc/en/Reference/AnalogWriteResolution)

tone() by definition has a 50% duty cycle.

See this article http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator (http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator)

Am I reading that right, the maximum frequency is 170 Hz? That's not very useful as a function generator. There are tutorials for the Uno that will go to at least 20 kHz, I think I've come across one that will go to 100 kHz.
Title: Re: How to make a function generator with variable duty cycle..
Post by: BravoV on December 02, 2013, 03:00:03 pm
See the date of the first post.  :palm:
Title: Re: How to make a function generator with variable duty cycle..
Post by: dannyf on December 02, 2013, 10:37:59 pm
Two options:
- use analogwrite.
- use hardware pwm.