# Drawing Machine 2016

For our midterm project in UC Berkeley’s Introduction to Prototyping & Fabrication course, my partner and I built a 2D plotter with a polar coordinate system.

This was my first real lasercutting project, as well as my first time working with C-style strings for g-code parsing. I learned a lot!

### Mechanical Design

We constructed our plotter out of 1/4” plywood, and used standard NEMA17 steppers for both linear and angular movement. An SMT-1325S magnetic solenoid is attached to the pen holder for the lifting motion.

### Software

To run the plotter, we developed a custom g-code interpreter that accepts standard CNC commands read from either our microcontroller’s flash memory or a USB serial connection. The latter allows toolpaths to be easily generated using off-the-shelf CAM applications and sent to the machine via a web-based dashboard application.

Motions were computed using a standard polar coordinate system:

\begin{align*} r &= \text{leadscrew linear position} \\ \theta &= \text{turntable angular position} \\ x &= \text{pen x} \\ y &= \text{pen y} \\\\ x &= r \cos \theta \\ y &= r \sin \theta \\\\ \frac{dx}{dt} &= \frac{dr}{dt} \cos \theta - r\frac{d\theta}{dt}sin \theta\\ \frac{dy}{dt} &= \frac{dr}{dt} \sin \theta + r\frac{d\theta}{dt}cos \theta\\\\ \begin{bmatrix}\frac{dx}{dt} \\ \frac{dy}{dt}\end{bmatrix} &= \begin{bmatrix}\cos \theta & -r \sin \theta \\ \sin \theta & r \cos \theta\end{bmatrix}\begin{bmatrix}\frac{dr}{dt} \\ \frac{d\theta}{dt}\end{bmatrix} \\\\ \begin{bmatrix}\frac{dr}{dt} \\ \frac{dy}{dt}\end{bmatrix} &= \begin{bmatrix}\cos \theta & -r \sin \theta \\ \sin \theta & r \cos \theta\end{bmatrix}^{-1}\begin{bmatrix}\frac{dx}{dt} \\ \frac{dy}{dt}\end{bmatrix} \\ &= \begin{bmatrix}\cos \theta & \sin \theta \\ -\frac{1}{r} \sin \theta & \frac{1}{r} \cos \theta\end{bmatrix}\begin{bmatrix}\frac{dx}{dt} \\ \frac{dy}{dt}\end{bmatrix} \\\\ \end{align*}

### Electronics

All of the electronics work was done on perfboard, and included:

• an Arduino Nano microcontroller
• two DRV8825 stepper drivers (one for x, one for theta)
• an IRLB8721 logic-level N-fet (for actuating the solenoid that lifts the pen up and down)
• connectors broken out for external switches & LEDs