Introduction: Mug Plotter
The mug plotter is loosely derived from Evil Mad Scientist's Egg Bot - it uses the same control board, and a modified version of the software, so you can design and print your mug from inkscape.
To build the mug plotter, you're going to need the following as a minimum, regardless of how you approach it:
two stepper motors
5V Power supply
To build the Mark I mug plotter along broadly the same lines I have, you'll also need the following:
Something to cut it with (laser cutters are good)
250mm of threaded rod, and a nut to suit. I've used M5, but its not important.
Some 1/4" aluminium rod (but anything in that range will do).
Around 20mm metal tube big enough to slide over the rod - I didn't have anything to hand to drilled a 6.5mm hole through a bit of 1/2" aluminium rod.
Some connectors suitable to join your stepper motors to the threaded rod and 1/4" rod.
Lots of small (M3) screws and nuts.
There's quite a degree of flexibility in the choice of stepper motor. I went for Bipolar, 200 Steps/Rev, 28x32mm, 3.8V, 670mA because it was pretty much the first one I saw, but it's within the ballpark of what you need
Step 1: Assembling the Mug Mounts
Design your frame. Or download the attached DXF, it's up to you. Load the DXF into your laser cutter of choice, and run off one copy in 3mm ply, or similar. The file attached will give you all the parts you need, but you need duplicates of a few of parts. As with anything, read all the steps first so you know which parts you need (hint, it's the stepper motor mount, the side panel and the end upright). You'll also need to get rid of the borders.
Cut the 1/4" rod to length - you'll need:
Start by assembling the mug mounts - connect the two concave frames together, and then the convex two. Place a circle frame on the end of each to keep it square, and then attach to a piece of your 1/4" rod with a bit of glue - 25mm on the convex one and 80mm on the concave one. You need to file down the last 10mm or so of the 25mm rod to provide a surface for the connector to grip to. Cover the sloped ends of the two mounts with some draft excluder tape, and slide the spring onto the end of the concave mount.
Step 2: Assembling the Pen Holder
Next assemble the pen holder - glue the nut for your threaded rod into the nut-shaped (and M5 sized if you don't modify the files) hole. Clamp the pen between the two holders using 4 M3 screws and nuts, then slacken them off slighty and remove the pen. Attach the pen clamp to the two slide pieces using a long M3 screw or something of a similar diameter. Finally connect the two slide pieces with the tube and a bit of glue. You should end up with a small gap between the pen clamp (with pen) and slide pieces, so you can slacken off the nuts on the pen clamp and get the pen out easily.
Attach the servo to the slide piece with a hole for it. Connect the servo arm to the pen clamp using a bit of thin wire or thread. It wants to be long enough so that with the servo arm straight down (ie roughly at right-angle to the thread) the pen clamp is parallel to the slides - that way movement of the servo will give the best control of the pen clamp.
As with the 1/4" rod in the last step, file a small flat onto the last 10mm of the threaded rod. Screw the threaded rod into the nut so that it's sitting around half-way on.
Step 3: Assembling the Frame
Before you start, file a 10mm flat section onto the end of each stepper motor shaft.
The end of the stepper motor has a cylindrical section, so the squares with circles cut in the centre are for the motors to mount to, and will line up the screw holes on the motor with the frame. Hopefully you remembered to cut two of these. Attach both motors to the frame with M3 screws. Attach the connectors to the shafts of both motors, so the screws in them screw onto the filed down flats on the motors. Screw the side panels to the upright you just mounted the motors to. The side panels aren't symetrical - so make sure they both go the same way round (hold the two against each other if you're not sure).
Note - If you want to make your life easier in the future, each time you assemble one of these right angle joints tighten the screw up, then put a little glue or epoxy around the nut.
Slacken the screws off again, so the side panels can splay out, and connect the next upright (it has two rectangular holes at the base) next to the motors. The rectangular section with the tabs sits inbetween the two uprights to keep it all square. Slide the pen assembly into the two panels, and slide the threaded rod into the connector for the top motor with the filed-down end going into the connector. Tighten the fixings on the connector. Add the remaining two uprights and slide the longest 1/4" rod thorugh all 4 uprights and the tube in the pen holder.
Slide the convex mug mount though the hole into the connector on the bottom motor, and tighten it up. Slide a spring onto the shaft of the concave mug mount and slide it into the other set of holes opposite the convex mount.
Step 4: Connect the Electronics
The electronics are easy - we've only got 4 components to connect. Your stepper motors should have 4 leads on them - if they have a different number then you've bought a slightly more complicated type. Read the datasheet for them and work out how they connect.
If you've bought basic bipolar steppers they should be colour-coded. If not then it's off to the datasheets again. Attach the two steppers to the EIbotboard according to the markings on the bottom of the board. Make sure that the one driving the screwthread connects to the Y axis connections, and the one which rotates the mug connects to the X axis.
Plug the servo into the servo-1 connector. The EIbotboard can drive up to 8 servos, but on mine only the first connector had pin-header on it. Make sure you've got enough length on the servo cable for the pen assembly to move its full length, if not get a servo extension cable.
Connect a 5V power supply to the eibotboard, then connect the board to your PC via the USB cable.
Step 5: Frig the Software
No matter how good you are building hardware (not that I claim to be), there's no getting away from the fact for a CNC project like this you're going to need to develop some Control at some point.
Luckily someone has done the hard work for us on this occasion, and the EIbotboard can be controlled directly from an Inkscape plugin, which is where you probably want to be drawing your design anyway.
What follows is the process I followed frigging the software - there are probably faster or better ways, but I'm good with serial stuff so this made sense to me. If you don't care then just skip to the bottom. You're going to have to do this yourself though, there's no download here.
Setup Inkscape and the eggbot software according to their instructions, and create a simple image (a square or something). Get a port monitoring program running (I used portmon, I'm sure there are others) and start the job running. When it's done, dig out the EIbotboard manual and open up the port log.
Scan through the messages, and work out where the commands are in all that - there's not that many of them. refer back to the manual to see what the commands mean. There a lot of messages that go SM,something,something,something so they're probably what's driving the steppers, which the eggbot manual helpfully confirms. So that's where we'll attack the software.
Find eggbot.py in the inkscape folder. search through it for SM. There are only a couple of occasions it's used, and it's pretty obvious that only one relates to drawing an image through the motors. Edit that line to include a suitable multiplyer for the screwthread.
Download the eggbot software,
search it for the following line (line 1271 in the current version)
strOutput = ','.join( ['SM', str( td ), str( yd2 ), str( xd2 )] ) + '\r'
change it as follows
strOutput = ','.join( ['SM', str( td ), str( yd2*SCALE_SCREW ), str( xd2 )] ) + '\r'
add the following at the top near the other constants
SCALE_SCREW = 240
Step 6: Design Your Mug
And we're good to go! load up inkscape and create a new image. Select File, then Document Properties. In the custom size box, set width 2400, height 1200 and units to px. Feel free to play with these settings later, but they work for me.
Step 7: Let's Print!
In inkscape, select Extensions, Eggbot, Eggbot control. Go to the timing tab, and set the Speed when Pen is Down and Speed when Pen is Up to 100 each. Again, feel free to play with these later - faster is possible, but there will come a point when the board starts throwing up error messages part way though a job. Also set Delay after Lowering and Delay after Raising to 500 in each case.
Next options. Actually you can leave all these for now, but you might need to select the tickboxes to reverse the motion of one of both motors. I did. You'll find out when you run your first test print.
Go to Setup. The pen up and pen down positions are dependent on the size of mug and type of pen you're using, so they'll need checking on a regualar basis. When doing a job for real put a little clingfilm or something over the mug before doing this - for the initial setup its easier to use a whiteboard marker so it's not important. Stick your mug in place, inset the pen, select the "toggle pen up/down" option, and hit apply. Adjust the two values at the top as appropriate, and keeping hitting apply till you've got the range you want.
And that's it. If you've got a design ready then rotate the mug and screw thread till the pen is at the centre of the mug, directly opposite the handle. Go to the plot tab, click Apply, and off you go. Keep an eye on it and be ready to dive in and unplug the PSU if something goes wrong (eg the pen hits the handle).