A Simple DIY Arduino Controlled CNC Machine Pen Plotter or PCB Mill for Under US$50.

About: Like to tinker around with computers and other electronic devices. Also have a lot of interest in 3D and virtual reality technology and its usefulness as a tool, to aid in teaching. Better visualization is t...

This instructable is an attempt to show that a simple CNC machine can be built
quite easily and quickly and that too for under US $50.

The idea was to put it together as quickly, and as simply as possible, but without compromising on the accuracy of the machine. So, even though the materials used are very inexpensive and easily available, I am happy to note that the machine is still very accurate. (The wood used was actually from pieces of scrap that were lying around from previous furniture builds. Similarly the yoga mat and the bits of rexine used to drape the plywood, were also discarded materials lying around the house).

As will be evident, it is a simple machine, built using :-

  • Plywood, 18mm thick.
  • 4 steel rods of 10mm Dia also called M10 smooth drill rods, of the desired length.
  • Two pieces of M10 threaded rods (which I have used as lead screws) 10mm Dia and of the desired length.
  • Two long nuts to mount the bed of the Y-Axis and X-axis.
  • 4 simple radial ball bearings to which the Lead screws are attached end to end, to facilitate their smooth rotation.
  • 8 Linear bearings (LM10UU).
  • 8 pieces of two hole pipe clamps which hold the Linear bearings in place, all mounted on a wooden plywood frame.
  • A green color yoga mat and some black leftover pieces of rexine are used as skin, to drape the machine.
  • An arduino uno(clone)
  • 2 Easy Drivers.
  • 1 Servo Motor. SG90
  • 2 Stepper Motors of type MINEBEA PJJQ196ZA type A 23LM-C263-G1V.
  • 12 Volts 2 ampere SMPS (Power Supply)

To see how to build a similar machine do check out the video links which are attached at the end of this instructable.

For the electronics, I have used an Arduino Uno(clone) with Easy drivers to control the stepper motors. One SG90 Servo has been used to lift and drop the pen onto the writing bed.

All of the above hardware was sourced either from my local hardware store(Mumbai, Lamington Road) or from Ebay here in India. UPDATE : Ebay is now non-functional in India, so the next place to get the above parts is either Amazon or https://robu.in/

The plywood was what I had lying around the house as scrap, from previous furniture projects.

Even the Stepper Motors were picked out of scrap from the streets of Mumbai, Lamington Road for Rs.150 each.They are of the TYPE 23LM series.

For the Software to control the machine I have flashed the Arduino uno with GRBL version 0.9i from Github. Here is the link to the repositories of GRBL https://github.com/grbl/grbl

Go to STEP 2, point no.2 to know how to load GRBL onto your Arduino UNO.

For my CNC machine I needed a tweaked version of GRBL by Robottini, the link to which is given in the next step below, as I needed to run two Stepper motors, i.e. one for the X-axis and one for the Y-Axis, and then the pen on the Z-axis which was controlled by a Servo motor.

For the GUI (Graphical user interface), which streams the GCODE to the machine, I have used grblControl_0.8.4.zip from here https://github.com/Denvi/Candle

I have used the free software, InkScape, along with the Laser plugin from https://jtechphotonics.com/?page_id=1980 for generating the GCODE to draw or etch TEXT or GRAPHICS on the CNC machine.

In this video the machine can be seen writing(Plotting) out some text.

The GRBL settings which were tweaked by me to control this machine, are scrolled through, at the end of the video.

In the video below, which is sped up quite a bit(time lapse), the machine is seen drawing a cat. In real time it took about 4 and a half minutes to draw the cat.

The inspiration to build my CNC machine came from a series of video tutorials by Splatspacedurham.

Do note that Splatspacedurham uses bushings as glides for the X and Y axis, whereas I decided to use Linear bearings(LM10uu). The Linear bearings in my build give a smoother motion than the bushings he uses in his build. It is basically a personal choice so decide what you would want to use in your own builds. Also note that he glues the bushings to the sleds of the X and the Y axis, whereas I found that clamping them to the sleds, using two hole pipe clamps, was easier & better.

The link to part 1 of Splatspacedurham tutorial is below :-

Cheap DIY CNC Mill Part 1 of 7 by Splatspacedurham.

Now let's move on to the next Step............ where I show you the wiring of my machine.

Step 1: The Wiring Diagram of My Machine and Some Pen Drawings Which It Made.

This is how I wired up my machine using the EASYDRIVERS for controlling the stepper motors. The diagram was made in Fritzing, a very nice and easy to use software to make and model small circuits.

Ignore the dotted lines in the image.

The drawings of the Peacock and the Muscleman are made using a Ballpoint pen as the plotting tool on the Z-Axis servo. As can be seen the drawings are very detailed and can be made even finer, by using a fine tip pen like the Artline 0.4 mm Fine Nib Drawing Pen available online for approx Rs.80 INR.

I modified the pen barrel in such a way that the Refill is being pushed down onto the writing bed by a small spring which is mounted between the end-cap of the pen barrel and the refill itself. I have explained it in the diagram which is attached.This helps the refill to remain in contact with the writing bed even if there are minor undulations on the bed surface.(The spring pushes the refill down to stay in contact with the paper even if there is a slight depression in the bed, and also allows the refill to retract into the chamber if there is a bump on the bed, so that minor unevenness of the bed is no longer an issue, and the writing or drawing remains very smooth.

For the Power Supply, I used a 12 Volts 2 ampere SMPS.

The arduino uno was connected via USB port to the computer and flashed with the GRBL library from Github

An important point to be remembered is that you should first do all the connections on the bread board, then connect the arduino to the PC using the USB cable, and then lastly switch on the Power to the 12 volts SMPS.

The source for the GRBL library which I used for my machine is given below :-


I needed this version of GRBL as I needed to control 2 Steppers and one Servo.

Use the PIN D11 to drive the servo. Use the commands M03 Sxxx where xxx is any value between 0 and 255 to rotate the servo between 0 -180 degrees. For my build I use M03S00 to raise the pen and M03S45 to drop it onto the writing bed.
Check out this link by Alessandro G. to see the servo being controlled:-

All in all the cost of the machine came to approx US $48 i.e Rs.3340 INR.The breakup is given below:-

  • Plywood, 18mm thick.Scrap from previous furniture builds, so free.
  • 4 steel rods of 10mm Dia also called M10 smooth drill rods, of the desired length. Rs.500 per metre.
  • Two pieces of M10 threaded rods (which I have used as lead screws) 10mm Dia and of the desired length.Rs.50 per metre.
  • Two long nuts to mount the bed of the Y-Axis and X-axis.Rs.20 each.
  • 4 simple radial ball bearings to which the Lead screws are attached end to end, to facilitate their smooth rotation.Rs.80 each.
  • 8 Linear bearings (LM10UU). Rs.100 each.
  • 8 pieces of two hole pipe clamps which hold the Linear bearings in place.Rs.5 each
  • A green color yoga mat used as skin, to drape the machine. Scrap, so free.
  • Some black leftover pieces of rexine are used as skin, to drape the machine.Scrap, so free.
  • An Arduino Uno (clone). Rs.400.
  • Two Stepper Motors of type MINEBEA PJJQ196ZA type A 23LM-C263-G1V. Rs.150 each.
  • One Servo motor of type SG90.Rs.100
  • Two Easy Drivers. Rs.250 each.
  • 12 volts 2 amps SMPS to power the stepper motors. Rs.320.
  • TOTAL cost Rs.3340 INR, minimum. i.e. US $48 approx.

Some parts were sourced from EBAY but now that EBAY is non-functional in India, the next place to get the above parts is either Amazon or https://robu.in/

The aim eventually is to build a bigger CNC machine which would be able to LASER etch onto paper, or be used as a PCB milling machine, or as a router to cut or engrave wood, by simply changing the tool on the Z-Axis.

I do hope you found my Instructable useful.
Thank You and God Bless.

Step 2: Some Useful TIPs and Links :-

  • Date : 17th Feb,2019

1.Font Issuesof double-outlines :-
A font problem which comes up with such CNC Pen plotters is that Text gets plotted as double-outlines, which is
not what the user wants. Inkscape has worked around this problem with a font called the Hershey text :-

As of version 0.91.0, the Hershey Text extension is included with Inkscape.
If you already have Inkscape 0.91 or newer installed, simply look in the “Render” submenu of the Extensions menu, in Inkscape to find and use this Hershey Text extension. Simply write whatever you wish, in the text box which opens there, and press the apply button. The text which you now get, will be the single line version of the text, instead of the double-outline kind. You can read more about this here :- https://www.evilmadscientist.com/2011/hershey-tex...

BUT DO NOTE THAT Hershey Text has to be separated by hyphenation. So to write something like "This is a test" you will need to write it thus "This-is-a-test", else your gcode will not compile correctly.

BUT THERE IS A WORK AROUND for this PROBLEM. It is Explained here :- https://discuss.inventables.com/t/solved-single-l...

So if you wish to write text without the double-outlines then as per the above link all you should do is :-
Write your text lines in any text editor of your choice. Then save this file as a PDF file. Open this saved PDF file in Inkscape. Resize to your CNC table bed size. Convert object to Path. Go to Extensions menu.Generate Laser Gcode using the J Tech Photonics Laser Tool Plugin which you had installed earlier.

2. How to Load GRBL onto your Arduino UNO :-
This is the link on how to do it :

But do remember that for my machine I have used GRBL by Robottini, as I needed to control 2 Steppers and 1 Servo Motor. The Link to Robottini's version of GRBL is https://github.com/robottini/grbl-servo

After loading GRBL onto my ARDUINO UNO, I tweaked the settings for my machine as below:-

The GRBL settings which work for my CNC machine are :-
Grbl 0.9i

$0 = 3 (step pulse, usec)
$1 = 25 (step idle delay, msec)
$2 = 0 (step port invert mask:00000000)
$3 = 3 (dir port invert mask:00000011)
$4 = 0 (step enable invert, bool)
$5 = 0 (limit pins invert, bool)
$6 = 0 (probe pin invert, bool)
$10 = 3 (status report mask:00000011)
$11 = 0.010 (junction deviation, mm)
$12 = 0.002 (arc tolerance, mm)
$13 = 0 (report inches, bool)
$20 = 0 (soft limits, bool)
$21 = 0 (hard limits, bool)
$22 = 0 (homing cycle, bool)
$23 = 3 (homing dir invert mask:00000011)
$24 = 200.000 (homing feed, mm/min)
$25 = 500.000 (homing seek, mm/min)
$26 = 250 (homing debounce, msec)
$27 = 1.000 (homing pull-off, mm)
$100 = 259.762 (x, step/mm)
$101 = 259.762 (y, step/mm)
$102 = 250.000 (z, step/mm)
$110 = 500.000 (x max rate, mm/min)
$111 = 500.000 (y max rate, mm/min)
$112 = 250.000 (z max rate, mm/min)
$120 = 19.000 (x accel, mm/sec^2)
$121 = 19.000 (y accel, mm/sec^2)
$122 = 10.000 (z accel, mm/sec^2)
$130 = 200.000 (x max travel, mm)
$131 = 200.000 (y max travel, mm)
$132 = 200.000 (z max travel, mm)

3.Replaced Easydrivers with A4988 Drivers.
I have replaced the easydrivers with A4988 Drivers to control the Stepper Motors. The A4988 drivers are easier to configure, and in my experience, they also run much cooler. You can read more about the A4988 drivers here :- https://howtomechatronics.com/tutorials/arduino/h...

For my A4988 drivers, (to get me the correct steps and calibration for my stepper motors, on the X and Y axis),
I have connected MS1 with 5V pin of the arduino.
I have connected MS2 with the GND pin of the arduino. (Later I realised that MS2 need not be connected to GND, so I disconnected MS2 from GND and thus left MS2 unconnected).
I have connected MS3 with 5V pin of the arduino.
The other connections are as explained in the above link by howtomechatronics.com.
My CNC wiring diagram is made in fritzing. You can see it in STEP 3 of this instructable. The file is also attached as a .fzz file at the end of this page for you to see and use in FRITZING. It is named : Sahil CNC grbl with 2 steppers and 1 servo wiring.fzz

4. How to Calibrate your stepper motors to travel the right distance.

A short Video that explains how to calibrate your CNC Stepper Motors :-

This Link has the instructions :- https://www.cncnutz.com/2018/06/how-to-calibrate-...

To download a free copy of the spreadsheet to help with your calibration calculations please visit: www.triquetra-cnc.com

Another one is here : http://bit.ly/2JFs4Yk
You may check this link too :- https://www.cncnutz.com/2018/06/how-to-calibrate-y...

5. How to Install Limit Switches on your machine:

Limit switches help to inform the microcontroller/computer that the limits(boundaries) of the CNC machine have been reached. When the axes move to their limits they hit the switch, activating the switch & thereby stopping the machine. You can use these limit switches to reposition your machine axes to their default starting or home position.
I have not installed Limit Switched on my CNC machine, but to do so would be a good idea. This video by
Digital Spider, shows how to install them. :

This page on GITHUB shows you how to wire the Limit Switches on your machine :-https://github.com/gnea/grbl/wiki/Wiring-Limit-Swi...

6. Links to some Websites from where you can download Free SVG files to use on your machine :-







7. Here is a link to a great explanation on Lead Screws and Belts by theBreadboard on Youtube:-

Also see this link if you want to put together a more professional CNC machine. It is once again by theBreadboard on Youtube :- Play list https://www.youtube.com/playlist?list=PL_atu5RtEPi...

That's all, for now.

Will update further. Until then, Take Care.... :-)

Step 3: The Wiring Diagram With the A4988 Stepper Motor Drivers :



    • Pie Contest

      Pie Contest
    • Build a Tool Contest

      Build a Tool Contest
    • Organization Contest

      Organization Contest

    6 Discussions


    6 months ago

    What are drivers??you mentioned in thr list 2easy drivers.. please explain and tell me where should i buy them?

    1 reply

    Question 11 months ago

    I assembled one of this...when I generate GCODE by inkscape there are 2 problems that make the equipment not work. The G4 commands (wait) and I need to replace the servo commands to M3S90 (pen up) and M3S68 (pen down). If I edit them manually my gcode works fine, but when I use the original inkscape gcode the GRBL stops and show a warning of error or buffer too small...could u help me???? berenguelmarcioaugusto@gmail.com

    2 answers

    Answer 11 months ago

    Hey, MarcioAB. Good to know that you assembled your own machine.

    Yes, even I have to manually change the code generated by the Inkscape-plugin.

    For my build I use M03S00 to raise the pen and M03S45 to drop it onto the writing bed.

    You can use the Search and Replace command of your text editor to help you change the servo command quickly for the whole file, instead of doing it one line at a time.

    Hope this helps.


    2 years ago

    thank you too mutch very usefull really