MOSFET driven motor is hunting

D n T

Senior Member
I have a test circuit and program to test MOSFETS for a 24 volt motor project, to test the idea I'm driving a "solar" DC motor using a P60NF MOSFET running through a TC4420 MOSFET driver at 500kHz.
While the speed changes through out the range of the 10 pot, it hunts ( rises and falls) something fierce at the change points.
The hunting is a constant frequency and can be seen on my scope.
At this freq the divisions are very small. ( or so I understand). Is there any way of calming or removing the hunting. Or do I just need to be alittle more delicate with my code?
I have put a back emf suppresion diode in.
I have capped the supplies and played with the cap values to no avail.
I intend using the same type of circuit on another project but the PICAXE supply will come though a 7812 then a 7805 from the 24 volt battery pack that will be driving the motor

The test program:

symbol throt = 0 ` Throttle sensor
symbol motor = 2 ` output pin for PWM driver pin
symbol throttle = b1 ` throttle reading
symbol throttle1 = w1 ` duty

Motor_control:
readadc throt, throttle
throttle1 = throttle/7 max 11
pwmout motor, 1, throttle1
debug throttle
pause 5
goto motor_control

Thanks, must go to bed now, will check again upon the morn.
 
Last edited:

BCJKiwi

Senior Member
Two potential issues;
1. Debug - replace it with sertxd("Throttle ",throttle,cr,lf)
2. Readadc
a. Use readadc10 instead of readadc - much finer resolution.

b. Can't quite follow the code. It would appear that pwmout would never change as duty is throttle1 which never changes, only throttle changes?

c. If ReadADC10 doesn't fix the issue, the system may be hunting and needs a little hysteresis. This could be an RC on the readadc10 line, or in software - i.e. don't change throttle(1) until readadc10 has changed by 2 or 3 counts.
 

mikie_121

Member
Are you switching ground or the supply with the mosfets? Can you supply a simple circuit diagram?

Try readADC10 as BCJKiwi suggested, but I think your code is good. 'throttle1' does change with 'throttle', BCJKiwi. (throttle1 = throttle/7 max 11)

You'll need to change 'throttle' to a word variable too, just watch out you don't overlap memory locations
 
Last edited:

D n T

Senior Member
BCJKIWI is correct, a transfer typo, I have edited it

Sorry BCJKIWI.

The MOSFET is on the low side of the motor.
I have found the TC 4420 in the VSM library so I will have to draw it up
 

Technical

Technical Support
Staff member
You are constantly reseting pwmout all the time, which is not a good idea as it constantly resets the timers that create the pwm signal. Use pwmduty, and then only update it when you need to.

i.e.

pwmout motor, 1, throttle
Motor_control:
readadc throt, throttle
throttle1 = throttle/7 max 11

if throttle1 <> oldthrottle1 then
pwmduty motor, throttle1
oldthrottle1 = throttle1
rem debug throttle1
end if

pause 5
goto motor_control
 

D n T

Senior Member
10kHz and an change detector &lt;&gt; previous

Does the frequency effect the output torque of the motor?
I thought that the length of `off` time the pulse had would effect the inertia of the motor and thus the torque?
Or is it minimal snd not worth worrying about?
OR am I barking up the wrong tree?
Based on the idea of an interal combustion engine where the less the angle between combustion strokes forcing the piston down and the crank around the more grunt you get ( assuming the piston and stroke are the same for each configuration).

Does the freq ( not the duty)have an effect the motors turning force?
 

eclectic

Moderator
DnT
Quotes from earlier posts.

throttle1 = throttle/7 max 11

if throttle1 <> oldthrottle1 then
pwmduty motor, throttle1

And

pwmout motor, 1, throttle1

Effectively, it could produce

pwmout 2, 1, 10

From Manual 2, page 124

As the pwmout command uses the internal pwm module of the microcontroller
there are certain restrictions to its use:
1) The command only works on certain pins.
2) Duty cycle is a 10 bit value (0 to 1023). The maximum duty cycle value must
not be set greater than 4x the period, as the mark ‘on time’ would then be
longer than the total PWM period (see equations above)! Setting above this
value will cause erratic behaviour.

Might number 2 cause problems?
Or am I mistaken?

e.
 
Last edited:
Top