CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > OpenSource CNC Design Center > Open Source Controller Boards


Open Source Controller Boards Discussion for Open Source CNC type Controller Boards and other related items. (for personal use only)


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 02-28-2006, 10:14 PM
DukerX's Avatar  
Join Date: Jun 2005
Location: Norway
Posts: 22
DukerX is on a distinguished road
Discrete transistors and AVR microcontroller

I'm currently working on a project that uses one AVR Mega48 microcontroller to drive four MOSFET's using hardware PWM and hopefully no current sensing resistors.
This is for unipolar motors.

Basic concept:
I have hooked 4 PWM output lines to the gate pins on 4 IRFP250 transistors (not the best choice, but those are the only ones I have 4 of).
The AVR is running at 20MHz, and the PWMs are 8bits and no prescaler.
PWM frequency is 78.125kHz.
The PWM values are stored in EEPROM, and can be programmed throug a standard PC com-port to match each motor perfectly.
Utilizes the lo/hi current output in MACHn

What I have discovered:
The IRFP250 parts can handle >30 amps continiously, but due to the rather slow switch-on/off times they start to heat up at less then 1A
To solve this, I could get some faster transistors and / or slow down the PWM to maybe 20kHz.
In my silly attempt to do microstepping, I guessed that a SIN/COS function on the duty-cycle would be the right thing to do...
While a SIN/COS function on the current in the A/B coils would definetly be the ideal way to do microstepping, that doesnt mean that setting the PWM duty cycle to a SIN/COS function would be good, unless the motor have zero inductance, and the transistors have zero switching time...
I did some measurements on the PWM duty-cycle to current ratio, and have plotted the results for two of my motors in this grap:

To get the results as accurate as I could, I built a monster filter between the transistors and the power supply, and placed the ampere-meter between the filter and the PSU.
As you can see, the relation between motor current and duty cycle is far from linear... It's really very exponential... To the power of ...alot!
I also plotted this grap. showing the difference between the motors.

If this had been a more or less straight line, I could have done some fancy computations to compensate for the hugely nonlinear nature of the current/duty-cycle ratio, but as you can see, it's not very straight at all...
This makes microstepping really hard!
Still, I managed to do a fairly decent torque-compensated half step by just using two sliders in a windows program, that would set the PWM values "live" by feeding it to the processor throug a COM port.
One slider is for the max value, and the other are for the reduced value.
Extending on this idea, I think it would be possible, by using SIN/COS to calculate the apropriate current value for each microstep, and using more sliders to adjust the PWM values "live" until the desired current for that microstep is showing on the A-meter.
Not a very neat way, but I beleive it could work.
Almost the same as using current sensing, but it's a one-off for each motor, and never have to be done again unless some of the components are changed (Power-supply, motor or transistors).
Reply With Quote

  #2   Ban this user!
Old 02-28-2006, 10:35 PM
 
Join Date: Jan 2004
Location: GTA CANADA
Posts: 122
davesaudio is on a distinguished road

IIRC- I don't believe an AVR can drive those fets hard enough
__________________
maybe...
Reply With Quote

  #3   Ban this user!
Old 02-28-2006, 10:38 PM
DukerX's Avatar  
Join Date: Jun 2005
Location: Norway
Posts: 22
DukerX is on a distinguished road

The FET's I'm using are far from ideal, but that's not the point...
Reply With Quote

  #4  
Old 03-01-2006, 01:43 AM
*Registered User*
 
Join Date: Feb 2006
Location: Netherlands
Posts: 77
Carel is on a distinguished road

I have looked at the datasheet of the irfp250 and it has a low "on" resistance. You already encounter dissipation problems at 1 amp. This and the nonlinearity points to slow driving of the gates of the mosfets. For this mosfet you need a gate driver in the range of 12-15 volts, which can charge and discharge the gate fast enough to give a "digital" drive (Instant On, Instant Off, No ramping). Normally the PWM frequency is chosen at just above human hearing frequency (20Khz) to have the lowest dissipation problems. This mosfet should not heat up at 1 Amp.

Carel
Reply With Quote

  #5   Ban this user!
Old 03-01-2006, 08:21 AM
 
Join Date: Dec 2005
Location: USA
Posts: 3,319
NC Cams is on a distinguished road

We learned a LOT about mosfet switching when we were doing R/C car motor controllers. The findings apply here. Oh, and use of the proper fets IS part of the point as is a proper driver....

You MUST overcome the fet gate capacitance in order to turn it on. The FASTER and HARDER you can turn it on, the less internal resistance will exist ahd the less of a problem you'll have with heat generation. If you don't turn it on full (ala "ramping") you'll have heat. PERIOD.

We were initially using IRFZ40's in our speed control. They had low resistance and high current potenial YET we'd see tremendous heat build up. When we looked at the current curve while driving at what should have been a square wave, PWM'd drive, you could literally see that the wave WASN'T square - the fets were turning on slow.

Result was that the turn on wasn't complete and during the inrush phase of current flow, resistance was high which resulted in the over heating effect.

Via experimentation, we found that by building a driver that would provide the gate limit voltage of 20vdc for that particular fet, things got lots better. We still had a bit of an issue as we were trying to switch 80-100 amps with an oscillator derived 20 volts (system was 5vdc battery power). We still had some "non square wave" turn on response. The voltage was there but we still had problems overcoming the gate capacitance....

We then tried a new (at the time) IRLZ44 logic level fet. ALthough designed to drive at 5vdc, they had a gate tolerance of 10vdc. HUGE difference. We could derive a relatively robust 10v bus with a bit more current so as to drive the fet gates.

When we could generate a true square wave turn-on and current flow, wah-lah, the fets ran at room temp even while switching on the desired current.

BTW, we were driving 6 in PARALLEL which was why we had a problem turning them all on with the limited bus driver voltage. The voltage bus was derived via step up of the 5v battery voltage. Circuitry was TINY and current density high. Imagine switching 80-100 amps at 3-4khz with a controller that had the foot print 2/3 the size of business card....

Your driver circuit is SUPER critical as is your mosfet selection, especially when you're driving at 20-30Khz frequencies. You MUST turn the fets ON and OFF in a tru square wave fashion at those switching speeds to keep fet resistance low and heat under control....

I'd say the if you used a ROBUST driver and appropriate fets for the application instead of whatever is lying around, the heat problem in your fets will be eliminated...

Last edited by NC Cams; 03-01-2006 at 08:25 AM. Reason: fix typos
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 03-01-2006, 04:30 PM
DukerX's Avatar  
Join Date: Jun 2005
Location: Norway
Posts: 22
DukerX is on a distinguished road

Yeap...
I DO have a problem whit non-square gate voltage on my fets.
I know this causes problems.
As this is just an experimental unit, I resorted to using whatever I had on hand.
The whole idea was to see what it would take to make it work.
I'll do a few more experiments whit my highly unsuited fets, just to see if I can make it work the way I originally intended, or if I should shelve the whole idea, and use a more common chopper design.
If I could just speed things up a little, I think this could be a really neat device, whit a very low part count.

I'll get back when I have more test data to show...
Reply With Quote

  #7  
Old 03-01-2006, 05:10 PM
*Registered User*
 
Join Date: Feb 2006
Location: Netherlands
Posts: 77
Carel is on a distinguished road

DukerX:

Don't give up, for the commanding of the mosfets (and yours are suitable enough) you need a component layer between the controller and the mosfets. This layer makes your driver more flexible. I use a complete discrete component layer for driving the mosfets, and yes it's 3 transistors and 6 resistors but it is working the way it is supposed to be. The main value of your design should be in your program. And you are learning the mainstream controller, the AVR. Side question, already smoked out an STK500 board? The reliability seems to be embarrassing.

Carel
Reply With Quote

  #8   Ban this user!
Old 03-01-2006, 05:51 PM
DukerX's Avatar  
Join Date: Jun 2005
Location: Norway
Posts: 22
DukerX is on a distinguished road

I replaced the transistor I'm conducting my current/PWM tests whit a 2SK1936 part, wich has slightly lower switching times, and as far as I can tell, the gate/source capacitance is lower too, as the gate voltage now are closer to perfect square wave.
During the test, I observed that this transistor makes alot less heat then the IRFP250 I used before.
I also reduced the mcu clock to 8MHz, giving a PWM frequency of 31,25kHz
The reduced PWM frequency resulted in much less heat forming in the transistor, but also shows the current starting to increase rapidly when the flyback voltage stays at 2*Uinn, and the flyback diode in the transistor unloads the reverse voltage from /A back into the supply voltage.
This can be seen in the following graph:

Look at 50,4%.

Rumors have it that the motor current is going to change when it starts moving... If this is true, my attempt is in vain.
The only thing to do, would be to pop inn some current sensing resistors, and build a proper chopper driver instead.


Regarding the STK500... It's funny you should ask... I have already fried one of those, but that was entirely my own fault. I did something wrong while I had it hooked up to a Sanyo STK6713 integrated chopper driver. I hadn't adjusted the chopper properly...
The STK6713 chopper blew, feeding the back-emf into the AVR on the STK500, and after punching through that, went on to fry much of the STK500 components. Even blew off one of the capasitors.
I'm glad the STK500 took the punch, cause it was hooked directly to my computer on the 12V line, COM port and printer port...
Reply With Quote

  #9   Ban this user!
Old 03-01-2006, 06:23 PM
pminmo's Avatar  
Join Date: Jun 2003
Location: St. Peters, Mo USA
Age: 59
Posts: 3,325
pminmo is on a distinguished road

DukerX,
Without a realtime true current measurement/sense your efforts won't yield a workable solution for microstepping. Many factors involved. Your experiencing MOSFET drive issues on the gate as well, unless you are using a logic level gate with relatively low gate capacitance, the AVR's outputs are going to be over taxed at fequencies necessary to do chopping and microstepping.

That solution is to drive with a MOSFET driver such as a Microchip TC442x or a MC3415x. IRF has a good ap note on your problem: http://www.irf.com/technical-info/appnotes/an-937.pdf
__________________
Phil, Still too many interests, too many projects, and not enough time!!!!!!!!
Vist my websites - http://pminmo.com & http://millpcbs.com
Reply With Quote

  #10   Ban this user!
Old 03-01-2006, 08:43 PM
 
Join Date: Jan 2005
Location: Toronto, Canada
Posts: 1,102
H500 is on a distinguished road

Duke, I think the biggest drawback with the open loop PWM approach is that the rise time of the current in the coils is too slow. You won't be able to spin the motors very fast before they stall.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 03-01-2006, 09:03 PM
 
Join Date: Dec 2005
Location: USA
Posts: 3,319
NC Cams is on a distinguished road

Until you drive the fets on HARD and FAST, you can't judge the system performance.

Once you get that accomplished, you then start to use lower on resistance fets so as to drive the resistance point someplace else. Simply use a GOOD driver with lots of oomph and the lowest resistance logic level fets suited for your type of useage potential...

I think that the current rise time issue is addressed by running higher voltage. I think this is why the P/S voltage is so much higher than the rated voltage of the motors (25x or so if memory serves correct).

Once you get your switching circuit to switch the fets on in true square wave fashion at the current level desired, you can then start working on the inductance issues.

Ultimately, however, the motors will run at a max speed for a given applied voltage/current relationship - you can't push a rope so to speak.

You can help out the mosfets by putting diodes around them. Yes they have built in diodes BUT in some instances, you need external diodes (pretty sure schottky or some other ultra high speed items) to deal with back emf being kicked back by the motors.

While your at the IRF website, look around for other app notes relating to PWM motor controls. Chances are, they've already dealt with the problems you're just getting to deal with, especially with regard to high speed printer applications....
Reply With Quote

  #12   Ban this user!
Old 03-01-2006, 10:39 PM
 
Join Date: Jan 2005
Location: Toronto, Canada
Posts: 1,102
H500 is on a distinguished road

Even with high voltage and maximally driven mosfets, I expect that the rpm would only match what is possible with a 3 volt supply. (assuming that 3v is the motor's rating)
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -5. The time now is 05:18 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361