CNC Drawing Machine With Arduino and 28byj-48 Stepper | Step-by-Step Tutorial

by piyushsuteri in Circuits > Arduino

259 Views, 3 Favorites, 0 Comments

CNC Drawing Machine With Arduino and 28byj-48 Stepper | Step-by-Step Tutorial

DIY CNC Drawing Machine with Arduino and 28byj-48 stepper | Step-by-Step Tutorial
imresizer-1729137905254.jpg
WhatsApp Image 2024-10-15 at 16.52.11_747f3556.jpg

Ready to tackle a cool project? This Instructable will guide you through building your very own CNC pen plotter using an Arduino. What makes this special? We're focusing on cost-effectiveness, still not compromising on quality by utilizing easily accessible materials like wood and cardboard, along with unipolar stepper motors. You'll learn how to combine hardware and software to create a functional plotting machine in detail.

Supplies

Mechanical Components:

  1. Wood:
  2. Wooden strips (approx. 22 x 22 mm cross-section). In my case, I used discarded wood used for making window frames.
  3. Wooden strips (approx. 11 x 15 mm cross-section)
  4. Thinner wood/cardboard pieces/sheets
  5. Smooth Steel Rods:
  6. 4 pieces x 8 mm diameter x approx. 300 mm length (smooth rods for Y and X axes)
  7. 2 pieces x 8 mm diameter x approx. 100 mm length (smooth rods for Z-axis)
  8. Bearings:
  9. 4 pieces x LM8UU 8 mm Linear Motion Bearing (for X and Y axes)
  10. 2 pieces x LM8UU 8 mm Linear Motion Bearing (for Z-axis)
  11. Pulleys & Belts:
  12. 2 pieces x GT2 Timing Pulley For 6mm Belt; 20 Teeth; 5mm Bore (driving pullies for X and Y axis stepper motors)
  13. 1 piece x Open Ended GT2 Belt; Width 6mm; Length 100mm (for X and Y axis)
  14. 2 pieces x GT2 Timing Idler Pulley For 6mm Belt; 20 Teeth; 5mm Bore (idler pulleys for X and Y axis belt tensioning)
  15. Fasteners:
  16. M4 Wood Screws for attaching wood pieces and parts)
  17. M5 Bolts and nuts (for securing pulleys)
  18. M3 Bolts and nuts (for mounting components)
  19. Zip ties (for securing linear bearings)
  20. Wood glue (Fevicol or similar)
  21. Double-sided tape (for mounting the servo motor)
  22. Miscellaneous:
  23. Standard pen/sketch
  24. Thin string or wire repurposed from the transformer coil (for the servo pen lifting mechanism)
  25. Small rubber (for pen lifter return)

Electronic Components:

  1. Microcontroller:
  2. Arduino Uno
  3. Stepper Motors:
  4. 2 pieces x 28BYJ-48 Stepper Motor DC 5V (for X and Y axes)
  5. 2 pieces x ULN2003A Driver Module Stepper Motor Driver Board
  6. Servo Motor:
  7. 1 piece x SG90 9g Micro Servo Motor (for Z axis or pen lifter)
  8. Limit Switches:
  9. 4 pieces x Micro Limit Switches (normally open type; for X and Y axes)
  10. Resistors:
  11. 2 pieces x 10k Ohm Resistors (for limit switches)
  12. Wiring:
  13. Jumper wires (male-to-male, male-to-female)
  14. Breadboard (mini, for wiring limit switches)
  15. Power Supply:
  16. 5V DC Power Supply (e.g., phone charger and USB cable, or a dedicated 5V power adapter)

Tools:

  1. Ruler/Measuring Tape
  2. Pencil/Marker
  3. Drill (with various drill bits, e.g., 3.5 mm, 8 mm)
  4. Hexsaw
  5. Screwdriver set
  6. Pliers
  7. Scissors/Cutters

The estimated cost for this project is approximately ₹2000 (roughly $24). This excludes the cost of repurposed materials like wood and cardboard and the power supply. Components were sourced from 'Robu.in' in India; ordering from other platforms like Amazon may increase the overall budget.

Understanding the Design (CAD Model Overview)

X-axis support left (3).jpg
X-axis support left.jpg
X-axis support left (1).jpg
X-axis support left (4).jpg
X-axis support left (5).jpg

Before we start building, let's break down the mechanical design of our pen plotter. Refer to the attached images to visualize these components.

Key Components

  1. Gantry: This is the main frame of the plotter, providing structural support. It consists of two primary sub-parts: the gantry base and the X-axis support.
  2. Axes: These are the rails along which the pen moves to create drawings.
  3. X-axis: Controls the horizontal movement (left and right) of the pen lifter, driven by a stepper motor and a timing belt.
  4. Y-axis: Controls the forward and backward movement of the entire print bed (the paper surface), also driven by a stepper motor and a timing belt.
  5. Z-axis: Manages the vertical movement of the pen (lifting it up or pressing it down), actuated by a small servo motor.


How it Works: Mechanical Movement

A pen plotter precisely draws images or text by coordinating the movement of a pen across three axes:

  1. X-axis (Horizontal Movement): A stepper motor, fitted with a driving pulley, pulls a timing belt. This belt is connected to the pen lifter, which holds the pen. As the motor rotates, the pen carriage slides horizontally along smooth linear rods (supported by linear bearings for minimal friction), moving the pen left or right across the paper.
  2. Y-axis (Print Bed Movement): A second stepper motor, located at the back of the plotter, drives another timing belt. This belt is attached to the print bed (the platform that holds the paper). When this motor operates, the print bed slides forward or backward along its own set of smooth linear rods and bearings.
  3. Z-axis (Pen Lift/Drop): A small servo motor is mounted on the pen carriage. A thin string mechanism connects the servo horn to the pen holder. Rotating the servo either lifts the pen off the paper (for non-drawing movements) or lowers it onto the paper to begin drawing a line.


Overall Operation

The magic happens when an Arduino microcontroller takes G-code commands from your computer. It translates these commands into precise electrical pulses that tell each stepper motor how many "steps" to take and the exact angle for the servo. By coordinating the simultaneous movement of the X and Y axes and precisely controlling the Z-axis (pen up/down), the plotter can accurately replicate complex digital designs onto physical paper. Throughout the system, idler pulleys are used to maintain proper tension in the timing belts, ensuring smooth and consistent motion.

I put a lot of thought and effort into planning and designing this pen plotter. For precise dimensions for drilling holes, cutting, and more detailed information, please refer to the 3D model files:

  1. 3D model file (FreeCAD document): https://github.com/piyush-suteri/grbl2dcnc
  2. Pen plotter 3D model (.step): https://drive.google.com/file/d/1qWtGvi9CmnBxgtljN3fKdhSpOpWY80Oh/view?usp=sharing

While you're encouraged to customize this design based on your available materials and needs (the fundamental operation remains the same), I truly hope you don't just copy this project. Instead, learn from its principles to inspire and build your own unique pen plotter. This Instructable will, however, guide you through my specific design.

Making the Gantry Base

step2
Screenshot 2025-07-03 122622.png
Screenshot 2025-07-03 122254.png
Screenshot 2025-07-03 121404.png

The gantry base forms the fundamental structure, anchoring both the X-axis support and the Y-axis. This rectangular frame provides a stable foundation for the plotter's movement.

Materials Needed:

  1. 22 x 22 mm wooden strip

Instructions:

  1. Prepare the Top Piece: Cut one 240 mm piece. Drill holes as indicated in Image 2.
  2. Prepare the Bottom Piece: Cut one 300 mm piece. Drill holes as indicated in Image 3.
  3. Assemble the Frame: Using wood glue, carefully join the prepared top, bottom, and two 300 mm side pieces to form a rigid rectangular frame, as shown in Image 1.

(Note for attached images of each step: In the sketches, drilled holes are highlighted in green, while other colors are for representation.)

Building the Electronics Mount

step3
Screenshot 2025-07-03 124147.png
Screenshot 2025-07-03 123926.png

This "L"-shaped or rectangular mount provides a stable platform for the Arduino microcontroller and stepper motor drivers. Strategically placed on the gantry base, it ensures the electronics are securely housed and accessible, yet out of the way of the plotter's moving parts.

Materials Needed:

  1. 1 piece of thick cardboard (approximately 150 x 150 mm)

Instructions:

  1. Cut the Mount: Cut the cardboard piece into an "L" shape or a simple rectangle. The exact dimensions aren't critical, but ensure it's large enough to comfortably accommodate your Arduino board and all stepper drivers without overcrowding.
  2. Mount to Gantry Base: Using glue, attach this cardboard piece to the top-right corner of the gantry base.

Building Y-axis Stepper Motor Bracket

step4
Screenshot 2025-07-03 125538.png
Screenshot 2025-07-03 125350.png
Screenshot 2025-07-03 124854.png

These small wooden blocks form a crucial bracket that securely mounts the 28BYJ-48 stepper motor, driving the Y-axis movement.

Materials Needed:

  1. 22 x 22 mm wooden strip

Instructions:

  1. Prepare the Blocks: Cut two pieces from the 22 x 22 mm wooden strip, each 44 mm long.
  2. Drill Mounting Holes: In each of these two blocks, drill a hole. Ensure these holes are precisely spaced to align with the mounting holes on the 28BYJ-48 stepper motor. Refer to Image 2 and Image 3 for drilling locations and spacing.
  3. Attach to Gantry Base: Use glue to securely attach the two drilled blocks to the inner side of the top piece of the gantry base. Position them carefully to create a stable mount for the Y-axis stepper motor. Place one block next to the electronics mount, and the second block will serve to complete the bracket for the stepper motor that will be added later between these blocks.

Building Y-axis Idler Pulley Support

step5
Screenshot 2025-07-03 130646.png
Screenshot 2025-07-03 125759.png
Screenshot 2025-07-03 130703.png
Screenshot 2025-07-03 130539.png

The support for the Y-axis idler pulley ensures smooth belt tension and precise movement for the plotter's Y-axis. The two-piece design allows for precise height alignment.

Materials Needed:

  1. 22 x 22 mm wooden strip
  2. 11 x 15 mm wooden strip

Instructions:

  1. Create the Main Support Block:
  2. Cut one 27 mm long piece from the 22 x 22 mm wooden strip.
  3. Securely attach this block to the inner side of the gantry base's bottom piece. This forms the primary support for the idler pulley. Refer to Image 1 and Image 2 for placement.
  4. Fabricate and Attach the Pulley Riser:
  5. Cut one 27 mm long piece from the 11 x 15 mm wooden strip. This piece will act as a riser to elevate the idler pulley by 15 mm, ensuring proper belt alignment with the stepper motor's pulley.
  6. Firmly glue this riser piece on top of the previously mounted 22 x 22 mm support block. See Image 3 and Image 4.
  7. Drill Pulley Mounting Hole: Drill a central hole through the newly attached pulley riser. This hole should be sized for an M5 bolt, which will be used to secure the idler pulley.

Creating Linear Bearing Brackets

step7
Screenshot 2025-07-03 133025.png

In this step, we will create the mounts for the LM8UU linear bearings. These bearings are designed to fit into smooth rods, which serve as tracks for carriages that move or slide along different axes. To attach the linear bearings, which can move freely within the smooth rods, to the carriages, we need to design a mount for them.

Materials Needed:

  1. 11 x 15 mm wooden strip

Instructions:

  1. Cut the Brackets: Cut four pieces, each 45 mm long, from the 11 x 15 mm wooden strip. These will serve as "Linear Bearing Brackets."
  2. Drill Mounting Holes: Drill holes on each of these four pieces as precisely indicated in the attached image. These holes are designed for mounting the brackets to the X and Y-axis carriage assemblies.
  3. Secure Linear Bearings: For each of the four wooden brackets:
  4. Place one LM8UU Linear Bearing onto the bracket.
  5. Securely fasten the bearing to the wooden block using two zip ties. Ensure the zip ties are pulled very tight to eliminate any play, which is vital for accurate plotting.
  6. Trim any excess zip tie material for a neat finish.

Making the Print Bed Assembly

step6
Screenshot 2025-07-03 131546.png
Screenshot 2025-07-03 132424.png

The print bed assembly is where the paper or drawing surface will sit. A stable and smooth print bed is crucial for accurate plotting.

Prepare the Print Bed

  1. Take a piece of cardboard measuring approximately 180 x 250 mm. Laminate it with tape for a smoother surface for quality print.
  2. Drill four small holes, one in each corner of the cardboard. These holes will be used to secure the print bed to its underlying support structure.


Build the Print Bed Support Structure

This rigid wooden frame provides the necessary support and attachment points for linear bearings, enabling smooth movement along the Y-axis.

Materials Needed:

  1. 11 x 15 mm wooden strips

Instructions:

  1. Cut the Support Strips: From the 11 x 15 mm wooden strips, cut the following pieces to form a frame:
  2. 2 longer pieces @ 250 mm
  3. 2 shorter pieces @ 150 mm
  4. 1 center piece @ 85 mm
  5. Refer to Image 1 and Image 2 for the layout of these pieces.
  6. Assemble the Frame as shown in the video.
  7. Drill Bearing Attachment Holes: Drill holes at specific locations on this wooden frame. These holes are critical for attaching the linear bearing brackets in a later step, as shown in Image 2.
  8. Place the prepared print bed on top of the print bed support structure. Align the pre-drilled holes in the print bed with the support structure. Secure the print bed to the support structure using small wood screws.

Mounting Linear Bearings on Print Bed

step8

The print bed will support the paper and move along the Y-axis rails. To achieve this, a linear bearing will be inserted into smooth rods that serve as the guides for the movement of the Y-axis carriage. Therefore, mount the linear bearing bracket that was prepared in Step 6 onto the print bed support structure using screws, as shown in the video.

Installing Smooth Rods and Print Bed in Y-axis

step9
Screenshot 2025-07-03 154703.png
Screenshot 2025-07-03 154728.png

This step involves installing the smooth rods on which the Y-axis print bed assembly will slide. These rods, along with the linear bearings, ensure precise and friction-free movement, which is critical for the plotter's accuracy.

Materials Needed:

  1. 2 x 8 mm diameter, 300 mm length smooth rods
  2. 8 small screws (suitable for wood and holding the rods)

Instructions:

  1. Carefully insert each of the two 8 mm x 300 mm smooth rods through the linear bearings that we attached to the Y-axis print bed assembly in the previous step.
  2. After inserting the rods, the print bed assembly should now slide freely and smoothly along the entire length of these rods.
  3. Secure the Rods to the Gantry Base:
  4. Position the print bed assembly roughly in the center of the gantry base.
  5. For each end of the two smooth rods (total of four ends), use two screws. Fasten these screws into the top and bottom pieces of the gantry base, positioning two screws on each side of the rod's end.
  6. Tighten the screws carefully so that they effectively "sandwich" and lock the smooth rods securely in place as shown in the video. This prevents any movement of the rods themselves during operation.

Installing the Y-axis Stepper Motor and Pulley System

step10
Screenshot 2025-07-03 155812.png
Screenshot 2025-07-03 155905.png

This crucial step involves setting up the Y-axis stepper motor, its driving pulley, and the timing belt system. Refer to the attached video for a comprehensive visual guide.

Y-Axis Stepper Motor and Drive Pulley Installation

  1. Mount the Stepper Motor:
  2. Position the 28BYJ-48 stepper motor onto the wooden brackets prepared in Step 4 on the gantry base.
  3. Securely fasten the motor using small screws, ensuring it is firmly seated and does not wobble.
  4. Also, its shaft should be in the direction of the back side of the plotter. This maximizes the reach of the print bed.
  5. Attach Drive Pulley:
  6. Carefully attach the GT2 20-tooth timing pulley to the shaft of the stepper motor.
  7. Ensure the grub screws on the pulley align with the flat side of the motor shaft and tighten them firmly to prevent slipping.
  8. Route and Attach Timing Belt:
  9. Cut a 500 mm piece of the timing belt. Take two screws and wrap the end of timing belt around each screw. To secure the wrap, use zip ties along the width of the timing belt to ensure it is tightly sandwiched.
  10. Route one end of the GT2 timing belt around the newly installed drive pulley.
  11. Place the belt over the Y-axis print bed assembly and firmly secure both ends to the print bed using the small screws already attached to the belt ends. This forms the closed-loop drive system that converts motor rotation into linear motion for the Y-axis.


Y-Axis Idler Pulley Installation

  1. Route Belt Around Idler:
  2. Route the GT2 timing belt around an idler pulley. This strategic routing provides the necessary tension to the belt system and accurately guides it, preventing slippage and ensuring consistent Y-axis motion.
  3. Mount the Idler Pulley:
  4. Install the M5 bolt to the idler pulley riser block. Attach this idler pulley onto the M5 bolt.
  5. Use a washer on either side of the pulley and secure it with a nut, ensuring the pulley can spin completely freely without any binding. This free rotation is essential for smooth belt tension.

Preparing the Z-Axis Carriage (Pen Holder)

step11
Screenshot 2025-07-03 161140.png

This step focuses on creating the Z-axis carriage, which holds the pen. This component slides vertically on the Z-axis, allowing movement of the pen to move up and down to make contact with the drawing surface.

Materials Needed:

  1. 1 piece of cardboard or wood (approximately 30 x 85 mm)
  2. 2 x LM8UU linear bearings
  3. Cable ties

Instructions:

  1. Cut the Carriage Piece: Take your chosen material (cardboard or wood) and cut it to the dimensions of 30 x 85 mm.
  2. Drill Mounting Holes: Precisely drill holes on this carriage piece, specifically spaced for mounting the LM8UU linear bearings and pen in the middle as shown in the accompanying image.
  3. Mount the Linear Bearings:
  4. Position each of the two LM8UU linear bearings over their respective holes on the carriage.
  5. Securely fasten each bearing using cable ties, as demonstrated in the accompanying video.

Assembling the Z-Axis Rails

step12
Screenshot 2025-07-03 210257.png
Screenshot 2025-07-03 162329.png

This step focuses on creating the Z-axis rail assembly, which provides precise vertical guidance for the pen.

Materials Needed:

  1. 2 x 8 mm diameter, 100 mm length smooth rods
  2. 11 x 15 mm wooden strip

Instructions:

  1. Insert Smooth Rods into Bearings:
  2. Take the Z-axis carriage prepared in the previous step.
  3. Carefully insert each of the two 8 mm x 100 mm smooth rods through the linear bearings mounted on the carriage. The carriage should slide freely along these rods.
  4. Prepare Z-Axis Support Pieces:
  5. Cut two pieces, each 80 mm long, from the 11 x 15 mm wooden strip. These will serve as the top and bottom supports for the Z-axis rails.
  6. Assemble the "H" Structure:
  7. Take the two 80 mm wooden pieces and drill holes of diameter 8 mm for smooth rods. Refer to the attached image for the precise positioning of these holes.
  8. Tightly fit them onto the ends of the smooth rods.
  9. Ensure these wooden pieces are perfectly parallel to each other and perpendicular to the rods. When assembled, this will form a rigid "H" shape, with the Z-axis carriage suspended between the rods.
  10. Refer to the attached video for assembly visualization.

Crafting the X-Axis Carriage

step13
Screenshot 2025-07-03 210958.png
Screenshot 2025-07-03 164139.png

This component serves as the central part of the X-axis carriage assembly or pen lifter assembly. Its critical role is to connect the X-axis linear motion system at the back while providing a stable anchor point for the Z-axis rails at the front.

Materials Needed:

  1. 1 piece of plywood or thick cardboard (100 x 45 mm)
  2. Screws (for attaching linear bearing brackets)

Instructions:

  1. Cut the Carriage Piece: Cut plywood or cardboard to 100 x 45 mm.
  2. Drill Mounting Holes: Drill holes on this piece precisely as shown in Image 2. These holes are specifically for securely mounting the linear bearing brackets and attaching the X-axis timing belt.
  3. Install Linear Bearing Brackets: Attach the previously prepared linear bearing brackets to the X-axis carriage using screws, fastening them into the drilled holes.

Assembling the Pen Lifter (Z-Axis Rails to X-Axis Carriage)

step14
Screenshot 2025-07-03 164509.png
Screenshot 2025-07-05 123334.png

This step integrates the Z-axis rail assembly from step 12 with the X-axis carriage from step 13.

Instructions:

  1. Mount Z-Axis Rails Assembly to X-Axis Carriage: Securely attach the Z-axis rail assembly (completed in Step 12) onto the top surface of the X-axis carriage (from Step 13) using glue.

Installing Servo Motor

step15

Install the servo motor into the pen lifter assembly as shown in the video.

Building X-axis Support

Screenshot 2025-07-03 221606.png
Screenshot 2025-07-03 165736.png
Screenshot 2025-07-03 170121.png
Screenshot 2025-07-03 170317.png

The X-axis support assembly is a critical sub-component that attaches to the gantry base. Its purpose is to securely hold and provide guidance for the entire X-axis system, which includes the X-axis stepper motor and idler pulley.

Materials Needed:

  1. 22 x 22 mm wooden strip

Instructions:

  1. Prepare X-Axis Support Pieces:
  2. Cut two 150 mm pieces from the 22 x 22 mm wooden strip.
  3. Drill holes in these two pieces as indicated in Image 2. These will serve as your main left and right supports for the X-axis.
  4. Fabricate Idler Pulley Support:
  5. Cut one 27 mm piece from the 22 x 22 mm wooden strip.
  6. Drill a hole in this piece for the idler pulley, as shown in Image 3.
  7. Create Stepper Motor Bracket:
  8. Cut two 44 mm pieces from the 22 x 22 mm wooden strip.
  9. Drill holes in these two pieces, spaced to firmly hold the X-axis stepper motor between them. Refer to Image 4 for hole placement.
  10. Assemble the X-Axis Support Pieces:
  11. Securely glue the idler pulley support (27 mm piece) onto the left 150 mm X-axis support piece.
  12. Similarly, glue the two stepper motor bracket pieces (44 mm pieces) onto the right 150 mm X-axis support piece, creating the mount for the stepper motor.
  13. Refer to the attached images for the precise positioning of these components.

Installing the X-Axis Smooth Rods and Stepper Motor

step17
Screenshot 2025-07-03 172210.png

This step involves setting up the X-axis rails and integrating the X-axis stepper motor. This assembly will allow the pen lifter (and thus the pen) to move precisely across the width of the plotter.

Materials Needed:

  1. 2 x 8 mm diameter, 300 mm length smooth rods
  2. Small screws (for locking rods)
  3. GT2 20-tooth timing pulley

Instructions:

  1. Mount the X-Axis Stepper Motor:
  2. Place the X-axis stepper motor firmly into the bracket built in the previous step.
  3. Secure it using small screws, ensuring it's tightly mounted and won't shift during operation.
  4. Attach Drive Pulley:
  5. Attach a GT2 20-tooth timing pulley to the shaft of the X-axis stepper motor.
  6. Secure it firmly with the grub screws on the pulley, aligning them with any flat spots on the motor shaft.
  7. Insert Pen Lifter onto Smooth Rods:
  8. Take the pen lifter assembly and carefully insert its linear bearings onto the two 8 mm diameter, 300 mm length smooth steel rods. The pen lifter should slide freely along these rods.
  9. Secure X-Axis Smooth Rods:
  10. Position the two smooth rods within the X-axis support assembly.
  11. Similar to how we secured the Y-axis rods, use small screws at each end of the rods to lock them securely into the X-axis support's 150mm pieces. Position two screws per rod end, one on each side, to "sandwich" the rod firmly in place. This prevents any unwanted movement of the rails themselves.

Installing the X-Axis Support to the Gantry Base

step18
Screenshot 2025-07-03 222947.png
Screenshot 2025-07-03 173154.png

This step involves integrating the complete X-axis assembly (including its motor, rails, and pen lifter) with the main gantry base.

Materials Needed:

  1. GT2 timing belt
  2. Small screws (for belt attachment)
  3. Wood glue

Instructions:

  1. Route and Attach X-Axis Timing Belt:
  2. Cut the timing belt into a 500 mm piece. Like we did for the Y-axis belt, take two screws and attach them to each end of this belt.
  3. Route your GT2 timing belt around the GT2 driving pulley.
  4. Securely attach both ends of the timing belt to the pen lifter assembly using small screws, as demonstrated in the attached video. This creates the critical closed-loop drive system that will move the pen lifter along the X-axis.
  5. Position X-Axis Support in Gantry Base:
  6. Carefully slide the assembled X-axis support into the gantry base. The two 150 mm side pieces of the X-axis support will fit against the inner sides of the gantry base's left and right parts.
  7. Crucially, position the X-axis support precisely 78 mm below the outer edge of the gantry's top piece. Refer to Image 2 for this exact measurement and positioning within the gantry base. Precision here is vital for the plotter's alignment. In our case, the right X-axis support fits just next to the electronics mount at its bottom-right corner.
  8. Secure X-Axis Support:
  9. Once correctly positioned, use wood glue to firmly secure the X-axis support to the gantry base.
  10. Allow the glue to dry completely and properly cure before proceeding to the next steps.

Tensioning X-axis Belt

step19
Screenshot 2025-07-03 223343.png

This step focuses on installing the X-axis idler pulley.

Materials Needed:

  1. Idler pulley
  2. M5 bolt
  3. Washer(s)
  4. Nut

Instructions:

  1. Mount the Idler Pulley:
  2. Pass the M5 bolt through the hole in the X-axis idler pulley support block.
  3. Carefully route the GT2 timing belt around an idler pulley to provide tension on the belt.
  4. Attach this idler pulley onto the M5 bolt protruding from the X-axis idler pulley support block.
  5. Use a washer on either side of the pulley and secure it firmly with a nut. The crucial part here is to ensure the pulley can spin completely freely without any binding.

Building String Mechanism for Pen Lifter

step20
Screenshot 2025-07-03 223943.png

This step creates the string mechanism that will precisely control the vertical movement of the pen. Using a servo and a simple string-and-rubber-band system, we will achieve smooth and reliable pen lifting and lowering, crucial for clean plots.

Materials Needed:

  1. Thin string or wire
  2. Rubber band
  3. Small screws (for attaching the pen)

Instructions:

  1. Attach String to Servo Horn:
  2. Securely attach one end of a thin string or wire to the horn of the servo motor. Ensure this connection is firm, as it will bear the weight and tension of lifting the pen.
  3. Route and Secure String to Pen Holder:
  4. Route the string downwards, guiding it carefully around the Z-axis carriage (pen holder).
  5. Secure the other end of the string to the pen holder plate. When the servo rotates, this string will pull the pen upwards.
  6. Install Rubber Band for Smooth Drop:
  7. Stretch a rubber band across the pen holder plate.
  8. Securely fix the ends of this rubber band to the bottom Z-axis support (one of the 80 mm wooden pieces). This rubber band acts as a counter-force, ensuring the pen falls smoothly and consistently when the servo retracts, preventing it from getting stuck in the raised position. It also pushes the pen down so that it properly rubs with the paper while the pen plotter is operating.
  9. Attach the Pen:
  10. Finally, attach your chosen pen to the pen lifter using small screws. Ensure the pen is held firmly but can be easily replaced. Refer to the attached video for detailed guidance on routing the string and attaching the pen.

Electronics Wiring and Installation

GRBL_28BYJ-48_Stepper_Servo_penplotter.png
step21

This step covers the electronics wiring and component installation for your pen plotter. Follow the circuit diagram and instructions carefully.

Materials Needed

  1. Arduino UNO (mounted)
  2. 2 x ULN2003A stepper motor drivers (mounted)
  3. 2 x 28BYJ-48 stepper motors (X and Y axes)
  4. Z-Axis Servo (pen lifter)
  5. 4 x Limit Switches (X and Y axes)
  6. 2 x 10k Ohm resistors
  7. Jumper wires
  8. 5V power supply

Instructions

  1. Mount Main Components: Securely mount the Arduino UNO and two ULN2003APG stepper motor drivers onto the electronics mount. In my design USB port on Arduino will face the back side of the plotter for easy connection to the computer, as shown in the video of this step.
  2. Wire According to Circuit Diagram:
  3. Stepper Motor Drivers: Connect X and Y-axis stepper motors to their respective ULN2003APG drivers.
  4. Arduino Connections: Connect motor drivers, the Z-axis servo, and limit switches to the correct digital and analog pins on the Arduino UNO.
  5. Power Supply: Connect the 5V power supply to the stepper drivers.
  6. Resistors: Incorporate the two 10k Ohm resistors for the limit switches as indicated. You can solder them directly into cables running to limit switches or as I have done use mini breadboard, which you can screw on back side of gantry's base near to Arduino Uno placement.
  7. Install Limit Switches: Install the four limit switches (two for each X and Y-axis) at the extreme ends of their axes. Ensure the X and Y carriages trigger these switches at their end-of-travel points. For their physical installation, you can use double-sided tape.

Limit switches are essential components for both safety and defining the plotter's home position. They act as physical stops, preventing the axes from crashing into the machine's structural limits and damaging components. They also provide a known starting point for precise plotting operations.

Setting Up Software & Code

Our custom-built pen plotter is slightly different from a typical 3-axis CNC machine that uses bipolar stepper motors with dedicated drivers (like A4988). Our specific setup requires custom firmware (called GRBL) for Arduino and careful G-code generation due to its non-standard configuration.

Before diving into the GRBL firmware, it's crucial to understand how a CNC machine (and this specific pen plotter) works from a control perspective:

  1. Design: You design a 3D model of your part (e.g., in Fusion 360). In the case of a pen plotter, we create drawings on our computer to be plotted.
  2. G-code Generation: The 3D model or drawing is converted into G-code, which is a text file containing sequential commands for the machine's movements. Think of it like a map containing coordinates and other crucial information, over which the tool head (in CNC) or pen (in pen plotter) will travel to produce 3D or 2D prints. This file is generated within the CAD software or other specific generator software. In our case, we will use an extension.
  3. G-code Sending: A program (like UGS in our case) sends individual lines of G-code to the CNC controller.
  4. CNC Control: The CNC controller (in this case, an Arduino) interprets these G-code commands.
  5. Motor Control: The controller then sends signals to motor drivers (or directly to motors in this specific case) to move the axes by a precise number of steps in a specific direction. We will need to fine-tune the number of steps for precise working within UGS.


Instead of a bipolar stepper motor (in a typical CNC) with a driver, this plotter uses a servo for pen up/down. Servos require a different control scheme than steppers.

The X and Y axes use unipolar 28BYJ-48 stepper motors. Most common CNCs use bipolar NEMA 17 steppers. Unipolar motors require a different control method and often different drivers (though here, the Arduino handles it directly via a Darlington array). The Arduino directly controls the unipolar steppers via a ULN2003 Darlington Array, which just amplifies the Arduino's signal.

Standard GRBL firmware is designed to send step/direction signals to dedicated stepper drivers (like A4988 or DRV8825) that then handle the complex coil sequencing for bipolar motors.

Problem: The standard GRBL firmware (designed for bipolar steppers with external drivers and common Z-axis setups) will not work directly for this unipolar, servo-Z-axis plotter.

Solution: We need a modified version of GRBL that specifically accounts for unipolar steppers and servo control for the Z-axis. Fortunately, there exists a fork of the original GRBL adapted for our exact setup. You can find it here: ruizivo/GRBL-28byj-48-Servo: GRBL 0.9j to control unipolar motors (28byj-48) plus Servo motor support. We will come back to it later.


Next download and install the following software:

  1. Arduino IDE:
  2. https://www.arduino.cc/en/software
  3. This software will be used to upload custom programs into Arduino Uno.
  4. Universal G-code Sender (UGS):
  5. https://winder.github.io/ugs_website/download/
  6. UGS is a cross-platform G-code sender used to stream G-code commands to the pen controller.
  7. Download and extract the .zip file from its website.
  8. Navigate into the extracted folder.
  9. Inside, you'll find another folder (e.g., ugsplatform-win). Open that.
  10. Inside ugsplatform-win, open the bin folder.
  11. You'll see two launchers: ugsplatform.exe and ugsplatform64.exe.
  12. Important: Move the entire top-level folder (e.g., ugs-platform-app-win64) to a convenient and permanent location on your computer (e.g., C:/Program Files/UGS/).
  13. Right-click ugsplatform64.exe and select "Send to" -> "Desktop (create shortcut)" for easy access.
  14. Inkscape:
  15. https://inkscape.org/
  16. We will be using this software to create drawings to be printed by the plotter.


Next, we need to download the GRBL code. The modified GRBL from GitHub, which I referred to earlier, has some issues in its latest version. There is a minor issue in one of its files. I am not mentioning here the exact issue. Fortunately, a YouTuber identified and developed a fix for it. For details, you can refer to the following video: https://youtu.be/f6xCfzfiD6Q?si=vlG1DHRsYtvmsL0m

This video is excellent video for setting up of CNC pen plotter. This video helped me a lot in completing this pen plotter.

By the way, you can directly download the error-free GRBL code from here:

  1. https://drive.google.com/drive/folders/1BK7R9flkKBS3XEpVrhz4-FWTWdAa7MUf?usp=sharing
  2. Note that this library is different from the original GRBL library, which supports bipolar motors only.
  3. Extract the downloaded zip file.
  4. Crucial Pre-step: Navigate to your Arduino sketchbook folder, usually located in Documents/Arduino. Inside this folder, there should be a libraries subfolder.
  5. If the libraries folder exists, check for any existing grbl folders (from previous GRBL installations or other tutorials).
  6. Delete any existing GRBL folders: This is vital to avoid conflicts.
  7. If the libraries folder does not exist, open the Arduino IDE. Go to "Tools" -> "Manage Libraries..." and install any random library. This will automatically create the libraries folder in the correct location. You can then uninstall the temporary library if you wish.
  8. From the unzipped folder, copy the grbl subfolder (the one that contains cpu_map, defaults, gcode, etc.) into your Documents/Arduino/libraries folder.

Arduino libraries provide pre-written code for common functionalities. Placing the specific grbl folder here makes it available for use in the Arduino IDE. Deleting previous versions prevents the IDE from getting confused by multiple GRBL definitions.

Before continuing further, we need to first understand what is homing, which is crucial for further steps. Homing in CNC is like telling the machine where its "home" is. When you turn on a CNC machine, it doesn't know its exact position. It could be anywhere within its working area. Without knowing its starting point, it wouldn't be able to accurately move to the coordinates you give it.

How it works?

  1. Reference Points: The CNC machine has "limit switches", at the very end of each axis. Each axis typically has one limit switch. In our case, we used two limit switches per axis. One limit switch will act as the home position and the other as the terminal position. Whenever carriage of any axis accidentally hits any of the limit switches, the pen plotter immediately enters an alarming mode and stops all its operations for safety purposes.
  2. Moving to Home: When you initiate the "homing" sequence or simply send a command for homing from UGS, the machine starts slowly moving each of its carriages towards these switches.
  3. Finding Zero: When an axis hits its home switch, the machine knows it has reached that specific reference point. It then records this position as its "zero" or "home" position for that axis.
  4. Repeating for all Axes: This process is repeated for all the axes of the machine.
  5. Once the machine has homed all its axes, it knows its absolute position. From this "home" or "zero" point, it can then precisely move to any other coordinate you program your CNC.
  6. Homing is done before starting any work in CNC. Homing will return each carriage to its start position.
  7. GRBL's default expectation for homing is towards the negative end of both axes, i.e., when homed pen will be near to top-right corner of the paper in the print bed. Here's how this translates to our plotter:
  8. X-axis: The left side is the negative direction.
  9. Y-axis: The front side of our pen plotter is the negative direction.
  10. This setup mirrors the standard Cartesian coordinate system you're familiar with from your math studies. Therefore, in the home position, the print bed will be at its frontmost point, and the pen lifter will be at its leftmost point.
  11. If your plotter homes to a different direction, it indicates an incorrect motor rotation direction. We'll cover how to correct this in a later step.


Inside the GRBL folder, you will find a file named config.h which contains most configuration and settings of the pen plotter. This file is well documented inside to allow easy modifications. Once you complete your pen plotter and start getting nice prints from it, you can come back to this file to experiment with different configuration settings. This file is modified from the original version of GRBL-28byj-48-Servo to incorporate some changes. I am mentioning the changes made in brief here. Note: You need not worry about them; they are only for knowledge.

Standard GRBL firmware expects a 3-axis CNC machine with limit switches on all axes and attempts to home the Z-axis first for safety before moving X and Y. If the GRBL firmware were to upload, the plotter would likely try to home its Z-axis indefinitely, as there's no limit switch for the servo Z-axis. This Z-axis homing behavior needs to be explicitly disabled in the GRBL configuration. I have modified this to first home X and then Y axis. Lifting the servo before homing will be managed by the G-Code of our drawing. We will learn this in the latter step.

Uploading GRBL Code to Arduino

Connect your Arduino Uno to your computer via a USB cable. Do NOT connect external power to the stepper motors yet. The Arduino will receive enough power from the USB connection for initial programming and testing the controller logic. Once all the previous steps have been completed successfully:

  1. Open the Arduino IDE.
  2. Select your board: Go to "Tools" -> "Board" -> "Arduino AVR Boards" -> "Arduino Uno" or, in the latest version of Arduino IDE, just search for it using the Select Board dropdown menu in the toolbar.
  3. Select your COM port: Go to "Tools" -> "Port" and choose the COM port associated with your Arduino Uno (it might be labeled "Arduino Uno" or "USB Serial Port (COMX)". Confirm it using the device manager application.)
  4. Go to "File" -> "Examples" -> "grbl" -> "grblUpload".
  5. Click the "Upload" button (the right-pointing arrow icon in the top-left).
  6. If done everything till now correctly and carefully, your code should successfully upload now.

Setting Up Pen Plotter

Screenshot 2025-07-04 202625.png
Screenshot 2025-07-04 203053.png

Now that GRBL is uploaded, it's time to configure its settings. These settings are saved on the Arduino's EEPROM, so they'll stick even if you power off your Arduino.

  1. Connect your Arduino Uno to your computer using a USB cable.
  2. Open Universal Gcode Sender (UGS).
  3. In the top bar of UGS, make sure "Firmware" is set to "GRBL".
  4. Select the correct "Port" (it might be something like COM6 on Windows).
  5. Set the "Baud" rate to "115200".
  6. Click the "Connect" button.
  7. Turn on the power supply for the stepper motors.

You should see GRBL's welcome message and current settings appear in the console window. This means your computer is now talking to the Arduino running GRBL. The 115200 baud rate is the standard communication speed for this version of GRBL.

We have two ways to configure GRBL:

  1. Manually via the console: The UGS console provides a powerful and flexible way to interact directly with your CNC plotter. While the graphical interface handles most tasks, using the console allows you to send specific G-code commands directly to the GRBL firmware on your Arduino.
  2. This method offers:
  3. Greater control: You can execute precise movements, query machine status, or test specific functions.
  4. Advanced troubleshooting: Directly sending commands is invaluable for diagnosing issues that might not be apparent through the graphical interface.
  5. To use the console:
  6. Locate the "Command" input field within the UGS interface at the bottom of the console window.
  7. Type your desired G-code command (e.g., G0 X10 Y10 for a rapid move to X=10 mm, Y=10 mm, or ? to query status).
  8. Press Enter to transmit the command.
  9. For a comprehensive understanding of G-code commands and their applications, I highly recommend exploring online resources and GRBL documentation. This knowledge will significantly enhance your ability to control and troubleshoot your CNC plotter.
  10. Using UGS's "Setup Wizard": This is the more user-friendly option. I'll explain this method.

Motor Wiring Settings

Screenshot 2025-07-04 204208.png
  1. From the top menu bar, navigate to "Machine" -> "Setup wizard".
  2. When the setup wizard pops up, click Next two times to enter the motor wiring section. It is recommended that you carefully read and understand the information written in each section of UI.
  3. You should now be in the motor wiring section. These settings allow you to directly control stepper motors. Clicking on the + and - movement buttons for the X and Y axes should move the carriages in those axes, respectively.
  4. You might observe that carriages on their axis might not move in the intended direction (i.e., positive or negative direction) as labeled in the button you click. If this happens, check the reverse direction checkbox next to the axis control buttons.
  5. Finally, confirm that both axes' movement is in the right direction and both carriages have full reach. You might need to confirm that no carriage is physically blocked in any position in their axis. If this is the case, try to rebuild that axis properly.

Calibrating Steps

Screenshot 2025-07-04 205135.png

This is the most crucial step for your pen plotter's accuracy!

Your Arduino controls the stepper motors by sending signals for them to rotate in tiny steps. These rotational steps are then translated into linear motion by the plotter. However, the Arduino doesn't inherently know how many of these steps correspond to a specific physical distance (in millimeters) the pen moves.

There isn't a fixed value for "steps per millimeter" because it depends entirely on your plotter's mechanical setup. To determine this, we'll use a trial-and-error method, which involves:

  1. Using the pen plotter to draw several lines on paper.
  2. Precisely measuring the actual length of each line using a scale.
  3. Comparing the number of steps the motor moved to the actual distance the pen traveled. This allows us to calculate and calibrate the "steps per mm" value. This involves repeated experimentation to fine-tune the setting.

When we use the setup wizard, this value will be automatically calculated for us, based on a formula working behind the scenes.

Follow these steps to properly calibrate your plotter:

  1. From the previous step, click Next to enter the Step Calibration section.
  2. Attach the paper to the print bed using clips on each side of the paper and print bed.
  3. Physically adjust the pen to move it down: Unscrew and re-screw the pen in a lowered position so it properly touches the paper. This ensures your drawings will be produced correctly.
  4. Once everything is ready, in the wizard under the Move label, use the + and - buttons to move each axis one by one.
  5. Start with the first axis. The pen will move and draw a small line on the page. Measure the length of this line and enter it under the Actual Movement label for that axis.
  6. The wizard's right panel displays the estimated "steps per mm" for the axis you just manipulated. Input this value into the designated text box and click on update.
  7. Repeat this process until you achieve the correct length drawn by the pen for that axis.
  8. Repeat these steps for the remaining axes.
  9. Once all axes are calibrated, click Next.

Initially, UGS aims for a 1 mm movement by instructing the Arduino to rotate the motor using the current "steps per mm" setting. This first value won't be perfectly accurate. As you provide the actual measured length of the line, the underlying algorithm refines the "steps per mm" by dividing the commanded steps by the real distance traveled. This iterative process of measuring and adjusting leads to a precise "steps per mm" calibration.

Enabling Limit Switches

Screenshot 2025-07-04 213036.png

In the setup wizard, you should currently be in the limit switches section. Please check the box to enable limit switches. Then, click the Next button.

Enabling Homing

Screenshot 2025-07-04 213741.png

Check the "Enable Homing" checkbox. Below it, you'll find options for the default homing direction. I recommend leaving these settings as they are initially. If your pen plotter homes in the wrong direction, go back to the Motor Wiring section and reverse the motor's polarity there.

Once you're confident the homing direction is correct, click "Try Homing." This should home your machine. If anything goes wrong, or if any carriage reaches an axis end and doesn't stop, immediately click "Abort" or turn off the power supply to prevent damage to your plotter.

If everything works as expected, click Next.

Enabling Soft Limits

Screenshot 2025-07-04 231651.png

Soft limits define the maximum safe distance the plotter's carriage assemblies can move from their home positions without hitting the physical end of an axis. While we have physical limit switches at the ends, soft limits are crucial because they prevent the carriages from ever reaching these switches.

When a carriage hits a limit switch, the plotter immediately stops all action and enters an "alarm" state. It's always better to avoid this alarm state by ensuring the carriages don't reach the limit switches. However, limit switches still play a vital role as a safety backup. If the "steps per mm" calibration isn't perfectly accurate, the carriage might accumulate a small error, potentially causing it to travel further than expected and trigger a limit switch. This "extra" unmeasured distance is precisely why the physical limit switches are necessary even with soft limits enabled.

To set the soft limits:

  1. From the left panel, first home the machine.
  2. Then, using the + and - buttons in the middle panel, move each carriage away from its home position.
  3. Continue moving the carriage in one direction until it's about a few millimeters (this distance is left to create space for error distance accumulation) away to trigger the limit switch at the other end of the axis.
  4. Record the distance traveled from the home position (this distance will be displayed in the middle panel as the carriage moves).
  5. Enter these recorded distances for each axis under "Max Travel Distance" in the right panel.
  6. Click Update.

Note: This "Max Travel Distance" might not be the same as the total length of the axis because the carriage's physical size reduces the effective travel distance available.

Once these steps are complete, click Finish.

Installing G-codePlot

G-code files generated by general-purpose CAD software (e.g., Fusion 360's default output) throw errors in UGS. Standard G-code often includes commands or assumes features (like dedicated Z-axis movements for spindles) that simplified GRBL (especially this specific modified version) doesn't understand or support. We will learn about this in a later step.

Standard GRBL is designed to control a spindle (which is usually on the Z-axis) via PWM (Pulse Width Modulation) for speed control. It's not inherently set up for precise servo positioning. The modified GRBL version adapted these spindle commands to control a servo, but it needs specific G-code commands for activation. This is crucial to be considered while we convert our drawings to G-code

We will use an Inkscape extension named G-code plot. GcodePlot is an Inkscape extension written in Python that allows you to export vector graphics (like SVG) directly into G-code format. This specific version is crucial because it allows for custom commands for the Z-axis, which we need for the servo.

Follow the following steps to download the G-CodePlot extension:

  1. https://github.com/arpruss/gcodeplot
  2. Under the "Code" dropdown in GitHub, click Download Zip to download the latest release.
  3. Extract the downloaded gcodeplot.zip file.
  4. Locate your Inkscape extensions folder. This is typically found at: C:\Program Files\Inkscape\share\inkscape\extensions\
  5. Copy all the files from within the unzipped gcodeplot folder (e.g., gcodeplot.py, gcodeplot.inx, etc.) directly into Inkscape's extensions folder.
  6. If prompted for administrator permissions, grant them.
  7. Close and re-open Inkscape if it is already running.

Making Your First Drawing

Screenshot 2025-07-05 003419.png
Screenshot 2025-07-05 003205.png
Screenshot 2025-07-05 003832.png
Screenshot 2025-07-05 004143.png

Congratulations! Finally, we are in a state to create our first drawing and print it.

Prepare your drawing in Inkscape:

  1. Open Inkscape. Create your desired drawing or load an existing SVG file.
  2. Important:
  3. If your drawing includes text or basic shapes (rectangles, circles), select them all (Ctrl+A) and go to "Path" -> "Object to Path" (Shift+Ctrl+C). Refer to attached image 2.
  4. This converts them into vector paths that GcodePlot can process.
  5. Important:
  6. Open the "Fill and Stroke" dialog (Shift+Ctrl+F). Select all elements of your drawing (Ctrl+A). Ensure "Stroke paint" is set to a solid color (e.g., black). Refer to attached image 3.
  7. Important (Mirroring):
  8. Inkscape's coordinate system usually has its origin (0,0) in the upper-left corner, with Y-values increasing downwards. Many CNC machines (and GRBL) use a Cartesian coordinate system with the origin in the lower-left corner and Y-values increasing upwards. Therefore, the drawing needs to be vertically flipped (mirrored across the X-axis) in Inkscape before generating G-code.
  9. Go to "Object" -> "Flip Vertical". This mirrors your drawing upside down. Refer to image 4.

Exporting to G-code

Screenshot 2025-07-05 004641.png
Screenshot 2025-07-05 004813.png

Once the drawing is ready we can export it to G-code.

Export the G-code using GcodePlot:

  1. With your drawing prepared and selected, go to "File" -> "Save As".
  2. In the "Save as type" dropdown menu, select "3-axis gcode plotter (*.gcode)".
  3. Choose a filename and click "Save".
  4. The "GcodePlot" settings window will appear.

Configuring G-CodePlot Settings

Screenshot 2025-07-05 011526.png
Screenshot 2025-07-05 011628.png
Screenshot 2025-07-05 011740.png

As a final step before outputting your G-Code, you need to adjust a few settings within the GcodePlot extension. While you're encouraged to fine-tune these settings later for optimal results, for now, you can simply use the recommended values below.

Don't worry if this feels a bit overwhelming at first; it's a one-time setup that won't require frequent modification and most settings are to be left in their default states. As you work more and more with the pen plotter, generating and streaming G-code will become much easier. You might be wondering if your plotter will actually work at this point – rest assured, it will, provided you've carefully followed and, more importantly, understood the concepts of each step so far. Understanding "how things work" is crucial for effective troubleshooting.

Configure GcodePlot Settings:


General Settings Tab:

  1. Tool mode: Select "drawing" from the dropdown.
  2. Precision (mm): 0.020 (This improves the approximation of curves.)
  3. Left x-coordinate (mm): 0.0
  4. Lower y-coordinate (mm): 0.0
  5. Right x-coordinate (mm): 200.0 (This is for paper width.)
  6. Upper y-coordinate (mm): 200.0 (This is for paper height.)
  7. Work z-coordinate (mm): 15.00
  8. Lift z-height (mm): 4.00
  9. Parking z-height (mm): 20.0
  10. Movement speed (mm/s): 5.8 (This is your plotter's maximum reliable feed rate, e.g., 350 mm/min, divided by 60 for mm/s.)
  11. Draw speed (mm/s): 5.0 (Set this slightly slower than your Movement speed for better line quality. Adjust as needed.)
  12. Z-speed (mm/s): 5.0
  13. Serial baud rate: 115200 (This must match your GRBL baud rate.)

Note: Leave the Z-axis settings as it is, since we don't have a Z-axis like a typical CNC machine.


Fitting and Extracting Tab:

  1. Leave all settings at their default values.


Drawing Settings Tab:

  1. Shading threshold: 1.00
  2. Lightest shading spacing (mm): 3.0
  3. Darkest shading spacing (mm): 1.0 (Adjust this value to control the density of shaded areas. 1.0 mm works well for this example.)
  4. Shading angle (degrees): 45.0 (This sets the angle of the shading lines.)
  5. Crosshatching:
  6. Optimization time (sec.): 60
  7. Preferred drawing direction: none


Cutting Settings Tab (CRUCIAL for Servo Control):

  1. Tool offset (mm): 0.00
  2. Overcut (mm): 0.00
  3. Lift Command: Type M05
  4. M05 is the GRBL command to stop a spindle. In the modified GRBL firmware for our plotter, M05 is repurposed to command the servo to lift the pen.
  5. Down Command: Type M03 S40
  6. M03 is the GRBL command to start a spindle. In our modified GRBL firmware, M03 SXX (where XX is a value) is repurposed to command the servo to lower the pen to a specific position. You will need to adjust the XX value to fit your pen plotter. Ensure that the value is such that it lowers the pen to the extent that it touches the paper properly. One way to do that is to reposition the servo's horn. Another way is to directly experiment with these values to find the right value. For this, you can send M05 and M03 SXX commands repeatedly using different values of the XX to the pen plotter using the UGS console.


Generate the G-code File

  1. Click "OK" in the GcodePlot settings window. The G-code file will be generated and saved.

The GcodePlot extension adds a few lines in starting of every G-Code, which are not useful for our plotter and will throw errors in UGS. We need to remove these lines from the G-Code file. Open the G-Code file saved in the previous step in Notepad. Delete the first few lines until the first servo lift command. These lines are typically:

G00 S1; endstops
G00 E0; no extrusion
G01 S1; endstops
G01 E0; no extrusion
G21; millimeters
G91 G0 F300.0 Z20.000; pen park !!Zsafe
G90; absolute
G28 X; home
G28 Y; home
G28 Z; home

For convenience, you can add a command to the G-code file that brings the pen back to the home position after plotting:

  1. Scroll to the very end of the file.
  2. Add a new line: G00 F350 X0.00 Y0.00
  3. Explanation:
  4. G00 is a rapid linear move command.
  5. F350 sets the feed rate to 350 mm/minute.
  6. X0.00 Y0.00 commands the plotter to move to the origin (home position).
  7. This ensures the pen returns to its home position after completing the drawing.
  8. Save and close the file.

Streaming G-Code

demo
Technical specification.jpg

Finally, we are there. Now we can stream the G-Code to the pen plotter, and it will produce our first print.

Load and send the G-code:

  1. Open Universal Gcode Sender.
  2. In the console, send an M05 command to lift the pen if it is lowered.
  3. Click on the "Home Machine" button in the bottom-right corner of the UGS UI. This will home your CNC Pen Plotter.
  4. Click the "Open File" icon (folder icon) in the toolbar and load your generated `.gcode` file.
  5. Click the "Send" button (play button icon) in the toolbar.

Expected Outcome: Your plotter should now draw your desired image, moving its X and Y axes and lifting/lowering the pen with the servo.

Conclusion

If you've reached this point and your plotter is successfully working, congratulations! This was indeed a deep dive into a non-standard CNC setup, and your dedication to seeing it through is truly commendable.

This project, from design and building to setup and troubleshooting, took me nearly five months. The results, however, are exceptionally rewarding – far better than I initially imagined. Throughout the process, there were moments of doubt, especially given the scarcity of comprehensive tutorials for this type of non-standard pen plotter.

I've poured a significant amount of effort into writing this instructable, taking almost three days to ensure it's one of the most detailed, complete, and comprehensive guides available online. My aim was not just to provide steps, but to help you understand the underlying concepts, which is crucial for effective troubleshooting and truly mastering your plotter.

Finally, I want to express my gratitude to the creator of the following YouTube video. This project would not have been possible without their excellent resource, which demonstrates setting up a pen plotter from scratch and offers valuable troubleshooting insights:

  1. Setting up and programming Arduino pen plotters https://www.youtube.com/watch?v=0

I hope this instructable empowers you to continue exploring the fascinating world of CNC!