āļø Arduino CNC Pen Plotter
Build a 2-axis drawing machine that plots vector art from G-code files.
Overview
A CNC pen plotter is a 2-axis machine that moves a pen across paper using stepper motors on X and Y axes, and lifts/lowers the pen with a small servo. The magic is the GRBL firmware running on Arduino Mega ā it interprets standard G-code files from Inkscape and executes the motion profiles.
What you'll learn: GRBL firmware flashing, stepper motor kinematics and micro-stepping, A4988/DRV8825 driver wiring, endstop homing sequences, G-code commands (G0, G1, G28), and generating G-code from SVG files in Inkscape.
Estimated time: 4ā6 hours. Difficulty: āāāā Advanced.
Components Needed
| Component | Specification | Qty | Notes |
|---|---|---|---|
| Arduino Uno R3 | 5V Logic | 1 | Flashed with GRBL 1.1h |
| NEMA 17 Stepper Motors | 1.8°, 1.5A | 2 | X and Y axes |
| A4988 Stepper Drivers | 2A max | 2 | One per motor |
| SG90 Servo Motor | 5V | 1 | Pen lift Z-axis |
| CNC Shield V3 | Arduino Uno compatible | 1 | Mounts A4988 drivers |
| GT2 Belt & Pulleys | 2mm pitch | 1 set | Motion transmission |
| Mechanical Endstops | Normally-closed | 2 | Homing switches |
Step-by-Step Tutorial
1
Flash GRBL Firmware
Download GRBL from github.com/gnea/grbl. Open the grbl.zip as a library in Arduino IDE. Upload the
grblUpload example to your Uno. This replaces all existing firmware.2
Wire the CNC Shield
Stack the CNC Shield on the Arduino Uno. Insert A4988 drivers into the X and Y slots (matching motor orientation). Set microstepping to 1/8 by jumping the MS1 and MS2 pins.
3
Connect Stepper Motors
Connect X-axis motor to the X terminals (A1, A2, B1, B2). Determine coil pairs with a multimeter: coil pairs read near-zero resistance. Connect Y-axis motor to Y terminals.
4
Wire Pen Servo (Z-axis)
The CNC Shield Z-axis DIR pin controls the servo signal. Modify GRBL's config.h to use servo mode for Z, or connect the servo directly to Arduino Pin 11 and control via a custom G-code sender.
5
Generate & Send G-code
In Inkscape, install the Inkscape GCodeTools extension. Convert your SVG paths to G-code. Open Universal Gcode Sender, connect to the Arduino, and stream the file.
Set GRBL step/mm values correctly using $100 (X) and $101 (Y) commands. Formula: steps/mm = (motor steps Ć microsteps) / (belt pitch Ć pulley teeth). For 200-step motor, 1/8 stepping, GT2 belt, 20-tooth pulley: 200 Ć 8 / (2 Ć 20) = 40 steps/mm.
Code / Configuration
cnc_plotter.ino
INO
// CNC Pen Plotter - GRBL-based (Volt X)
// Flash GRBL 1.1h firmware to Arduino Uno first.
// This sketch is a GRBL configuration reference ā not uploaded directly.
// === GRBL Machine Configuration (send via Serial) ===
// $0=10 (Step pulse time, µs)
// $1=25 (Step idle delay, ms)
// $2=0 (Step port invert mask)
// $3=6 (Direction port invert Y,Z ā adjust for your motor direction)
// $4=0 (Step enable invert)
// $5=0 (Limit pins invert)
// $6=0 (Probe pin invert)
// $10=1 (Status report mask)
// $13=0 (Report in mm)
// $20=0 (Soft limits disabled)
// $21=0 (Hard limits disabled)
// $22=1 (Homing enabled)
// $23=3 (Homing dir invert mask ā home to bottom-left)
// $24=100 (Homing feed mm/min)
// $25=500 (Homing seek mm/min)
// $100=40 (X steps/mm: 200step Ć 1/8 micro / (2mm GT2 Ć 20T pulley))
// $101=40 (Y steps/mm: same as X)
// $102=200 (Z steps/mm: not used for servo pen)
// $110=1000 (X max rate mm/min)
// $111=1000 (Y max rate mm/min)Reviews & Ratings
ā0 reviews
Sign in to leave a review
Loading reviews...