Two-axis CNC pen plotter with G-code
CNC machines and 3D printers all run on the same ideas: stepper motors, G-code and motion control. A pen plotter built from steppers and a GRBL controller is a safe, cheap way to learn them and draw any design.
- Parts
- ₹6,250
- Build
- 14 weeks
- Board
- Arduino Uno
- Objectives
- 6
Block diagram
- G-code from a PCDescribes the drawing
- Limit switchesHome the axes
- Reference sensorGives the values the others are checked against+
- Arduino Uno with GRBLPlans and times the steps
- PCB and enclosureHolds the circuit as one solid unit+
- CNC shield and A4988 driversDrive the steppers
- Two NEMA 17 steppersMove X and Y
- Servo pen liftRaises and lowers the pen
Objectives
- To build an A4-size two-axis frame with belt drives.
- To calibrate steps per mm on each axis.
- To draw from G-code generated from an image or text, with pen up and down.
- To measure dimensional accuracy and repeatability on a test pattern.
- To design a PCB and enclosure that turn the prototype into a robust product.
- To calibrate two sensors against a reference and compare their accuracy and cost.
Parts and specifications
- Arduino Uno R3 (CH340 clone)ATmega328P 16 MHz, 32 KB flash, 2 KB SRAM, 5 V logic, 6 analog inputs (10-bit), 6 PWM pins₹450Buy
- CNC shield V3 for UnoTakes up to four A4988/DRV8825 drivers, end-stop and spindle pins, for GRBL₹180Buy
- A4988 stepper driver8 to 35 V, 1 A per phase without heatsink (2 A with cooling), up to 1/16 microstep, set current with Vref₹240Buy
- NEMA 17 stepper motor1.8° per step (200 steps/rev), 1.5 to 1.7 A per phase, about 4 kg·cm holding₹1,300Buy
- GT2 belt 2 m, 20-tooth pulleys and idlers₹450
- 8 mm rods, linear bearings and frame₹900
- PCB prototype (ElectroLark, 1 to 2 pieces)₹1,500
- 3D-printed enclosure (about 60 g at ₹10 a gram)₹600
- Second sensor of another type₹250
Total about ₹6,250 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
200 steps/rev × 16 microsteps / (20 teeth × 2 mm pitch) = 3200 / 40 = 80 steps/mm.
Imax = Vref / (8 × Rs). With Rs = 0.068 Ω and a 1.2 A target: Vref = 1.2 × 8 × 0.068 = 0.65 V. Set lower (about 70% of rated) to keep motors and drivers cool.
GRBL on an Uno steps up to about 30 kHz: 30,000 / 80 = 375 mm/s, far above what the frame needs; use about 50 mm/s for clean lines.
1 / 80 = 0.0125 mm per microstep; real accuracy is limited by belt stretch and backlash (about 0.1 to 0.2 mm).
Pin map
| Signal | Pin or connection |
|---|---|
| X step / dir | D2 / D5 (CNC shield) |
| Y step / dir | D3 / D6 |
| Enable | D8 |
| X / Y limit switches | D9 / D10 |
| Pen servo | Z+ end-stop pin D11 with servo-enabled GRBL build, or spindle PWM pin |
Firmware outline
- Flash GRBL (servo-pen variant) to the Uno; set $100 = $101 = 80 steps/mm, max rates and acceleration.
- Home with $H using the limit switches.
- On the PC, convert an SVG or text to G-code (Inkscape extension) with M3/M5 for pen down/up.
- Stream G-code with Universal G-code Sender; GRBL plans acceleration across moves.
- Plot a 100 mm square and circle test pattern for calibration.
Test plan
| Test | Expected result |
|---|---|
| 100 mm square | Sides within ±0.5 mm |
| Circle of 80 mm | Roundness checked |
| Same pattern 5 times | Repeatability |
| Long drawing | No missed steps (corners still line up) |
These rows start your results table when you plan the project.
Viva practice
Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.
Make it yours
One or two upgrades for a mini project, two to four for a major one.
Datasheets and sources to cite
- GRBL v1.1 wiki
- Allegro A4988 datasheet
- ISO 6983 (G-code programming format)
About this project
How much does the two-axis cnc pen plotter with g-code project cost?
About ₹3,900 for the parts in the base list: Arduino Uno R3 (CH340 clone), CNC shield V3 for Uno, A4988 stepper driver × 2, NEMA 17 stepper motor × 2, SG90 micro servo, Limit switch with lever × 2, 12 V 2 A DC adapter, GT2 belt 2 m, 20-tooth pulleys and idlers, 8 mm rods, linear bearings and frame.
How long does it take?
About 10 weeks for the base project, built on an Arduino Uno. Each upgrade adds time.
Which branches is it suitable for?
Mechanical / Mechatronics, Electrical and Electronics, Electronics and Communication, as a mini or major project.
Which pins and design calculations does it use?
X step / dir on D2 / D5 (CNC shield); Y step / dir on D3 / D6; Enable on D8. Worked calculations on this page: steps per mm, driver current (a4988), maximum feed, resolution.
How do I test it?
100 mm square: Sides within ±0.5 mm. Circle of 80 mm: Roundness checked. Same pattern 5 times: Repeatability. Long drawing: No missed steps (corners still line up).
What are the objectives?
To build an A4-size two-axis frame with belt drives. To calibrate steps per mm on each axis. To draw from G-code generated from an image or text, with pen up and down. To measure dimensional accuracy and repeatability on a test pattern.
