DC Motor Control using Mosfet

All, looking for a little advice on programming a dc motor control using an Arduino Uno and a Mosfet IRFZ44N.

Circuit and program work, but problem is -- the motor does not start to rotate until the pot has been rotated about 25% of it's rotation range. My concern is that is a waste of the range of control. I'd like to use the full rotation of the pot for finer control of the motor.

Is there a programing way to manage the range of the pot? Here is the portion of the code that controls the range
void loop()
{

// Read values from potentiometer
speedVal0 = analogRead(potIn0);

// Map value to range of 0-255
speedVal0 = map(speedVal0, 0, 1023, 0, 255);

// Write PWM to transistor
analogWrite(outPin0, speedVal0);

delay(20);

// Read values from potentiometer
speedVal1 = analogRead(potIn1);

// Map value to range of 0-255
speedVal1 = map(speedVal1, 0, 1023, 0, 255);

// Write PWM to transistor
analogWrite(outPin1, speedVal1);
delay(20);
}

And here is the schematic of the working circuit.

Motordriver.pdf (140.2 KB)

const byte MinPWM = 255/4; 

  speedVal1 = map(speedVal1, 0, 1023, MinPWM, 255);

Pick the highest value of MinPWM that will allow you to stop the motor once you get it moving.

@johnwasser is exactly right…
If you put 2% of the energy into the motor, it’s unlikely to overcome inertia, friction and the startup load.

I’d guess, you probably need 15-20% to push the motor off the stall, then away you go.

You may succeed running a lower ‘speed’ once the motor’s already started running - depending on the load… in that case you may use a different map when accelerating than decelerating.

It is also possible to give a kick-start of hundreds of milliseconds at maximum power only when the motor activate from a stop.

is this a variable speed motor?

that's what PWM is

No.
PWM and kickstart are different ideas.
May need to adopt a special kickstart pulse even when driving with PWM.
It is not possible to obtain a kickstart pulse that can be started with a low duty ratio because the PWM of the motor is often selected at a frequency that exceeds the audible sound.
For example, in the case of a motor that requires 200ms as a kickstart, if the duty is 5%, the frequency at which it can be a kickstart pulse is 0.25Hz when PWM only drive.
It is quite possible to rotate at low speed by giving 100% power of 500ms to a motor that cannot be started with 5% duty and then giving PWM of 5% duty.

can you provide a link that explains this better?

https://patents.google.com/patent/US20080265811
Please read first at section [0001] to [0004].

I don't know if this is a good document because I think it's a probably generally idea for dc motor control...
Is this documents right to you? @gcjr

For more example, Marlin which is famous as 3D printer firmware, also controls the fan with PWM.
For those who are using a fan that can't start spinning when given a low duty, there is a kick-start option.
https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration_adv.h#L496

Hi,
@dmhoke circuit.

You might also put some bypass capacitors on the motor, a 0.1uF across the motor terminals.
Also a 10K resistor from gate to source.
Can you please post link to data/specs of the motor?

Please read the post at the start of any forum , entitled "How to use this Forum".

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

the patent describes a common approach to starting fan motors to cool lap/desktop CPUs by providing full power to get them started but avoiding the "roar" of the motor by sensing fan movement using a hall effect sensor.

the patent mentions "applying a dc current pulse of fixed time duration to get the motor in motion and then switch to PWM" and that the duration of the pulse depends on the motor (hence the hall effect sensor).

not sure why this is necessary. model railroad locomotive motors are controlled at low speed without such a pulse. full voltage PWM pulses overcome "stiction"

but maybe such an approach makes sense for motors not designed for variable speed operation. seems that a "kickstart" pulse can easily be implemented by initially generating a 100% PWM signal and quickly reducing it to the desired level

That MOSFET is not logic level so cannot work from an Arduino at 5V. With 5V drive it won't turn fully on and may overheat and limit the current to the motor severely.

You have no free-wheel diode across the motor. This is needed to prevent inductive kickback from potentially damaging the MOSFET and generating EMI.

You have no resistor between gate and source of the MOSFET to ensure its off during power up / reset. 10k to 100k is a typical value.

A "coreless type" DC motor is used for the motor of a small model railroad locomotive.
The difference between static friction from a stopped state and dynamic friction during rotation is much smaller than that of a normal DC motor.
This gives a sufficient kick start with only one PWM pulse when starting rotation at low speed.
Therefore, it is possible to start rotation at low speed only with PWM.

In the case of a normal DC motor with a rotor and a stator, the difference between static friction and dynamic friction is larger than that of a coreless motor.
So in most cases it will not start rotate even if the minimum rotation speed PWM obtained by decelerating during rotation is given from the stopped state.
Therefore, a kick start is required.

If you are interested that, try using a slightly larger motor for test.

No, basically most DC motors accept PWM for speed control.

And the design concept of coreless motors doesn't focus on "variable speed".
However, as a result, variable speed is easy.
Because it is easy to accelerate.

Yes, I suggested it in #4.

yes, it's a variable brushless motor that came out of an old computer printer. But the end use will be model trains.

Yes I do have a diode across the motor terminals, but haven't tried adding the capacitors yet. I will add the resistor to the gate. Perhaps this will fix the brief turn on when I first apply power.

Thanks to everyone for all the suggestions. Lots of good info. Let me chew on this for a while and I'll get back in touch if I have any other problems..

Again thanks
hoke