Page 1 of 1

PWM with FF Buggy

Posted: Tue Jul 17, 2007 6:45 pm
by steamydave
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

Posted: Wed Jul 18, 2007 9:28 am
by Benj
Hello

In Forwards mode the current travels from the direction pin and out through the PWM pin. This means that the more off the PWM is the more current flows through the motor.

In backwards mode the opposite occurrs so that the current travels from the PWM pin through to the direction pin.

Also the motors only start to respond about 50% of the way through the PWM cycle. Eg when the current is travelling more then 50% of the time.

There is an update for flowcode being released today with any luck that will contain the Formula Flowcode component. This is a much simpler way to control the Micro-mouse.