Setting PWM Frequency

I’m using Arduino to position a 250 pound 70’x42’ Amateur Radio antenna on top of a 120’ tower. The code powers the rotator and reads back pulses (9576 pulses/360 degrees) to determine where it is pointed. As implemented there is tremendous stress on the system when it starts and stops. What I need to do is smoothly accelerate and de-accelerate the rotation. The motor draws 15-20 Amps at 55 VDC. I am driving some high powered FETs. I want to use the PWM feature ‘analogWrite’ to ramp the speed up and down. Unfortunately, the maximum PWM frequency that I can drive the FETs at is about 200Hz.

What I need to know is how to set the PWM frequency to less than 250Hz on my Diecimila. It seems I would only need to change the value of some internal counter. Your help is greatly appreciated.


This is a little over my head, but I was just reading an article that concerned interupts and how they effect PWM cycles… This may be what you are looking for… check it out, hope it helps…

Hi tek 1229,

Thanks for the pointer. Turns out to be quite simple. Use pin 3 or 11 and ‘TCCR2B = 1<<CS22 | 0<<CS21 | 1<<CS20;’. This sets the prescaler to 128 vs the 64 default and drops the PWM freq from 500Hz to 250Hz.


Since you’re dealing with absolute position and a pulse count to go from X to Y, have you considered manually pulsing the control pin? By doing this you can use a little bit of math (to set the inter-pulse delay) to smoothly accelerate out of your start position and decelerate into your stop position.