Let's Make Robots!

CNC Machine -- Valkyrie-Clone CNC

Cut, engrave and drill using GCODE scripts
serial_script.pl_.txt1.66 KB
cnc_surfacing.gcode_.txt4.32 KB
clone_CNC_first_trace.JPG435.85 KB
clone_cnc_terminal_board_sm.JPG58.87 KB
clone_cnc_terminal_board_lg.JPG131.77 KB
clone_cnc_PM42S_wires.JPG72.74 KB
clone_cnc_halfdead_L298.JPG66.01 KB
tiny2313_stepper.sch259.26 KB
tiny2313_stepper.brd16.3 KB
tiny2313_multiplexer_sch.png23.64 KB
tiny2313_multiplexer_brd.png35.59 KB
tiny2313_multiplexer.JPG55.24 KB
clone_cnc_august2.JPG1.51 MB

Old pic: http://letsmakerobots.com/files/clone_cnc_closeup_1500px.jpg

TinHead's Original: http://letsmakerobots.com/node/9006

Vector Drawings: http://letsmakerobots.com/files/clone_cnc_vector.pdf (draft)
Measurements will be available for these drawings sometime over Christmas Break 2009 or if somebody asks me for it.


  • ~175mm x ~115mm cutting area
  • Cuts 4" x 6" copper-clad boards
  • Resolution: On a copper-clad board on a surfaced table, a fresh sharp 60° bit, and a carefully set cutting depth, I can get down to 0.4mm traces in the X-direction.  To minimize errors I try to keep to 1mm traces or larger (1.4mm typical, with 1.6mm pads on vias).  Traces can be made at 0.4mm between pads of a DIP IC if "0.12mm" isolation is selected from the pcb_gcode/pcb_gcode_setup plugin in EagleCAD.
  • ~35mm Z-axis travel (allows boards to be stacked on the base)
  • Cutting speed: I added some pauses to the RepRap feedrate code, so I know it isn't going as fast as the feedrate says it's going.  However, I did surface a 110mmx160mm area with 1.2mm passes in about an hour with a ~2mm bit (cutting off about a millimeter depth of particle board off the surface) -- so about 256mm/minute for surfacing, corresponding to reported feedrate of 1000.  On copper-clad board, with a 60° engraving bit, I have used a feedrate of 1400, but it could go faster.  The feedrate of 1400 means ~360mm/min.  
  • Machine Dimensions: about 20"x17"x22" clearance (X,Y,Z) (0.50 x 0.43 x 0.56 meters) -- the base stage is 18" long by 12" wide with extra room on the sides for the motors/lead screws/X-stage which brings the Y-dimension out to 17" (from 12").  The motors on blocks extends the X-dimension to 22" (from 18").  (1" = 25.4mm)
  • Measurements shall be added to vector drawings soon!
  • Computer runs Inkscape with GCODE plugin for design, EagleCAD with GCODE plugin for PCB.  Code executes on Chris Meighan's "GCODE for RepRap", running on Windows XP. 


Tools for construction:

  • Workmate Bench, Drill, Circular Saw, 500 pc (est.) drill set, coping saw for aluminum rails, tape measure, ruler
  • Proxxon 12VDC Rotary tool for spindle, 36pc Dremel set including metal-cutting bits for cutting lead screws
  • Soldering station
  • Adafruit USBtinyISP AVR Programmer (plus WinAVR software)
  • ISP target board with 16MHz Crystal Oscillator (pictures to follow)
  • Wire cutters, pliers, linesman pliers, C-clamps, socket wrench, adjustable wrench
  • (Circuit board etching setup or PCB trace routing machine or PCB vendor)
  • EagleCAD with SparkFun Design Rules plugin (keeps traces from getting too close to each other)


  • Adafruit DC Boarduino for control (requires FTDI cable) or Arduino Duemilanove
  • Stepper-Driver components described in Bill of Materials http://letsmakerobots.com/files/cnc_partlist.pdf
  • 24VDC Stepper motors
  • ATX Power Supply Unit, 300W or (http://www.rackmount-devices.com/045-6854.html, http://www.interinar.com/fs-15024-1m.html)
  • 20' CAT-3 cable -- for signal wires (20' = 160' of 24AWG wire)
  • 25' wire -- 20AWG for power wires
  • 1/4" interior diameter clear tubing
  • heat shrink (various sizes)
  • 5/16"-18 fully-threaded bolts x 2" or longer (M8-1.25 equivalent, 60mm or longer) to fit the interior diameter of the skate bearings
  • 40 inline skate bearings (e.g. "China Bones" and "ABEC-1" used for this machine)
  • An IKEA nightstand worth of particle board/MDF -- or 1/3 sheet of particle board or MDF from the lumber yard

Cost: I built up my workshop while building this project, so it is hard to estimate the true cost.  For folks who have access to a wood shop, an electronics lab, an AVR programmer, a circuit-board etching setup, creative part sourcing and a rotary tool, you can probably build this for $150 in about a week.

Code: Based on the Valkyrie CNC stepper driver/Arduino source code: http://github.com/TinHead/Valkyrie-CNC-source-code/tree/master.  Perl Script loaded http://letsmakerobots.com/files/serial_script.pl_txt, attachment to this page.

Prior Art:

Tricky Parts:

  • Setting the ATTINY2313 "lfuse" to a 16MHz oscillator: "lfuse" to "0xFF"
  • Aligning the lead screws: I used floating blocks that were aligned at each end and screwed down. (http://letsmakerobots.com/files/clone_cnc_floating_block.PNG)
  • General alignment problems: Of the four rails used for X-stage travel, the two rails on the top and bottom of the base-stage should be parallel to <1mm, and the rails on each side of the base should be parallel to ~1mm.
  • Aligning the X and Y axis: the X and Y stages should be perpendicular to each other to 1mm over the runout of the stage: "Clone CNC" has 3mm of Y travel over the 165mm X runout :(  I'm not sure whether it'll be a problem while drilling holes in PCBs
  • Alignment of the Z-axis -- the floating block may not be possible, or may have to be positioned on top of the stage near the motor.  Good alignment will make it easy to lift the stage.  Bad alignment will make it difficult for the little motors to lift the stage.  Rails and screws should be parallel.
  • Switching to 24V -- the ATX PSU is not meant to put out a whole lot of power from the -12V (blue) wire -- only about an amp from -12 to GND.  You may only get one quarter amp to work with when you run the steppers on the -12V/+12V wires.  The Clone CNC is running fine, but I have a spare PSU in case the current one dies from too much load on the -12V line.
  • The Boarduino must be hooked up to the same ground as the stepper drivers -- run it from -12 to GND (GND is positive/high, and -12V is ground: confusing?) if you use 24V from the ATX PSU.


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 (last time I joined more than 2 pieces of wood was in Middle School shop class in '93).  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 ).

Rear View:  The picture above shows the Z and Y axis drivers, plus the homemade power and I2C terminal block. The +12V bolt is heat-shrinked in yellow, the -12V bolt is heat-shrinked in blue, and the I2C is bare (because it is >100x less likely to kill me or burn me).  I chose a telephone-style terminal system -- wrap the wires around a bolt, between washers, and tighten.  Fasten the bolt on an insulating surface (wood in this case) and mount the terminal in a convenient place (screwed onto the X-stage).  The pairs of wires are not twisted together for neither power nor I2C pairs -- Instead I run the wires parallel and keep them seperated at a fixed distance with tape.  I got the idea from outdoor "Ladder Line" antenna wires used in ham radio, for which you also don't want crosstalk between wires.

Update 19/11/2009: Trace routing on copper-clad board -- There were some lockups due to bad table surfacing and wrong choice of routing bit.  Also, the machine was losing steps on the Z-lifting steps, so I added rubber bands and zip-ties until it stopped.

Update 21/12/2009: I loaded "serial_script.pl" as an attachment, which is a perl script to control the CNC.   I improved my clamping system and re-surfaced the table.  I still needed 60° trace-routing/engraving bits.  Up-cut router bits are the wrong tool for trace-routing.  In "serial_script.pl", the Perl script receives either no arguments, in which case it runs a script, or a GCODE command string, which it sends to the microcontroller.  So >>./serial_script.pl "G01X10Y10" would step the CNC 10mm in the positive X and Y directions (along a diagonal).  The 5-second delay is needed for the controller to initialize when the script starts.  Also, there needs to be a "Serial.println("zomfg");" inserted in "arduino_gcode.pde" after initialization is complete or the script will never continue.

Update 24/12/2009: http://letsmakerobots.com/files/clone_CNC_first_trace.JPG -- I got my new 60° trace-etching bits, a new Java application by Chris Meighan (http://www.chrismeighan.com/projects/g-code-for-reprap), courtesy of avantgps and with help from brickbatbae, and a vacation day to play with it all.  I attached the second X-axis lead screw.  I used the back of a used copper-clad board to test my new bits.  The only problem was that there were empty lines in my GCODE file, so the GCODE for RepRap would send the line, but the arduino would not reply, so the script would not continue.  There were no problems with the I2C failing.  From start to finish, the board was routed and drilled without having to home the machine.  As long as I make my EagleCAD boards with wide traces and big pads for the components, I should be able to use the pcb-gcode plugin to make circuits.

Update 29/12/2009: Guitar Effects Pedal Power Supply Project, for which I used EagleCAD and this beautiful little CNC.  http://letsmakerobots.com/node/13983

Update 09/Jan/2010: 83MB of photos of the Valkyrie-clone CNC at http://www.freakivy.com/clone_cnc_complete.zip

Update 25/Jan/2010: The CNC is hard at work etching and drilling new drivers for some bigger motors for a motor upgrade.  It has been up and working for about a month now (since I got the 60° bits a little before Christmas).  I am a little nervous about changing my machine since it works (it's fabricating its own drivers), and the little printer motors are kind of charming.  I think I'll work on the control system and hold off on building (buying?) a new machine until the old one breaks or starts to fail.

Update 30/Jan/2010: The machine seemed to be failing.  It became extra-sensitive to changes in current, for example, when the machine is cutting.  I blamed changing my power supply from multiple supply wires to a single supply wire (I had my supply wired bundled at first, but then just used a single wire), and also blamed changing the drivers to be inside the box.  I noticed TinHead made a change that seemed to help -- while moving the drivers inside the metal case, he upgraded to a 24V power supply.  I was wondering if my seeming I2C problem was a power supply problem.  Later, I remembered that I also moved the Arduino inside the box from on top.  The final fix was to move the transformer brick for my Proxxon drill from the top of the machine to the other side of the machine, and to plug it into a different outlet.  As of February I'm fabricating boards as good as or better than ever.

Update 11/Feb/2010: I made an 8-channel full-bridge rectified and regulated DC 9.0V power supply for my brother's many guitar pedals.  Another brother will be making a pedal board, and the power supply will allow for no more 9V batteries.  Also, I'm working on the machine upgrade -- I'm planning to change the control system from a smart 4x ATTINY2313 board to a RepRap v1.2 style stepper driver system with a single ATTINY2313 working as a multiplexer via I2C.  I'm cutting the ATTINY2313 multiplexer board now.  The multiplexer will take an I2C command from the Arduino and move one of the stepper drivers.  Since there are 9x digital channels controlling the steppers, I wanted to move these wires to a dedicated board off the Arduino.  The three-wire drivers (x3 unique channels) will be clipped into the ATTINY board.  Schematic attached. GCODE files need to be relabeled from ".nc" before I can attach them.


Update: 17 August 2010 -- New Drivers!

The short of it is that I got the Valkyrie-clone CNC working with new drivers (http://letsmakerobots.com/node/15686).

In the picture from top-left, clockwise to bottom-left: the terminal block (24V power up to 13A), the 2 X-axis drivers, the Y-axis driver (blue heat sink), and the Z-axis driver (blue heat sink), the Arduino controller (direction x3/enable x3/step x3), and just below the terminal block there is a small 9V regulator board to shift 24V down to 9V for the Arduino.  Everything is mounted on an MDF board, and the board is mounted with baling wire.

More to follow, but it seems to work fine.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Quick question: How is the Proxxon tool holding up? I'm thinking on getting one of the 12V ones 50 or 50/E to replace the Dremel.

(Sorry for the late reply -- the LMR update notifications aren't working for me so I did not see this until today)

I haven't been running the Proxxon that much recently, but it still works.  The Proxxon tool has a push-button to keep the collet holder from turning when you are changing bits -- I discovered that it's bad practice to push the button and use a Vise-Grip to tighten the collets (it can strip the push-button mechanism so that it starts slipping instead of holding tightly).  Why would I do fsuch a dumb thing?  The vibrations of my "chip breaker up-cut router bit" would loosen the collet holder and the bit would drop out while cutting.  I attempted to tighten it even more, but that just caused some damage to the push-button mechanism... the best solution is probably to cut slower with the router, and to cut channels that are slightly wider than the bit so that it does not have friction from both sides of the channel (for a multi-pass cut). 

Mostly, the little Proxxon tool has been cutting PCBs.  I've been wondering if it would be better to build myself one of these for higher RPM and try switching to end mills for cleaner isolation: http://www.buildyouridea.com/cnc/spindle_05/spindle_05.html

I'm pretty happy with the Proxxon tool -- I think compared to the "IB/E Professional Rotary Tool", the 12V tool might lack some torque, but so far my experience has been just with the 12V, so I can't really talk about differences. 

Regarding 50 or 50/E ... I think one difference is speed control.  I don't usually cut at less than the maximum speed so speed control might not be necessary.  If you need speed control for cutting acrylic, then the 50/E would be better. 


While the Dremel has torque it is really sloppy with precision, a proxxon 50e should perform better. The IB/E looks cool but it is also double priced ... I'll have a look at both tomorrow at the store.



I just saw the picture with the drivers moved, try connecting the I2C bus in a "bus" configuration, what you got there looks like a "star" configuration.

Meaning as below:

Arduino => driver1 |----| driver2 |----| driver3 |---| driverX

Also have them as short as possible and keep the powerlines as far away  as possible from the I2C bus, as it is now EMF in the power wires is probably the problem.

Later edit: I was thnking, maybe the whole I2C based design is flawed from the start, I mean it kinda works for me now but still seem flaky at some points, as I said in the relpy on my page I had a few strange lockups, but then again a lot less then before ... I have an order ariving next week with a batch of l297 and other stuff, maybe I will change the design all together and just drop I2C out of it.  

I've made a few changes including a switch to an I2C "bus" configuration.  I connected the I2C together in a bus type arrangement as suggested.  I also soldered all +12V wires to each other and to a lead that supplies power to the drivers.  Now _if_ there was a problem with not using some of the 12V wires on the ATX supply, it's okay now. 
I also soldered a jumper wire from the I2C 5V pull-up resistors to a bigger 5V line closer to the 78L05 regulator.  It probably doesn't do anything since the crosstalk is probably on the wires, not across several kOhms worth of resistors, but I figured while I was doing work on the box, I'd give it a try.  I haven't tested yet to see if my CNC is back to its old self.

The changes I made did not make a difference.  The machine locked up in the same place as before.  With the other options exhausted I made two additional changes.  First, I moved the Proxxon Transformer to a different outlet, and off the top of the computer case.  Second, I remembered another difference between configurations -- I have my Arduino sitting inside the case among the power wires, motor wires, and I2C wires instead of on top of the computer box.  I couldn't move the Arduino (I shortened its cables), so I put it in a spare empty metal enclosure, and connected a wire from the enclosure to the computer case so it should be earth-grounded.  The shield covering the Arduino seems to have worked -- I can run scripts again and the lockups are less frequent.  I don't know whether the Arduino is a strong receiver or if it is a strong transmitter, but whichever it is, I can cut again.  Hooray!  I'm back to fabbing again.

Update: Nevermind.  The part of the fix that appeared to be more important was either moving the transformer off the computer case or plugging it into a different outlet rather than the power strip.  I tried to finish a board this morning, and it locked up because I had moved the transformer back to the top of the case.  I have no idea why that matters.

Let me know how it goes, I just finished the first real project with the Valkyrie, cut replacement brakets for the tool mount. No stalling today for me :D


The motor wants to suck 34 Amps when it starts up.  My driver can handle 5 amps.  Now I have one fewer driver.

Can we replace the L298 with transistors that have large current?

Pino -- You shouldn't need more than the L298N for the PM55 motors.  If you're not sure, check the resistance across the coils.  My PM42S motors have 80ohms across each coil, which limits the current very well.  Your motors are similar, and according to the data sheet (page 4)
the PM55L has 25% higher resistance than the PM42 motors (24/100 ~ 250milliamp/coil) which is fine.  For my 1.4ohm/coil motors, it is a different story.  Rather than replace L298N with transistors, I think it's cheaper (at least for me) to redesign the circuit to use a L297/1 -- I have to redesign the board anyway so I might  as well figure out how to use the L297. 

That's just my opinion (I placed an order for the L297s already), so designing a transistor circuit could work.  But my motors are bipolar not unipolar, so I definitely need an H-bridge instead of just transistors (an H-bridge can be made from transistors, but it takes more of them).  If I had a unipolar motor, I might be able to get away with a 4-transistor circuit, since the center tap of each motor can be connected to ground.  Since I have a bipolar motor, I need an 8-transistor circuit to allow the current to flow across the coils either forwards or backwards.  If you decide to build a new driver with transistors, I'd like to see the build.  I do have an H-bridge built out of NPN and PNP transistors, which I designed in EagleCAD -- just for fun -- and with a one-sided board there are a few jumper wires over the top.  It seemed a bit complex compared to keeping it all on the L298 IC.  I etched the H-bridge on some scrap board, but haven't soldered or tested it yet.  The design, at the tolerances of my machine, covers 50mmx125mm of board space for just two H-bridges, so I might end up with monster-sized board.  But since I haven't done the L297/L298 board yet, I don't know for sure that L297/L298 will be any smaller (but it seems like it should be).  Just rambling here...