# DC motor and pwm

I am planning to get a few DC motors and just wanted to know: What is the minimum rpm an arduino mega can output and what is the max (I think its 255). Secondly, what is the minimum rpm/pwm I could use and the motor still move?

So, if I had a dc motor of say 9000 rpm would I have to divide 9000/255 to find the rpm at an increment of 1 pwm?

More or less. (35.3 rpm /per PWM count). There is no way to know the minimum without running a test. No one can tell you the minimum or maximum rpm . The range for PWM is 0 to 255. If you provide the correct voltage for a 9000 rpm motor, it should reach that rpm with a count of 255. As far as minimum, how does "0" sound to you ? (no surprise there right ?)

Yeah the PWM's minimum is 0 as far as analogWrite is concerned, which will def be 0 volts and it will not move.

But you might find you need to use a PWM of over 30% or 40%, or maybe only 5% to get the motor to move.

Be careful if you use a driver chip like a 293 or 298 where the voltage drop through the chip will be 2-3V so that means you might not get much range of PWM.... might be dead until 80%, and as raschemmel says, you need to test your actual rig.

Alexisa: I am planning to get a few DC motors and just wanted to know: What is the minimum rpm an arduino mega can output and what is the max (I think its 255). Secondly, what is the minimum rpm/pwm I could use and the motor still move?

So, if I had a dc motor of say 9000 rpm would I have to divide 9000/255 to find the rpm at an increment of 1 pwm?

It all depends on how you drive the H-bridge. You'll have to tell us which motor driver/shield and how you are driving it (ie the code, library or whatever).

The way to guarantee good linear behaviour between analogWrite and a DC motor is to use synchronous rectification mode(*) in the H-bridge - however fast-decay mode is a good approximation (slow decay is not). In synchronous rectification mode one arm of the H-bridge is driven in anti-phase, the other is held constant.

Remember that a motor's speed drops under load, and at lower speeds this drop is proportionally more. Thus under a useful load the linear relation between duty cycle and speed breaks down - below a certain drive level the motor will stall. Friction also contributes to this.

In short you will have to experiment a bit. Over specing the motor and using synchronous rectification or at least a high PWM frequency will improve linearity.

Anyway what are you wanting to do? Perhaps you are going about things the wrong way and what you really need is speed feedback?

What I'm trying to do is make a line following robot including a light sensor array, ultrasonics, ir sensors etc...

I am currently looking at geared dc motors between 500 rpm and 1000 rpm, I want to get the robot as fast as possible with a reasonable amount of torque. I also need to be able to move the robot at perhaps 50-100rpm for when stopping and looking for objects I could use the motors for some other project too if I ever need them.

THanks

OK, for line following you already have a feedback loop from the line sensor, so its relatively easy - standard motor shield will do if the motor doesn't take too much current - so what motors?

Torque of the motor depends on the motor size principally - then this gets multiplied by the gearing, so for small motors you have to put up with lower speed for higher torque. Working out some figures for the required torque would be good.