Let's Make Robots!

My First Robot

Draft Robot Page: http://letsmakerobots.com/node/12713

My first robot is a Valkyrie CNC using TinHead's example: http://letsmakerobots.com/node/9006


Vector Drawings: http://letsmakerobots.com/files/clone_cnc_vector.pdf (draft)
Measurements will be available for these drawings by December 2009 or if somebody bugs me for it.

Cost will be more than $200 -- The motor drivers were the most expensive bit of it.  One could bring down the cost by hand-building the driver boards, but I sourced the PCBs from BatchPCB.

Plans for this robot: learn about CNC machines and control systems, and machine prototype PCBs for other robots. [...]

Credit where credit is due: My CNC is deeply indebted to TinHead's work on the motor driver (node/6967), driver software, Arduino controller software, and hardware design, along with the discussions on the "Valkyrie" robot page (node/9006).  Driver software is http://github.com/TinHead/Valkyrie-CNC-source-code/tree/master .  Somewhere in the driver and Arduino source code, the RepRap project gets kudos as well.  Debt is also owed to http://buildyourcnc.com for some of the construction tips.  I wouldn't be able to join the wood so well without learning good drilling technique.  Also, ladyada's AVR tutorial ( http://www.ladyada.net/learn/avr/ ) was essential to programming the ATTINY2313 used in the stepper drivers.  The controllers were programmed on a minimalist target board from evilmadscientist.com ( http://www.evilmadscientist.com/article.php/avrtargetboards ). 

Giving back: I'll be posting more detailed plans for my iteration of this machine.  It is TinHead's design, but where there needed to be alterations (e.g. the PCB design needed changes before BatchPCB would accept it) I made changes, and where there were ambiguities, I had to figure them out (for example, the views of the robot from the back, sides, and bottom I wished I could see).  Also, I ground a copper-clad board into my first prototype circuit board (first ever!) while waiting for BatchPCB, and if I wanted to spend many hours grinding copies of that prototype motor driver board, I could have saved easily $70 on manufacturing the boards (toner transfer would have been quicker but I had a new rotary tool to try out).  If the proto driver board works, I'll post that as well.  My plans for this homage to the Valkyrie is to document the building as best I can, so that more pics and plans are available online for folks like me who want to tinker.

Budget example for sourcing components from the USA37.42 KB
clone_CNC_skate_bearings.JPG383.87 KB
clone_CNC_pcb_backlit.JPG350.28 KB
clone_CNC_pcb_front.JPG285.59 KB
clone_CNC_pcb_back.JPG372.71 KB
clone_CNC_copper_front1.JPG347.72 KB
clone_CNC_copper_backlit.JPG336.59 KB
tiny2313_stepper.brd23.75 KB
clone_cnc_600px.jpg125.03 KB
clone_cnc_floating_block.PNG5.74 KB
clone_CNC_1101_front_s.JPG23.07 KB
clone_CNC_1101_back_s.JPG26.48 KB
clone_cnc_captive_nut.png2.44 KB
clone_cnc_1500px.jpg877.57 KB
clone_cnc_vector.pdf99.8 KB
clone_cnc_closeup_sm.jpg102.22 KB
clone_cnc_closeup_1500px.jpg705.01 KB
clone_cnc_I2C_test.PNG7.14 KB
clone_CNC_Dec09_med.jpg319.46 KB
clone_CNC_Dec09_small.jpg122.25 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I got my first set of router bits from Drill Bit City (http://drillcity.stores.yahoo.net) and am cutting, with the help of Inkscape and the gcode plugin.  I traced a nifty "gear" pattern in some particle board by copying and pasting gcode into my Windows HyperTerminal -- my next step is to run a script in Cygwin Perl that automates the process.  Unfortunately, I never installed the Cygwin Perl Windows API package needed to run the serial port, so I'll need to do that before I can script (I could use Linux but I'd rather not).  After getting a script to work, I have the task of determining how to make sure my gcode is giving me the right units.  I'm sure I'll eventually encounter the need for a "PAUSE" or "STOP" button to halt the machine while I change bits (a manual Z-axis lift/return button would help change router bits).  My limit switches are wired, but I haven't written code yet to use the information.

Still, I'm happy that it is tracing lines with the router bit and can't wait until I have it running on its own.

Boo ya!   Device::SerialPort is working on one computer running Scientific Linux (a Red Hat Enterprise distro)!  Now I should be able to start programming a Perl Script to run the CNC.  So here's how to do it for folks starting out.  The Arduino program still can't find the USB serial port, but I don't care too much right now about that -- I'll load up the Arduino on Windows and control it with Perl on Linux.

There are plenty of examples online of using Perl and Device::SerialPort, but few instructions on getting the darn thing installed in the first place.  Here's how I did it:

(1) From a terminal window: "cpan" opens the CPAN perl-installer.  I didn't know this wonderful service existed, but it does, and it's wonderful.

(2) In CPAN start by updating cpan: "install CPAN"  use the autoconfig when available.

(3) With an updated CPAN, install Device::SerialPort with "install Device::SerialPort"

These instructions should work across different Linux distributions (though installing the analogous Win32::API and Win32::SerialPort has been failing on cygwin).  Now the serial port should work from Perl.  Brilliant!  After 5 hours a day contemplating this, I have a non-Visual Basic way of running scripts!  At minimum wage I've spent >$60 of time figuring it out.


http://letsmakerobots.com/node/12713 (draft mode)

suggestions welcome

My fun second project for clone-CNC is getting it to reproduce its stepper driver boards.  (My first project was to replace the upper spindle mounting block which I had drilled too big, and it was done before I had automated the machine).  A few changes are needed to the driver boards -- I don't think I can draw traces between the pads of the L298 or ATTINY2313 very easily, so I'll need more wires to connect some of the microcontroller output pins to the L298 motor driver logic input pins.  Also, the tolerances need to be generous so I don't cut traces due to spindle wobble (turning the Z-axis causes a bit of eliptical motion of the cutting bit), or due to precision error -- I haven't hooked up the second X-axis motor/lead screw so there is some play in the X-stage that may affect diagonal lines.

Recently I've tested a design for reproducibility with a 1.07mm cutting bit on a spare piece of coated particle board -- I probably should have surfaced the board first, but I think the results show that I need a smaller bit (a 0.4mm bit) since the pads ended up too small.  Since cutting speed scales proportionally to the tool diameter (which makes sense physically), halving the diameter will halve the feed rate.  I don't know how fast my copper clad board will cut, so I'll probably be conservative, and use a third of the rate I used to cut the particle board -- the bit looks fragile.  The particle board took about an hour to cut, so one board may take 3 hours with the smaller bit. Hmm... I think I need to experiment with cutting rates on copper-clad board.

I'll post the gcode/eagle file if I ever get a working reproduction of the driver board with the clone-CNC.

It seems I do encounter freeze-ups, but whether it is because of load or because of the way I ran my Perl scripts has yet to be determined.  Since I made a change to the Perl script, and reduced the depth of the engraving, there hasn't been a lockup yet.  One thing that shall vex me until I fix it is that I either did not flatten my surface well enough, or I did not secure my copper-clad board securely enough.   At the end of the board, there is a bit of a rise in the height of the board so that there is an extra bit of board thickness to cut through.  Eventually, the bit broke, and fortunately there is still enough of a nub left to engrave as long as the surface is flat.  I've sacrificed a copper clad board ($3.80) to the noble cause of experimentation and experience has been a good teacher... but also the sort of teacher who calls you dumb and hits you with a ruler.  PCB trace routing seems to be a difficult task, but  eventually I'll have a good enough clamping system to keep the board flat, a new bit, and I'll make sure there is a GCODE command to tell the machine its location if it has to be restarted from where it locked up (right now it wakes up and calls the current position X0Y0).  Homing each time was time-consuming, and the cutting speed is pretty slow and deliberate.  <covetously>A 100k rpm spindle with decent torque would speed the cutting rate by at least 6x.</c>

In the end, I may end up choosing not to use pcb-gcode, and instead use a custom gcode drawing that is simpler to cut.  


Update 22/11/ 2009: This isn't a bad machine -- it cuts more precisely than I do -- but neither is it a PCB trace routing machine. The EagleCAD gcode plugin is a bit ambitious for now, and I think I'll stick to finding some way to reproduce the original PCB with blocky traces.  I had a few pictures of that design on the blog page, and it was blocky enough to trace myself with the Proxxon tool and a diamond grinding bit.  This Saturday, I re-surfaced the table -- the machine is pretty good at that , and tried some cuts on the scrap copper-clad board.  The table was flatter this time, but the results were still not consistant.  I also tried a drill file from the pcb g-code plugin, but  I did not check for problems after I removed some of the lines of code, and it snapped off a drill bit (I have a few -- they're cheaper than router bits).  One of the problems (not the one that smapped the bit)p is that the  mechanical resolution of the machine is not very good as it is now.  Z-axis moves cause a little circular motion in the spindle since the Z-screw is a little bit curved.  Motion in the simultaneous X and Y directions is not so accurate because the right side of the mahine  does not have a second lead screw and motor like TinHead's machine.    As I discover the limits of this machine I am learning about the various limiting factors formechanical precision, and microcontroller communication, along with lessons about the importance of good practice such as surfacing which lets the machine work on a more  stable cutting surface with a more constant amount of material to cut.  I just wish I learning were cheaper :)
Anticipation, 21/12/2009 -- I am getting some proper cutting bits (60° trace routing/engraving bits) and we'll see if I have a CNC machine that can cut PCBs.  I think I may still end up with little stair-steps on the diagonals instead of straight lines, but the steps will get smaller when I move to 200 steps/turn NEMA-17 motors sometime over the Christmas break.

It turns out that the resolution on my machine is limited either by wobbly attachments or by backlash.  I hope that I can improve the machine by installing anti-backlash nuts, since while convinced that backlash was the problem, I ordered some from bluumax CNC (bluumax.com).  I didn't really feel like building them myself from polymorph, so I went ahead with the more expensive time-saving solution. 

The "wobbly Z-axis" problem might be the more important cause of backlash. The wobblyness of the spindle is a bigger problem in the X-axis than the Y-axis.  The X and Y-axes are successfully held stable by the bearings, which have a wide enough baseline to keep the machine steady.  In the X-direction, the Y-stage and Z-stage are held by groove in the bearings, which is not very deep or stable in my machine.

What makes the problem a real problem is that on my machine, unlike the original Valkyrie, the Y-track crossbar on the X-stage is positioned way up above the cutting area of the board.  Having the rail high up means that there is a long lever down to the cutting surface that is very succeptable to cutting resistance.

This might not be a problem when I etch shallow traces.  I only noticed the bad backlash when I was cutting (accidentally) a little deeper.  The backlash in the X-axis was at least a power of 2 greater than the Y-axis backlash (from <0.2mm in the Y direction to up to 0.8mm in the X-direction).   I repeated the PCB etch with wider X-direction traces and shallower cuts and found nowhere close to the extreme backlash I encountered the first time.  Perhaps CNC cutting is a matter of experience and knowing the limits of my machine.