Author Topic: Low Frequency from PWM  (Read 2579 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Low Frequency from PWM
« on: July 21, 2009, 08:37:26 PM »
Can I reliably generate a really low frequency from the PWM channel of an AVR 16 bit timer?
By low I mean something like 30 hertz.

Thanks in advance
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Kirk

  • Jr. Member
  • **
  • Posts: 44
  • Helpful? 2
Re: Low Frequency from PWM
« Reply #1 on: July 22, 2009, 06:21:10 PM »
It should be no problem. I have a friend that sets a 16bit timer to about 50Hz and uses the low PWM values to run R/C servos.
  In fact since the PWM is purely hardware and thus glitch free (so they say) there is no reason that you could not go to 0.5 Hz or less.
Kirk

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Low Frequency from PWM
« Reply #2 on: July 22, 2009, 07:27:36 PM »
It depends on your mcu clock speed.
The prescaler allows you to divide this by a constant value such 128. - in which case your timer is incremented every CPU/128.
With a 16 bit timer then you can set the PWM cycle time to be anything up to 65,535.

So with a 16MHz clock and 128 prescaler then you can go to 16MHz / (128 * 65535) = 1.9 Hz
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Low Frequency from PWM
« Reply #3 on: August 10, 2009, 07:15:57 AM »
You can always use a really low frequency oscillator crystal, and set low speed clock fuses and dividers :P

 


data_list