Motorized mayhem

Caution!  Hyperbole warning!

All right, so there is no mayhem involved.  But there are motors.  Stepper motors, to be exact.  Four of them.  Over the weekend I built my RAMPS module (Aah, solder fumes!) and I am pleased to crow about the fact that it worked first time.  In case you don’t know, this is an arduino shield which integrates the majority of the external components required for a 3d printer.  It can host 5 stepper motor drivers (I only need 4 at the moment, but it gives me the option to add a second extruder), manage the inputs from end stops, thermistors and other safety devices, and can provide power for a heated base on which to print.  Each stepper motor has its own little daughter board, a pololu A4988 which handles the slightly complex business of powering the coils on the motor.  Driving stepper motors is different to driving simple DC motors – they have two or more (sets of) coils, which are powered in sequence (and with varying polarity) to move the rotor in discrete steps.  The motors I have have two sets of coils, and have a resolution of 200 steps per revolution.  The Pololu driver boards are sophisticated, and by manipulating the voltages over both sets of coils at once, can make the stepper motors turn in increments of as little as 1/16th of a step (which gives the motor a resolution of 3200 steps per revolution).  The completed board with its steppers attached looks like this:

WP_20130218_001 (1)

Yes, I know it’s out of focus.  My camera seems to have developed a very irritating fault, and every photo I take is slightly blurry.  The lack of focus doesn’t show up on the LCD viewfinder, because the resolution is insufficient.  It’s like going back to the old days of taking photos on film and not discovering that they were out of focus until a week later, when the film was developed.  I don’t really want to buy a new camera, so you might have to put up with soft focus images for a while.

Back to the point: the RAMPS board works perfectly.  To test it, I’ve loaded Marlin firmware into my Arduino.  Marlin is the program which takes more-or-less standard ‘G-code’ instructions (G-codes are widely used in the manufacturing industry to tell computer controlled machine tools how to act) and converts them to stepper motor steps.  I’m going to have to hack the Marlin source code a bit, because it’s designed for printers which have one motor for each of the x, y, and z axes.  Delta printers have more complex geometry, and that’s what my next post will be about.  Marlin in turn listens to a PC over a USB connection and gets its instructions from Pronterface, which allows me to test the movements of the motors.  It does a lot more than this, in fact.  Its true purpose is to drive the printer mechanics over the whole print run – but more of that when I’ve got something to print with.  For now, just marvel at the lovely UI, and accept that it allows me to test that all four motors work properly.

Pronterface

A note on power supplies

Stepper motors take electricity.  This may not be a revelation to you.  What you may not know is that they take quite a bit of electricity, even when they are not moving.  Especially if you are using micro stepping, the motor coils need to be energised (Mr Scott) simply to hold the motor in a given position.  Four motors can easily eat a few amps.  A very easy way to get a relatively high current power supply is to use one from and old PC.  I’ve got more of those than you can shake a stick at, so the whole printer will be driven from an old ATX PSU.  Easy.