MICROPROCESSOR LAB PROJECT · NDU OPEN DOORS

CNC PCBPlotter

An end-to-end PCB fabrication system that reduced prototyping cost. It combines Gerber-to-G-code conversion via a cloud-hosted Flask microservice, real-time UART over an ESP32 Wi-Fi bridge, and low-level motion firmware on a PIC16F877A.

THE GOAL

Off-site PCB fabrication is slow to iterate on. The goal was an end-to-end pipeline that takes a design straight from a Gerber file to a physically plotted board, cutting out that round trip and reducing prototyping cost.

  • Custom real-time UART link between the PIC16F877A and an ESP32 Wi-Fi bridge
  • Cloud-hosted Flask microservice converts uploaded Gerber files to G-code
  • Bresenham motion firmware with 24-bit fixed-point arithmetic for jitter-free lines
  • Debugged with JTAG and a logic analyser to chase down timing-level bugs

12+

FIRMWARE DEFECTS RESOLVED

2

MCUs LINKED

2

AXES OF MOTION

Fully assembled CNC PCB plotter with its ESP32 Wi-Fi bridge and PIC16F877A motion controller

PHOTO — FULL MACHINE

The plotter head mid-trace, laying a line down on paper. The X/Y motion comes off the lead-screw assembly along the right edge, driven by the PIC16F877A running the Bresenham interpolation described below.

HOW IT WORKS

A cloud-hosted Flask microservice converts an uploaded Gerber file to G-code. That G-code streams over a real-time UART link through an ESP32 Wi-Fi bridge to a PIC16F877A, which runs the low-level motion firmware: Bresenham line interpolation with 24-bit fixed-point arithmetic, driving 2 axes of motion with jitter-free, sub-pixel-accurate lines.

Hand-drawn PCB sketch next to the finished plotted circuit board

SKETCH VS. OUTPUT

A hand-drawn trace layout held up next to the pipeline that turns it into motion. The sketch on the left is exactly the shape the Gerber-to-G-code conversion has to reproduce on the board.

KEY CHALLENGES

12+ firmware defects surfaced during bring-up: carry-propagation bugs in the fixed-point math, baud-rate mismatches between the ESP32 and the PIC, and servo PWM timing drift. Tracking each one down meant pairing JTAG in-circuit debugging with a logic analyser to watch the UART and PWM lines directly. Shown live at NDU Open Doors.

CNC PCB plotter demonstrated live at NDU Open Doors

OPEN DOORS DEMO

Demoing the plotter live at NDU Open Doors, with the IEEE student branch's banners behind it. The same build shown here running unattended in front of visitors.
MOTIONPIC16F877A / MPASM
NETWORKESP32 (UART BRIDGE)
BACKENDFLASK / CLOUD RUN
DEBUGJTAG + LOGIC ANALYSER