PWM with FF Buggy
Posted: Tue Jul 17, 2007 6:45 pm
Hi,
Having read Ben's instructions, I am now a little confused about the table of speeds at the bottom of the article.
I understand with PWM, a set voltage is applied to the motor for a set period of time, and then switched off for a period of time. By switching the power on and off with different ratios, the motor runs at different speeds as the on/off voltage averages out. Please correct me if I'm wrong.
The instructions say that a mark space of 0 gives 100% off - ie no power is applied through that cycle. If the mark is 255, then power is applied for the whole 255 (1 byte) cycle, so the motor is running at full speed for the voltage applied.
From this, I would presume that a mark of 50% (ie 128) would run the motor at half speed, and 25% (ie 64) would run at quarter speed etc...
A separate bit is used to indicate if the motor is to spin forwards, or backwards.
However, the table shows..
0 mark 0 direction = stopped - OK
0 mark 1 direction = Max Speed ? - Surly 0 mark=0 speed!
64 mark 0 direction = Stopped ? - Surly 64=quarter speed
64 mark 1 direction = Half Speed - Again, why not quarter speed...
and so on.
I'm obviously missing something here. Please explain!
Many thanks,
Dave
Having read Ben's instructions, I am now a little confused about the table of speeds at the bottom of the article.
I understand with PWM, a set voltage is applied to the motor for a set period of time, and then switched off for a period of time. By switching the power on and off with different ratios, the motor runs at different speeds as the on/off voltage averages out. Please correct me if I'm wrong.
The instructions say that a mark space of 0 gives 100% off - ie no power is applied through that cycle. If the mark is 255, then power is applied for the whole 255 (1 byte) cycle, so the motor is running at full speed for the voltage applied.
From this, I would presume that a mark of 50% (ie 128) would run the motor at half speed, and 25% (ie 64) would run at quarter speed etc...
A separate bit is used to indicate if the motor is to spin forwards, or backwards.
However, the table shows..
0 mark 0 direction = stopped - OK
0 mark 1 direction = Max Speed ? - Surly 0 mark=0 speed!
64 mark 0 direction = Stopped ? - Surly 64=quarter speed
64 mark 1 direction = Half Speed - Again, why not quarter speed...
and so on.
I'm obviously missing something here. Please explain!
Many thanks,
Dave