Pwm on a DC motor

I have a wiper motor(12 volt 3 Amper).I want to control it from low rpm until full rpm with a potensiometer.
So, i use AnalogInOutserial from examples. I am using pin 6 with frequency 980Khz but i have try other pins with frequency 490
K hz. Output pin goes to gate of modfet IRFZ44N.
Noise of the motor is very annoying ,can i do something??? I place a capacitor 220?f between drain & source ,it was better but i lose resolution and capacitor gets hot.I try different capacitors but with no results

Add a flyback diode.

But with diode ,rpm does goes low

A diode is important to reduce spikes. It MUST be present. (connected kathode to 12V)

yes, of course ,i have add a shottky diode, but with diode ,rpm does not goes very low. Motor starts from medium rpm until full

thats ormal..
Torque isnt linear, more quadratic with voltage.
Try change output to follow potposition^2

what yoy mean, potensiometer is 4.7k

I notice that with a capacitor between drain and source 330 nF 63 volt, i have rpm from 0 to full. But capacitor is heating. Is it going to blow?

Draw a schematic of your circuit with pen & paper and take a photo with cell phone and post it with your code.
Use the "#" CODE TAGS toolbutton to post your code.
Are you using the Map function ?

My motor is 12V 3A (wiper motor from car). RPM of motor is 39.I want to slow down to 10 RPM.

At first ,with this circuit, RPM slow down to 32, but i want lower RPM

And the second circuit is this

RPM goes from 0-39 ,but without load ,capacitor gets hot, i suppose with load it is going to blow up
I am using pin 3 at 490Hz, but i have also use pin 5 at 980Hz,with the same result

const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 3; // Analog output pin that the LED is attached to

int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 255);  
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);           

  // print the results to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.print(sensorValue);      
  Serial.print("\t output = ");      
  Serial.println(outputValue);   

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(2);                     
}

Its not 980kHz or 490kHz, its 980Hz or 490Hz!!!

alfadex:
yes, of course ,i have add a shottky diode, but with diode ,rpm does not goes very low. Motor starts from medium rpm until full

You cannot get linear speed control without using an H-bridge in fast decay mode
or synchronous rectification. In fact a 1/2 H-bridge is all that's needed for
single spin direction.

The free-wheel diode means the current falls very slowly during the off-duty parts of
the PWM cycle (slow decay mode), so it doesn't go to low rpm (except under large
mechanical loads).

A better way to control a motor with a single switch is perhaps to modulate the
time between pulses, ie varying the pulse frequency for constant-width pulses.

You can also add a zener diode in series with the free-wheel diode to increase the
voltage and thus the decay speed. However there can be significant power
dissipated in the zener, a heatsink might be needed, and its still not very linear
speed control curve.

A schottky diode is the worst choice, as it has the smallest forward voltage and
thus the slowest decay possible.

Perhaps several non-schottky diodes in series would fare a bit better?

knut_ny:
thats ormal..
Torque isnt linear, more quadratic with voltage.
Try change output to follow potposition^2

Torque and voltage are un-related.

Torque is proportional to current, speed to voltage, assuming a permanent magnet
DC motor. Not perfectly true as there is physical friction and winding resistance,
but a good first approximation.

Add the diode parallel to the motor, cathode to 12V

As noted by MarkT, a diode across the motor provides very slow current decay because you effectively have a short across the motor winding, therefore very little voltage and therefore a low dI/dt (dI/dt = V / L).

If you want fast current decay, you need at least two transistors and two diodes. Draw out the full circuit for an H-bridge with reversed diodes across each transistor, delete the top-left & bottom-right transistors, and delete the bottom-left and top-right diodes. You PWM both transistors (high side and low side) together.

When the transistors are on, current flows left-to-right through the load and increases according to dI/dt = (V_src - 2*Vcesat - I_load * R_load) / L_load.

When the transistors are off, current continues to flow left-to-right through the load but now is being forced through the diodes back into your power supply bus (hope you have some nice big, low ESR/ESL capacitors on it!). Because the voltage is opposed to the current, the current will now reduce at dI/dt = -(V_src - 2*Vdiode - I_load * R_load) / L_load.

If you use FETs instead of BJTs then the body-diodes are included for free so you don't need to add external diodes.