← Back to Advanced Projects

āœļø 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

ComponentSpecificationQtyNotes
Arduino Uno R35V Logic1Flashed with GRBL 1.1h
NEMA 17 Stepper Motors1.8°, 1.5A2X and Y axes
A4988 Stepper Drivers2A max2One per motor
SG90 Servo Motor5V1Pen lift Z-axis
CNC Shield V3Arduino Uno compatible1Mounts A4988 drivers
GT2 Belt & Pulleys2mm pitch1 setMotion transmission
Mechanical EndstopsNormally-closed2Homing 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
5ā˜…
0
4ā˜…
0
3ā˜…
0
2ā˜…
0
1ā˜…
0
...

Loading reviews...