Close
0%
0%

Pen Plotter ESP32

3d Printed Pen Plotter with ESP32 and WiFi interface for under $20.

Public Chat
Similar projects worth following
This is a simple 3d printed pen plotter that broadcasts a wifi network with web server that fully houses the whole interface. So anyone with wifi and web browser can use the device.

The plotter runs custom firmware on an ESP32 and serves up a simple MS Paint-style web interface. A lightweight custom firmware directly controls three 28BYJ-48 stepper motors through ULN2003 drivers. The entire web interface is embedded in the ESP32's flash memory - no SPIFFS, no external files.

The firmware includes a simple G-code parser that handles the basics. Touch-friendly controls let you test motors, home axes, and manually raise/lower the pen.

The total cost is under $20 with 3d printed chassis. Perfect if you want a simple WiFi plotter without the complexity of full CNC firmware.

**Work in progress, I will be making updates**

A wireless pen plotter with simple, purpose-built code. Control it from any device with a web browser - draw on almost any device, hit send, and watch your creation plot in real-time.

It has custom firmware that does exactly what a WiFi pen plotter needs - nothing more, nothing less. The entire system is about 500 lines of C++ code that:

  • Directly controls stepper motors: Uses half-step sequences to drive three 28BYJ-48 motors through ULN2003 drivers. No external motion control libraries needed.
  • Serves a web interface: The entire HTML/CSS/JavaScript UI is embedded in the ESP32's flash memory using PROGMEM. No SPIFFS, no external files, no filesystem overhead.
  • Parses basic G-code: Implements just the commands needed for plotting. The parser is simple, readable, and debuggable.
  • Runs a WiFi access point: Powers on, creates "PlotterBot" network, serves interface at 192.168.4.1. That's it.

Hardware Setup

The electronics are intentionally simple:

  • ESP32 DevKit (any 38-pin variant)
  • 3× 28BYJ-48 stepper motors
  • 3× ULN2003 driver boards
  • 3D printed frame

Total electronics cost: under $15 if you shop around.

Software Architecture

Motor Control (motor_control.h): Direct GPIO manipulation using half-step sequences. Simple variables track current position in mm, and a basic moveTo(x, y, z) function handles motion planning with pen up/down logic and simultaneous X/Y movement. No fancy acceleration curves needed for a pen plotter running at reasonable speeds.

G-code Parser (gcode_parser.h): A straightforward string parser that handles G0/G1 moves, G28 homing, M3/M5 pen control, and M114 position reporting. It's intentionally minimal - unsupported commands are simply ignored.

Web Interface (web_interface.h): An MS Paint-style drawing canvas built with vanilla JavaScript and HTML5 Canvas API. Touch/mouse drawing with four tools (freehand, line, rectangle, circle), real-time preview, and client-side G-code conversion. The entire interface is stored as a string literal in PROGMEM - no filesystem required. The ESP32 serves it via a simple web server on port 80.

WiFi Setup (main.cpp): Configures the ESP32 as an access point with a captive portal that guides users directly to the interface when they power on.

The User Experience

  1. Power on the plotter
  2. Connect phone/tablet to "PlotterBot" WiFi (password: plot2025)
  3. Browser automatically opens interface, or navigate to 192.168.4.1 or plotter.local
  4. Draw something with your finger
  5. Tap "Send to Plotter"
  6. Watch it plot

No apps to install, no drivers, no configuration. Works on iOS, Android, laptops - anything with WiFi and a browser.

Technical Challenges Solved

Motor Synchronization: The cheap 28BYJ-48 motors have significant mechanical variance with 3D printed parts. A simple simultaneous stepping algorithm keeps X and Y axes synchronized by stepping them in the same loop iteration.

Calibration: The firmware includes easily-adjustable calibration constants like STEPS_PER_MM_X/Y/Z and X_INVERT/Y_INVERT to match your specific mechanics without rewiring. These are set to a safe limit for the 3d printed frame we are suing, but can be fine tuned or scaled as desired.

Touch Interface: Careful handling of both mouse and touch events with proper coordinate translation accounting for canvas scaling. The interface tracks drawing state and converts gestures to shapes in real-time.

Memory Constraints: The entire web interface had to fit in ESP32 flash. Minimal HTML/CSS/JS and no large libraries kept the embedded interface to ~15KB.

Why This Matters

This project helps demonstrate you don't need complex CNC firmware for every motion control application. Sometimes a simple, purpose-built solution is better than a general-purpose tool.

The code is intentionally readable and well-commented. If you want to understand how stepper motor control works, how to parse G-code, or how to build a web interface on an ESP32 - this is a great learning resource.

Plus, it actually works...

Read more »

pen-plotter-esp32-1.0.zip

Firmware

Zip Archive - 44.03 kB - 12/08/2025 at 03:56

Download

pen-plotter-esp32-3dparts.zip

3d Printed Parts

Zip Archive - 14.35 MB - 12/08/2025 at 03:53

Download

View all 7 components

  • 3d Parts Assembly

    JohnsonFarms.us12/04/2025 at 03:19 0 comments

    Courtesy of Maker101 on YouTube. Here is a simple breakdown of 3d part assembly.

    The main 3d parts for the pen plotter are the same as this project, as well as the motors and motor controllers. This makes for a nice assembly guide, but the glued part can also be screwed into place as well.

  • Video Demo

    JohnsonFarms.us12/04/2025 at 02:21 0 comments

    Here is a gif of the pen plotter in action. It is not very quick, but is working well.

  • Parts

    JohnsonFarms.us11/29/2025 at 06:14 0 comments

    The electronic parts for this project are fairly inexpensive. We sourced parts from amazon but they are widely available elsewhere. 

    The stepper motors and drivers were purchased in a six pack combo with the motors and drivers. The project only needs 3 motor/drivers but having the extras is not a bad idea. The cheap drivers are meant to have reverse polarity protection, but in my experience it does not work, oops.

    The ESP32 linked above is a 5 pack, you obviously only need one but if you are looking for a good deal the multi-packs are best.

    You can use a number of different dev boards, but the 3d printed holder for the PCBs and the writeup for wiring is setup for the linked board. So long as there are three 5v connections available on the board, or you are willing to splice the 5v power form the three driver boards together, than you can use anything compatible with the ESP32.

    For the M3 Screws you only need 12 M3x4mm, and 2 M3x12. We purchased a large kit so we could have options and use them with other projects. Plus you have alternate sizes if needed. The larger pen holder does need an M4 screw but you only need that if you want to use larger markers.

    For the Dupont Wires you will need 18 female to female wires. We found the 20 cm length to fit nicely.

View all 3 project logs

  • 1
    3d Printing

    The 3d printed parts are all easy prints. Nothing too complicated and a fairly quick print as well. The test prints were done in PETG and PLA including intermixing components of both materials within a build and there were no issues. Print files are available at Printables.

    You need one of everything, and multiples of the following:

    • 2 x gear.stl
    • 3 x x_frame_spacer.stl
    • 9 x electronics_mount_spacer.stl

    The only parts that need support are the x_frame.stl and y_frame.stl along the interior of the rail where the x_movement.stl and y_movement.stl slide within the frames.  Snug supports were easiest to remove by running a small flathead screwdriver down the rail. See the image below for an example of supports.

    The parts can be printed on a printer as small as the Prusa Mini, but it does require some alternate orientation for the x_frame.stl to fit (everything else fits no problem). It needs turned onto onto an edge and rotated diagonal on the plate to fit. This is not ideal, but possible if it is your only option. See image below for an example of orientation for smaller build plates.

  • 2
    Hardware Assembly

    Frame Assembly

    Courtesy of Maker101 on YouTube. Here is a simple breakdown of frame assembly.

    The main 3d parts for the pen plotter frame are the same as this project. This makes for a nice assembly guide, but the glued part can also be screwed into place as well.

    Since this was adapted from an existing project, the x_frame_spacers will need to be added to level out the frame. You can get away with two and just glue them directly under the screw holes for the x_frame piece. A third spacer can be added centered between the two directly under the x_frame if desired.

    Electronics Mount

    For the electronics, use the electronics_mount and the electronics_mount_spacers with M3 screws. See the photo below for an example. Just place the spacers between the boards and the mount.

    Mounting Tip

    You do not have to screw the frame to a board, though that may be convenient depending on your use. We just used a couple removable command strips to stick it to a surface (you can see this in one of the above photos), in our case a silicone work mat. The mat has the added benefit of a bit of texture and squish which has helped hold the papers in place and allow for a bit of give for stiffer writing implements like ball point pens.

  • 3
    Wiring

    The wiring is pretty straight forward. However, caution is needed when connecting the power. The motor controllers are supposed to have reverse polarity protection, but experience has shown that to be false. So keep track of your negative and positive wires carefully. 

    The motor wires just plug directly into the motor control boards, the plugs only fit one way so you can't mess this up. When you wire from the motor control board to the dev board you want to use the yellow column of pins. Just for reference the red column is positive voltage and the black is negative. So if you connect these signal wires to the red or black column it can fry your board.

    X-Axis

    GPIO 13 --> IN1
    GPIO 14 --> IN2
    GPIO 27 --> IN3
    GPIO 26 --> IN4

    Y-Axis

    GPIO 16 --> IN1
    GPIO 17 --> IN2
    GPIO 5 --> IN3
    GPIO 18 --> IN4

    Z-Axis

    GPIO 19 --> IN1
    GPIO 21 --> IN2
    GPIO 22 --> IN3
    GPIO 23 --> IN4

    For the power we use the power plugs on the dev board for the X and Y and the 5v pinout for the Z, see image below. Be cautious here, the plugs are right near each other, but the plugs for the Z power are switched left right from the X and Y right next to it.

    The positive and negative are clearly marked in the corner of the mortar control board.

View all 6 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates