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 06-11-2011, 04:34 AM
 
Join Date: Jun 2011
Location: Scotland
Age: 46
Posts: 2
Dragonlaird is on a distinguished road
Post L297/L298 Bipolar Driver Circuit with Limit Detection

I originally posted this on DesignSpark to give something back for the great, free PCB design app they have provided, figured it's more likely to be useful here, in the CNC community.

Incidently, I have also designed/built a similar circuit using the Allegro A397X chips, written my own Arduino library for a G-Code interpreter and designed my own app for parsing/transmitting the G-Code to the Arduino (with real-time display of the CNC output) - If you're *really* kind, I *might* post these at a later date

Dragonlaird

===[SNIP]===
I am building myself a CNC machine based on a programmable Arduino UNO to act as the G-Code interface between the PC and the CNC. I needed to drive the stepper motors and found plenty of ready-made boards I could buy to do the job.
My first problem was the usual budget constraints - I have been building the CNC for several months, buying parts each month to spread the cost but I couldn't really justify to "she who must be obeyed" that the expense of 3 motor drivers was a necessity. So building the circuits myself was the only way I could break down the cost and come in cheaper than the ready-made boards I had seen.
The second problem was that my Arduino pins are nearly all in use just controlling the stepper motors and other parts that I've planned/designed into the CNC (such as an optional/exchangeable 3D print head, controlling the main PSU on/off etc). I didn't really have the pins I needed to detect if the CNC had reached its limits (X, Y and Z).
So I designed this circuit to allow the stepper motors themselves to stop if they reached their limits. At the time I was also considering sacrificing the ENABLE pins of the Arduino/Steppers too, so the circuit enables the stepper motors by default.
I ordered the PCBs from the US Dorkbot PCB manufacture service at a cost of $5 per square inch, for that you get 3 copies of your PCB - perfect for me as I had 3 motors to drive.
I had already built a prototype using stripboard and it seemed to work fine but was a little on the large size (about twice as big as the PCBs I had designed) so I was eager to see if my PCB version would work as well as the prototype.
I built and tested the first board - it worked perfectly. The L298 chip reached about 60 degrees C without any heatsinking, well within the design tolerance, and the rest of the board stayed nice and cool.
Since it worked so well, I decided I would share the circuit for others to build the boards for their own use.

The board provides several inputs/outputs and options:
2 power inputs:
5V for the circuitry and 5-36V for driving the steppers themselves, although I just used the same 5V supply for both inputs on mine which worked fine for me as my stepper motors were only rated at 3V.
Enable: (optional)
Allows you to enable/disable the stepper motor.
Direction:
Clockwise or counter-clockwise stepping of your motor
Step:
Steps the motor once, toggle this line for repeated stepping of the motor in the given direction.
Limit Clockwise: (optional)
Stops the motor from turning clockwise, useful for when a limit switch has been reached. Pulling the limit pin low forces the motor to stop responding to any further step requests in the clockwise direction. The circuit does provide a 0V pin next to the limit pin to just connect a switch.
Limit Counter-Clockwise: (optional)
Same as above for the reverse direction
Step Size:
Allows full or half-step modes to be used by simply changing a jumper position
Control Mode:
Uses a jumper to select between using the inhibit or output methods for control limiting.
Sync Clock:
A jumper selects between internal and external Sync options. In External mode it provides a pin for connecting the external sync. I just use the internal clock since the timing of my motor steps isn't that critical and it's all controlled by the Arduino anyway.
Motor Out:
4 pins to connect your stepper motor. Remember, this circuit is designed for bipolar steppers only. You need to read the spec on your motors to determine the correct wiring of your motor fly leads.
Current Limit:
A trimmer resistor for altering the output current driving the stepper motors. Note: this trimmer works in reverse to what you might expect, clockwise rotation actually LOWERS the output current.

If you have problems with your motor appearing jittery when no step/dir signal is applied, you plobably need to tweak the current limit trimmer. If the stepper seems to respond to step/dir but doesn't appear to step in the same direction for each successive step request, you probably have the stepper motor wired wrong.
This circuit is provided as-is, with no warranty or fit-for purpose statement. This circuit works fine for me but use it at your own risk.
Attached Files
File Type: zip Bipolar Stepper Driver.zip‎ (47.0 KB, 409 views)
Reply With Quote

  #2   Ban this user!
Old 06-11-2011, 05:22 AM
mmcp42's Avatar  
Join Date: Dec 2010
Location: UK
Posts: 219
mmcp42 is on a distinguished road

very interesting
I have a UNO based gcode interpreter

be very keen to see how you've done yours
(you show me yours - I'll show you mine...!)

I tried to open the .sch file - I guess it isn't EAGLE compatible (well being DesignSpark I guess I'm not surprised!)

I've often wondered if it's better to go with a microstepping controller or just full step with an H bridge - what's your take on the difference?

thanks for sharing
Reply With Quote

  #3   Ban this user!
Old 06-11-2011, 06:57 AM
 
Join Date: Jun 2011
Location: Scotland
Age: 46
Posts: 2
Dragonlaird is on a distinguished road

Originally Posted by mmcp42 View Post
very interesting
I have a UNO based gcode interpreter

be very keen to see how you've done yours
(you show me yours - I'll show you mine...!)
Send me your email address and I'll email a copy - I've avoided using interrupts and PWM as they have limitations, mine still needs optimising to reduce the size of the code but at 16.5K in size, I'm not too worried at this stage - Provides support for most commonly used G and M codes (plus variable feedrates etc) but doesn't have inertial compensation yet for direction changes but since my CNC is designed around accuracy rather than speed, that's not an issue for me yet.

Originally Posted by mmcp42 View Post
I tried to open the .sch file - I guess it isn't EAGLE compatible (well being DesignSpark I guess I'm not surprised!)
I should have explained the files are DesignSpark format not eagle etc - My bad... Since DesignSpark is free, it's not a problem for people to download it to open/edit the files if required. I generally don't like the image/PDF files people upload since most PCB fabricators can't use them and besides, someone may improve on my circuit further...

Originally Posted by mmcp42 View Post
I've often wondered if it's better to go with a microstepping controller or just full step with an H bridge - what's your take on the difference?
I considered this point at length when designing my own CNC - Being a bit of a perfectionist, I designed my second circuit (the A397X design I mentioned) to improve on accuracy even further - It was only afterwards I worked out that controlling the CNC to within 0.0003125 of a millimetre was becoming a bit anal - Since cars passing by the house or some whale belching on the other side of the world was likely to introduce a vibration greater than that, I decided that the extreme accuracy provided by microstepping was not required if the physical design of the CNC provided smaller movement anyway.

My CNC is using an M6 (1mm pitch) stainless steel threaded bar for all axis. Thus, a 200-step motor provides 1/200th of a millimetre in full-step mode, even better in half-step mode - so realistically, why would I need greater accuracy than that? That's equivalent to about 1 thou of an inch - If I need greater accuracy for milling wood/plastic etc (bear in mind this is for a hobbyist - not commercial production) then I would need to consider temperature controlled environments, vibration dampening, precision made materials etc - I little bit overboard methinks. Using the 1/16th microstepping capability of the Allegro would means working in fractions of a thou, I suspect the tolerances for milling bits alone exceed that.

If I had used a larger pitch for my drive threads, then perhaps microstepping would be needed but since my CNC is moving very slowly with the smaller threaded bar, it moves slower which means virtually no inertia, smaller (cheaper) motors can be used and the only difference between my CNC and some of the more common DIY CNC designs out there, mine is cheaper and slower - the output is still the same.

Originally Posted by mmcp42 View Post
thanks for sharing
You're most welcome - Fingers crossed I can help some others get into this when their main stumbling block is cost (i.e. "she who holds the purse strings" has to be convinced it's affordable)

Dragonlaird
Reply With Quote

  #4   Ban this user!
Old 08-04-2011, 05:11 AM
 
Join Date: Aug 2011
Location: South Africa
Posts: 1
quentinuys is on a distinguished road
Smile Cheaper CNC Machine

I believe that is every mans most challenging part when creating a CNC Machine.
Quote "She who holds the purse string"

LOL, Very well said.
Reply With Quote

Reply

Tags
bipolar, driver, l297, l298, stepper




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


Similar Threads
Thread Thread Starter Forum Replies Last Post
L298, L297 Stepper Driver abbe Open Source Controller Boards 20 01-13-2012 11:45 AM
Problems with l297/l298 based driver Jykke Stepper Motors and Drives 21 01-13-2012 11:44 AM
L297 bipolar using mosfets instead of L298? nullbert Open Source Controller Boards 7 10-14-2010 03:52 PM
PMinMo L297-8 bipolar driver resistance watt KC Chin Open Source Controller Boards 4 02-02-2010 04:45 AM
l298 l297 driver 2A with stepper 3A help chawkiz OpenSource Software 4 06-05-2009 09:09 AM




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