Previous in Forum: pv solar modules   Next in Forum: regenerative ac drive
Close
Close
Close
21 comments
Rate Comments: Nested
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12

PWM Frequency Decision

03/14/2008 10:39 AM

Hello

I have a small DC motor control circuit that I am working on for a home built CNC Milling machine. It uses a PIXAXE 28X1 microcontroller to take feedback from a Hall effect sensor on the spindle to calculate the spindle RPM. It then increases or decreases the duty cycle of the built in PWM generator to keep the spindle moving at a constant target RPM. The DC Motor runs on 24v at around 2A when it is at a 98% duty cycle and I believe the motor came from a scooter. It is a straightforward PM DC motor.

My problem is this. The PICAXE chip I am using has limitations on how low a frequency I can set the PWM. It seems to be only able to go down to 15kHz and up to nearly 100kHz. I am used to running PWM circuits at a much lower frequency. The motor doesn't seem to be putting out as much torque as I would expect, even at a 98% duty cycle. What are the trade offs with having the PWM running at higher kHz frequencies and is there any formula or strategy for figuring out the correct frequency to use?

Thanks for any help you can give.

-Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#1

Re: PWM Frequency Decision

03/14/2008 10:51 AM

One problem you can run into at high speeds is the time it takes to switch your current on and off. For instance, if it takes 100uS to turn your switch on or off, that limits your frequency to 5000Hz or so. Your switch and motor effectively becomes a low pass filter that won't let your high frequencies get through.

I've done PWM with pics (a 16F model) at much lower frequencies (~100Hz) by doing the PWM in code, rather than using the built in PWM function. If you do it that way, you can make it as slow as you want.

Register to Reply Score 1 for Good Answer
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12
#2
In reply to #1

Re: PWM Frequency Decision

03/14/2008 10:57 AM

I have been thinking about doing the PWM in code. The only downside is that I would probably need to dedicate a chip to that. Not too big a deal, but I am trying to keep the complexity down as much as possible.

I am looking at the high side driver chips I am using (VN05N chips from ST Microelectronics). The switching time may be the issue. It that is it I will let the forum know.

thanks,

Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#3

Re: PWM Frequency Decision

03/14/2008 11:02 AM

PWM frequencies are generally kept above about 20kHz to keep any buzzing/whining noise above audio range.

As bhankiii says, a problem can be the switching time. And there's a trade-off here (as ever!). You can use faster transistors/drive them harder - fast switching is good to reduce the power loss in the switching elements, but it's bad because it generates more RFI. It's all a balancing act!

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply Score 1 for Good Answer
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12
#4
In reply to #3

Re: PWM Frequency Decision

03/14/2008 11:29 AM

I had typically gone in the other direction. Keeping the pulse train at very low frequency to prevent the whining. It had the added benefit of inspiring fear from the low frequency tones. :-)

I had always worried about inductance effects at the higher frequencies. Not that I had a specific engineering reason for that, just gut instinct. I guess my gut was wrong. :-(

Is there any formula or rule of thumb to use in these situations? Is there any way to calculate the power loss at specific frequency ranges. It seems my high side driver chip is capably of switching fast enough. It claims a 30 uS switching time.

Thanks,

Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#5
In reply to #4

Re: PWM Frequency Decision

03/14/2008 11:45 AM

1/(30uS x2) = 16KHz as the top speed (your minimum pulse is 60uS wide - and that's all rise and fall time).

We use an Intersil HIP4080A full bridge driver that has TR and TF < 35nS. I don't know if that part is applicable to you, but it does show what's available out there.

I assume you're using a high side driver because you're using an H-Bridge for forward/reverse. If you don't need both directions you can use a low side N-channel MOSFET switch and drive it with a simple transistor circuit straight from your PIC.

Register to Reply
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12
#6
In reply to #5

Re: PWM Frequency Decision

03/14/2008 11:53 AM

I was actually using the VN05N because it was inexpensive and had a direct logic level input for extremely easy integration. At this point I am considering converting to a MOSFET switch. I only need one direction since it is just managing a spindle motor for a mill.

Do you have a circuit examples or a MOSFET you would recommend. I would actually like to be able to drive the motor at 32v and up to ~3.5A continuous. The motor seems to handle it fine and it would give me a wider speed range.

Once again, thanks for your help.

-Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#8
In reply to #6

Re: PWM Frequency Decision

03/14/2008 12:07 PM

I've used the IRF1010 and the IRF540. Both of these can handle 100V, IIRC. Remember you are switching an inductive load, though and slap a transient suppressor (TVS) across the load to keep the switching spikes down.

You can look at the data sheets and see if they will work for you. International Rectifier has a huge variety of fairly inexpensive MOSFETs.

I drove the PIC output to a 2N2222 transistor with a collector pullup to 12V for the gate voltage. There are logic level gate MOSFETs available as well if you don't have a 10-15V supply handy, as well as gate driver chips that convert your logic supply to a high gate voltage.

Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#9
In reply to #4

Re: PWM Frequency Decision

03/14/2008 12:18 PM

The inductance effects aren't too much of a worry for a DC motor (tho' it plays merry hell in a stepper drive system - if the inductance is too high, you can't get the motor current up quickly enough at high step rates, unless you use higher voltages).

There must be a way to work out the actual power loss as a function of switching frequency and turn-on & turn-off time of the switches (tho' I don't know how, off-hand). Sounds a bit complicated to me!

Generally, the higher your switching frequency, the more power loss (because if you're switching more frequently, the time spent switching ON and OFF will be a higher proportion of the total time). When I did some work with home-brew systems, we used to work at the lowest frequency we could that didn't produce a headache. If you get it right, you can keep the kids away! These were stepper drives, so the chopping rate had to be well above the fastest step rate needed (say 4 - 5kHz). I use Parker drives now, which chop at 20kHz.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#7

Re: PWM Frequency Decision

03/14/2008 12:05 PM

The motor doesn't seem to be putting out as much torque as I would expect, even at a 98% duty cycle.

The other guys seem to be answering your other questions just fine.
Do you get enough power when it is running of DC? If so then maybe the control circuit is dropping some voltage somewhere. There are plenty of very low RDS ON Mosfets out there.

It seems a bit over complicated to me.
If you want to use a DC motor I'd have thaught a motor with plenty of power, geared well down and simple voltage (or pwm) control would do it, and forget the feed back.

But maybe I'm barking up the wrong tree

Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12
#10
In reply to #7

Re: PWM Frequency Decision

03/14/2008 12:41 PM

Yeah, I always seem to get great advice on this forum. Actually the goal is to be able to control the speed to specific RPMs. Different types of metal being worked require different surface speeds for the bit. Different size bits give you a different surface speeds at different RPMs. Another issue is that while the bit is working the metal it requires additional torque to maintain the proper speed.

My final goal is to have a small controller box that you can enter in the bit diameter and required surface speed. The system would then calculate the proper RPMs and use the PWM system with feedback to maintain the appropriate speed while it is doing its milling operations. There is a keypad for input and a LCD screen for displaying options and spindle status.

I guess I should have given the project details earlier but I was mostly focused on the PWM issues at the moment.

-Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply
Guru

Join Date: Sep 2007
Posts: 1817
Good Answers: 7
#11
In reply to #7

Re: PWM Frequency Decision

03/14/2008 2:26 PM

You mean miauwing up the wrong neighbours window .

I think he wants the feedback to keep rpm constant under variable loads.

Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#12
In reply to #11

Re: PWM Frequency Decision

03/14/2008 2:40 PM

Yes ..I know that ..but...
A KrisDelTM Infinitely powerful motor, running infinitely fast, geared down with an infinity-to-useful speed gearbox won't be load sensitive and thus won't need the feedback

Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply Off Topic (Score 5)
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12
#13
In reply to #12

Re: PWM Frequency Decision

03/14/2008 2:48 PM

Dang Del, where can I get one of these KrisDelTM Infinitely powerful motors. They sound great. I really want to see the design of the Infinity-to-Useful gearbox. I always love violating the laws of math and physics and I think that one does both. Very Cool. I really want to see the system for getting by the Infinity/Anything = Infinity rule.

You always have the coolest toys.

-Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply Off Topic (Score 5)
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#14
In reply to #13

Re: PWM Frequency Decision

03/14/2008 2:58 PM

system for getting by the Infinity/Anything = Infinity rule.

It's just a little plastic sprag that drops into place after every infinity-n rotations of the input shaft (where n is determined by the 'useful output ratio'). The plastic tends to wear rather rapidly, but we provide a free bag of spare ones.

Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply Off Topic (Score 5)
Guru
United Kingdom - Member - Olde Member!! Engineering Fields - Instrumentation Engineering - New Member

Join Date: Jul 2006
Location: Dunstable, England
Posts: 2821
Good Answers: 45
#15

Re: PWM Frequency Decision

03/14/2008 4:01 PM

Doug, I think the others have helped you out and what I say may not be any more important... *sniff*

But if its one of those scooter motors, as you say, then they have a large inductance and huge losses at a high frequency - the same as a mains powered transformer would have at several kHz.

Those scooters have a variable pwm drive to alter the power to the moters... have you got the other parts to the scooter?

The throttle is just a potentiometer connected to a little box which houses the ingenious pwm circuit to supply power to the motor.... I've a couple of these someone was throwing away and so I had a look at how they work... the scooter motor is about 100 watts upwards... so at full power you should be seeing a current draw of several amperes, not just a few!!

I suspect the frequency is way too high for these motors, as others have said... why not grab one os these speed controllers and input a variable voltage in place of the throttle to give speed control?

Then all the power electronics are built for you!

John.

__________________
A little knowledge is a dangerous thing - Googling is far worse!
Register to Reply
Power-User

Join Date: Dec 2007
Posts: 120
Good Answers: 12
#16
In reply to #15

Re: PWM Frequency Decision

03/14/2008 4:40 PM

Regrettably I don't have any of the other parts since I got the motor off eBay.

Between the inductance and the rise time off the switch I may be losing a fair amount of my power. There is a significant difference between straight DC and the PWM signal at 98% duty cycle. I was thinking of a possible solution using a hand built PWM made from 555 timer ICs. It would be similar to your solution of using the original motor controller. I also liked the idea of just using an extra small PICAXE chip as a dedicated PWM system I could control more precisely. Since I am a better programmer than electrical engineer this idea appeals to me.

Over the weekend I will be able to take some of these ideas and try them out. Hopefully I can get this issue fixed and move on.

Thanks for the help,

Doug

__________________
A robot must risk his neck for his brother man, and may not cop out when there's danger all about. - Isaac Hayes' First Law of Robotics
Register to Reply
Guru
United Kingdom - Member - Olde Member!! Engineering Fields - Instrumentation Engineering - New Member

Join Date: Jul 2006
Location: Dunstable, England
Posts: 2821
Good Answers: 45
#18
In reply to #16

Re: PWM Frequency Decision

03/16/2008 10:13 AM

Doug, if you want one of those speed / power controllers, I've still got a few left over together with motors and complete scooters...

A 'friend' dumped 6 of them on my doorstep saying he was taking them to a skip - me being me had them for some strange project that I've forgotten about so they are sitting around doing nowt!!

If you want one just ask...

John.

__________________
A little knowledge is a dangerous thing - Googling is far worse!
Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#19
In reply to #18

Re: PWM Frequency Decision

03/16/2008 4:58 PM

A 'friend' dumped 6 of them on my doorstep..

Presumably these are the small kids scooters 'Make speedy walk on level ground' not the big sit on jobs?

I've been thinking of an electric scooter for some time... (think Lambretta...not scootalong with foot)...

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Guru
United Kingdom - Member - Olde Member!! Engineering Fields - Instrumentation Engineering - New Member

Join Date: Jul 2006
Location: Dunstable, England
Posts: 2821
Good Answers: 45
#20
In reply to #19

Re: PWM Frequency Decision

03/17/2008 9:22 AM

Yes, they are the 12 volt stand on things that are illegal to use on the pavement or road...

Probably why there are so many being dumped!!

The motors are good though... 100 watt with a power controller (twist grip) and nice poly wheels.... ideal for a project or two...

Motor for robotics / generator? sealed lead acid battery ... and wheels... mmmmmmmmm

John

__________________
A little knowledge is a dangerous thing - Googling is far worse!
Register to Reply
Guru

Join Date: Jun 2006
Posts: 501
Good Answers: 8
#17

Re: PWM Frequency Decision

03/16/2008 10:06 AM

http://www.nutsvolts.com/ has several circuits in their back issues.

Register to Reply
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#21
In reply to #17

Re: PWM Frequency Decision

03/17/2008 10:13 AM

I love Nuts and Volts. This month's electromagnetic coil launcher pistol is very tempting.

Register to Reply
Register to Reply 21 comments

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

bhankiii (4); case491 (1); drobertson (6); Electroman (3); jmart23 (1); JohnDG (2); user-deleted-1105 (4)

Previous in Forum: pv solar modules   Next in Forum: regenerative ac drive

Advertisement