Please visit the homepage for location and information on open hours


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CNC/Stepper Information
03-26-2015, 11:06 AM,
#1
CNC/Stepper Information
Okay, lots of questions came up last night about controlling steppers in various ways for CNC, RC, and other projects. Figured it might be helpful to summarize a few common implementations for reference. These are all Arduino based, but that seems to be the basis for most of the projects. You can also set them up to run off a parallel port, a PIC, FPGA, or basic TTL circuit but I'm not getting into that right now. Most of this assumes simple bipolar 4-wire steppers that are common for opensource desktop machines (there are many others, but covering them all would take a LOT of typing and they'er not as common in hobby projects).

For direct control from an Arduino, you can go with an H-bridge. It's basically a quad-amp setup so TTL level logic can control a stepper with 12+V. Also comes in a single-DIP form which is very convenient. You directly control the pins, so you need software functions to handle that (there are libraries online). Here's a good rundown: https://itp.nyu.edu/physcomp/labs/motors...-h-bridge/

The simple way is to use a Pololu A4988 driver. They're neat because you set step-size with three input pins, then the only controls you need are one pin for direction and the other for step pulse (each pulse causes the driver to move the stepper one step). Here's the manufacturer's page, but this applies to ANY 4988-compatible driver and you can get them from China/eBay for cheap: https://www.pololu.com/product/1182. If you're driving the steppers with high current, you will need small heatsinks and a fan to keep the driver from overheating. Some bad drivers will just burn when they overheat, the better ones just stall and will skip steps while in cooldown mode. If you notice a lot of motor stutter with a Pololu driver, it's probably overheating.

If you want a ready-made solution to reduce wiring or programming, there are lots of open source projects out there. Two I've dealt with and found to be very well done are GRBL and RAMPS. Both use Pololu drivers as a primary driver and accept gCode via COM port (gCode is a semi-standardized instruction set for CNC). There are lots of other board/firmware combinations like TinyG and Smoothieboard so don't take this as a complete list!

GRBL firmware runs on the Arduino Uno and works with several different shields. Very common for CNC router applications. It accepts a fairly expansive sub-set of gCode over USB via a COM port, supports endstops (homing and limit), and has motor control options. Only three stepper channels, though it's common to be able to clone one of the channels to put two steppers on a single axis (see CNC shield).
  • gShield/grblShield: Completely contained and comes assembled, screw mounts for motor wires. Have to be careful with the motor wires as they come out just above some solder points that will fry your Arduino if the motor wires come loose. However, this is the default driver setup for hobby CNC machines like the Shapeoko 2. gShield @ Inventables
  • CNC Shield: GRBL-compatible shield for mounting separate 4988 drivers. Nice for the occasional accidental blue-smoke release incident for the drivers which is easy to do if a wire comes loose. Has pins for plugging in motors, endstops, etc. Requires about an hour of soldering. CNC Shield (original from New Zealand) Apparently the Chinese have cloned it for cheaper (Chinese clone, Chinese clone 2, assembled w/ drivers), but I've only used the original from New Zealand. Drivers are also available on Amazon, eBay, etc for relatively cheap; they range from $2 to $5 each.

RAMPS is what the majority of hobby 3D printers use and it's available from a huge list of sources. It requires an Arduino Mega, but supports four stepper channels with the Z channel able to drive two steppers. Also has the ability to use endstops and leaves pins open for accessory expansion. Most common firmware is Marlin, but there a whole list of compatible firmware (check the entries that list RAMPS for their electronics). RAMBo is a variation of RAMPS, but with built in drivers and a single-board design. Some of the firmware options support LCDs so you can do things like 3D print with the machine without a computer attached.

Both accept gCode over USB COM, so there is a huge list of free programs that generate gCode and allow you to control the machine. I use gcodesender for basic control, you can use terminal and the like as well. There are other application-specific applications that give you command buttons to move each axis, read temperatures, enable motors, etc.

If you're not doing something CNC based and using something other than gCode to control the steppers, but want a simple setup, best bet would be a GRBL or RAMPS shield with your own custom firmware as long as your project doesn't need more than 3 or 4 channels. All your firmware needs to do is match the pinout, set the direction, and generate the pulses to move the correct number of steps. Also, if you're testing, be aware that you should probably pull any drivers you're not using off the board as powering them without a stepper attached can release the magic blue smoke.

Questions, comments, corrections, or suggestions always appreciated. Hope I provided a starting point for those thinking about using steppers to make their Arduino project move.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)