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! > Electronics > PIC Programing / Design


PIC Programing / Design Discuss programing of PIC chips here and design of electronics using PIC chips.


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 08-20-2010, 11:15 PM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road
Another Lini Hack, some Qs

I bread boarded a linistepper clone using op amps and power mosfets in a classic voltage controlled current source fashion. Keeping w/the linear theme Im using a dual 8 bit r2r ladders to control the feedback circuit w/o pwm. On the firmware side Im running a simple state machine using romans high torque half stepping on a 18f4620 in C.

All works well but I have a Q regarding step rate. Judging solely on the sound and motion of the motor a step-rate of 750uS seems best. I have a LMS S2x on order and cobbling some old pc parts to run EMC. In the interem how best can I test the driver performance? The current circuit switching speed is limited to 20uS, but I plan on getting some higher bandwidth op amps.
Reply With Quote

  #2   Ban this user!
Old 08-22-2010, 10:24 PM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road

well Ive run 1/2, 1/4, 1/8, 1/16 all in hardware (r2r ladder) and all works well. I epoxied a NTC thermister into a heatsink that the mosfets are mounted to and under single stepping the heat sink never broke 40C. Im also using 1R 10w Rsenses for each phase but I think this is over kill. That and they are low tolerance cement types so just using 2 would be better.

The proto circuit seems to work fairly well so Im going to go ahead w/a pcb. Before I do I want create a scaling VDD supply for the uC since the r2r ladder is driven driver directly off the io ports, that way i can have true 8 bit resolution for 2.5a to 5A a phase.

Some blurry pics of the proto board and a single phase running 1/8.


Reply With Quote

  #3   Ban this user!
Old 08-25-2010, 12:09 AM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road

Well there doesn't seem to be much interest in this thread but I like posting stuff on the innerweb so Im attaching a prelim schem the circuit.

In a nutshell I monitor step/dir and brake lines and scale the current as indicated by the logic. The IO front is pretty straight forward, IIRC the A port is open collector so these will req pull ups/downs depending on what EMC logic dictates. I included a 485 transceiver so I can calibrate the boards via a gui. Ill add another r2r ladder to adc pin for hardware settings. The switches are just 3 pin headers that switch between IO and ICSP to program in circuit (this will be smt).

The drive side is a classic voltage controlled current source w/feedback. I chose r2r ladders as they are fairly inexpensive and provide better linearity/response than pwm. I usually buffer uC io lines but according to a app note I read so long as the load impedance is > 255 times the pins source your good. 20k Rs are used and it seems to work well w/o distressing the uC. Any rate the ladders scale the vdd voltage to the op amps that will drive the gate of the fets to a point where their feedback matches there input. The feed back is supplied via the Rsenses connected to the source of the fets. What you end up w/is a current that equates to Vin/Rsense, scaling Vin scales current sunk by the fets. To control the four phases each fet gate driver is pulled down by another fet. This reqs the voltage followers preceding the gate drivers as shorting the drivers output could potentially pulldown the V+ rails. I could have put in series resistance to avoid the voltage followers but I was afraid that w/the fet capacitance would kill switching time. I problably should add weak pulldowns to the fet gates as well.

Any input would be appreciated, especially critical input as dealing w/inductive loads is new to me and Im sure Ive made a few misteps
Attached Thumbnails
Click image for larger version

Name:	LinearStepDriver.jpg‎
Views:	103
Size:	80.6 KB
ID:	113405  
Reply With Quote

  #4   Ban this user!
Old 08-25-2010, 12:39 AM
doorknob's Avatar  
Join Date: Jan 2010
Location: USA
Posts: 1,240
doorknob is on a distinguished road
Buy me a Beer?

I don't think that I have any experience driving steppers or other inductive loads with power FETs, but way back when I once did such a thing with bipolar transistors, it was recommended to use a reverse-biased diode across each coil, to shunt any back-EMF inductive voltage spike (due to switching the inductor current) away from the driving transistor. But then maybe you're microstepping within the linear range of the devices instead of on-off switching with them, and so maybe it's less of a concern (or maybe the power FETs have substantially higher breakdown voltages than what I used to deal with). For all that I know, maybe steppers these days have the diodes built in. Or not.
Reply With Quote

  #5  
Old 08-25-2010, 06:11 AM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,251
RomanLini is on a distinguished road

No the motors don't have internal diodes.

Nice build. It's a little over-complex (and over-PICed) for one motor driver but it should perform pretty well. May I suggest adding 2 caps on the 2 outputs of the R2R ladders, to give linear smoothing between microsteps as per the Linistepper.

Diodes from the 4 motor coils to PSU+ may be needed if your FETs are lowish voltage. With linear drivers and especially once linear smoothed the swing voltage on the open coil of the unipolar pair rarely reaches 2x PSU voltage. So if you have a 25v PSU and 100v rated FETs you have an ok safety margin and diodes are not needed.

If you want to build a couple of these for a CNC machine you can get R2R networks ready made in DIL package from Farnell. Otherwise, if you know the microstep resolution you need (like 1/16) then you can use a lot less resistors and choose the values to compensate the non-sinusoidal torque curve of the motor, as you don't need true 8bit resolution and trying to replicate proper sine/cosing curves is not needed and actually worse than custom selected microstep values.

Thanks for the photos. It looks like you had some fun wiring all that up on the breadboard! Are you going to build this on PCB for real world use or is this more a learning exercise? If you are going to build it then it's probably worth posting PCB and parts values etc so people can offer improvements and suggestions.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-25-2010, 09:52 AM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road

it was recommended to use a reverse-biased diode across each coil, to shunt any back-EMF inductive voltage spike (due to switching the inductor current) away from the driving transistor.
Knob, yes your are right, regardless of the switch always a good idea and it cant hurt.

Roman, first off thanks, I really enjoy your site and approach. Very helpful.

May I suggest adding 2 caps on the 2 outputs of the R2R ladders, to give linear smoothing between microsteps as per the Linistepper.
You mean as integrators vs filters? I must admit Im having a bit of trouble wrapping my head around this smoothing as I thought the aim was to provide a discrete current for a fixed time. How does the smoothing not effect step error?

If you want to build a couple of these for a CNC machine you can get R2R networks ready made in DIL package from Farnell. Otherwise, if you know the microstep resolution you need (like 1/16) then you can use a lot less resistors and choose the values to compensate the non-sinusoidal torque curve of the motor, as you don't need true 8bit resolution and trying to replicate proper sine/cosing curves is not needed and actually worse than custom selected microstep values.
I cant rembember the manu at the moment but I have precision 16 pin 8bit ladders. When i was first looking at doing this I was just gonna use typical .1% resistors in a 5 bit fashion and squeeze it all on a 28pin uC, but i had no idea what motor/current and by default Rsenses I would need so I decided to forgo being clever and went w/a bigger chip.

I ended up w/2.3A phase motors

Thanks for the photos. It looks like you had some fun wiring all that up on the breadboard! Are you going to build this on PCB for real world use or is this more a learning exercise? If you are going to build it then it's probably worth posting PCB and parts values etc so people can offer improvements and suggestions.
Yes im usually too lazy to bread board stuff and wind up on rev H before I get something working the way I want lol. This time tho I just did it as this is new to me. yeah Im gonna get boards made, I used to toner transfer and etch my own but Its just not cost feasible (too little free time) compared to using expresspcb. It will be smt as thats what i have access to and Im pretty sure I can get 2 circuits on a single proto board and get 3 proto boards fairly cheap.

If your interested Ill definitely give you one if you like to play/scrutinize it.

This if for learning and personal interest, no intent on selling or marketing anything.

Thanks again
Reply With Quote

  #7  
Old 08-26-2010, 10:04 AM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,251
RomanLini is on a distinguished road

Originally Posted by wayneosdias View Post
Knob, yes your are right, regardless of the switch always a good idea and it cant hurt.
Actually it can hurt. Diodes there cause a "slow decay" effect that takes longer for the magnetic field to change direction etc, "Jones on steppers" covers the decay modes and recirculation currents pretty well although it's a little dated now as a reference. Without the diodes you get good high speed performance, and as unipolar linear the most voltage you will get on the open end of the winding is about 2x the PSU voltage, usually even less with Linis because they are smoothed and the swing is slower.

Originally Posted by wayneosdias View Post
Roman, first off thanks, I really enjoy your site and approach. Very helpful.
Thanks. I really appreciate that. It's just a mish mash of thrown together hobby stuff mainly. I like giving free ideas and designs etc back to the world but this China thing is getting me down lately. It seems they are sucking up everyone's goodness and churning out crap for profit that only they benefit from - often at the expense of the rest of the world when nasty crap products beat out well made stuff that people built with care. It's almost like turning good into bad, and where this next 5 or 10 years is going to end up I really don't know. I'm almost wondering if I'm going to bother giving ideas away any more, and that bothers me more than China; when the good people stop being good because the bad people are being bad. Anyway that is way too philosophical and off topic to boot.

Originally Posted by wayneosdias View Post
You mean as integrators vs filters? I must admit Im having a bit of trouble wrapping my head around this smoothing as I thought the aim was to provide a discrete current for a fixed time. How does the smoothing not effect step error?
Yes as integrators. The Lini uses 2.2uF tantalums, which is about right (for it's resistors) to give smooth transition from one microstep to the next, at somewhere around the primary resonance. At lower speeds or stopped you still get the accurate microstep current but with smoother transitions. At the resonance it is greatly damped because the "steps" have practically disappeared. And speeds above the resonance the waveform starts to approach a sine anyway with the integration and the motor inductance both working to smooth the system.

Apart from being tuned that way, you can also tune for a particular speed (as in Linistepper being used to drive a telescope) by picking the caps to JUST smooth the microsteps at that fixed motor speed.


Originally Posted by wayneosdias View Post
I ended up w/2.3A phase motors
Those R2R ladders would be nice and clean. As for the motors, it's going to get a little toasty at 2.3A. Depending on your machine needs you might have 15v or 20v PSU over the motor voltage so you are talking 2.3A x1.414 x 20v = 65w heat from each motor driver...

That's one of the reasons the Lini has remained a 1A driver, at least in the full microstepping form.

Thanks for the offer of a board but I'll probably decline, I'm just way to busy at the moment with "real work" stuff to do much fun stuff.
Reply With Quote

  #8   Ban this user!
Old 08-26-2010, 10:58 PM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road

Roman, again thanks.

I had no idea re the flyback diodes, makes sense tho.

You are correct re the power dissipation as well. My initial post I was driving the motors w/an old atx psu at 12v, ruffly half what I have planned. Heat will be an issue and will req managment. The power mosfets can be paralleled but this raises other considerations for them being mounted off board, which I had planned.

Since you seem to enjoy pats on the back, I have to say, prior to finding your site I was about build a LMD18245 based circuit (I was sampled 5). I really like your approach of making the silicon sweat vs the motors.

Cheers
Wayne
Reply With Quote

  #9  
Old 08-27-2010, 05:41 AM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,251
RomanLini is on a distinguished road

Haha everybody enjoys pats on the back - of course. Speaking of which you have done most of the work already writing the firmware and testing with the parts on breadboard.

Please don't let me talk you out of making a Lini type driver setup, there are payoffs in terms of fantastic motor smoothness and better CNC cutting because of it. It may limit your max traverse speeds a little but all that depends on your machine needs. There's too many posts on the forum where people seem obsessed with big speeds when really you need a machine that works really well at the actual cutting speed, and is efficient enough in traverse.

If you do go ahead with building the drivers there are other payoffs too in satisfaction and in ability to repair, modify etc. Since you have all the firmware skills you can easily add features to your drivers, or automate them, or change microstep modes at particular speeds etc to tune out resonances on your exact machine. All those payoffs are lost if you go to a commercial driver or standard dedicated driver chip.

Anyway I wish you good luck with the endeavour whatever option you choose.
Reply With Quote

  #10   Ban this user!
Old 08-28-2010, 12:35 AM
doorknob's Avatar  
Join Date: Jan 2010
Location: USA
Posts: 1,240
doorknob is on a distinguished road
Buy me a Beer?

Originally Posted by doorknob View Post
For all that I know, maybe steppers these days have the diodes built in. Or not.
OK, that part was intended to be (a weak attempt at) humor...

Regardless, I've found this discussion to be interesting... I'm looking around for an inexpensive stepper driving solution for a DIY project, and I'll take this info into consideration...
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 08-28-2010, 12:38 PM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road

Originally Posted by doorknob View Post
I'm looking around for an inexpensive stepper driving solution for a DIY project, and I'll take this info into consideration...
Romans design can be relatively inexpensive when using low current motors compared to say the LMD18245 circuits. I can also say that the LiniStepper kit being offered is an excellent value that would be difficult to reproduce for the cost. My spin on his design makes the uC firmware ridiculously ez to write/implement w/added circuit complexity and cost. Tho id say in the low current form still far cheaper than the LMD based circuit.

The substantial costs of my circuit are the op amps and if higher current driving is desired the Rsenses. Considering that the opamps used for my circuit should be rail2rail, single supply, precision w/good bandwidth. Typical cost for duals are ~$3-5 each and reqs x4 in its current form. As Roman has pointed out repeatedly power dissapation of the switches and Rsenses are the lynch pin of this design. For my circuit the power mosfets can be paralleled within reason and very low cost ~$.30-.50 each. The Rsenses on the other hand can get very exp w/moderate wattage/tolerance at $5-10 each, they become the most exp component.

The goal at this point for me is to get the circuit running w/the motors I have 2.3a phase and use brute force to keep things cool (cpu sinks/fans). Rsenses and power mosfet w/be off board. Im adding a thermistor biased comparator circuit for a thermal shut down. Once done I plan to map the thermal characteristics in a temp chamber, from there I can determine what the real capability of the circuit will be.

Just brainstorming here, but anyone know how to go about making low impedance dummy loads? I know back in the old days techs would just use plumbing pipe to test output transformers. i wonder if this concept could be used for the Rsenses, obvioulsy tolerance w/be a key issue.
Reply With Quote

  #12   Ban this user!
Old 08-28-2010, 07:55 PM
 
Join Date: May 2007
Location: usa
Posts: 14
wayneosdias is on a distinguished road

Well two revelations today, exceeding Vds causes fets to fail short and releases the magic smoke out of components

Re the Rsense power dissipation issue, why not make a low ohm shunt and scale the gate drive feedback signal? Need to play w/the numbers more, may cost more tahn just getting to-220 package resistor.
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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cricut Hack asenna Printing, Scanners, Vinyl cutting and Plotters 6 06-25-2011 08:12 PM
Lini-Stepper Revisited ( Hacked ) kowell PIC Programing / Design 103 10-20-2009 11:34 PM
best microstepping driver (Lini/pictsep) student1616 Open Source Controller Boards 0 09-05-2008 12:36 PM
Lini-Stepper Revisited ( hacked ) kowell PIC Programing / Design 0 06-29-2007 06:12 AM
Lini Mod OCNC PIC Programing / Design 0 07-24-2006 10:19 PM




All times are GMT -5. The time now is 03:46 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