2D Plotter Robot

2D Plotter Robot

Building a robot that can draw shapes on paper using a regular pen.

You can access the source code and the documentation regarding this project on the following GitHub repository:

Table of contents:

Most of the project is already explained on the README of the project on GitHub.

🧠 Concept

I took a course at EPFL that taught students about the two sides of building things: the hardware part and the integration with software.

During this course, I learned to use a laser cutting machine and 3D printers. It was my first time doing CAD, and the process was really amazing to go from an idea, design it, and have it printed over the course of only a few hours.

I build a 2D Plotter Robot: a device that can draw user defined drawings on a small sheet of paper based on a provided computer program.

⏳ Process

Here are a few pictures demonstrating the whole process of building this robot:

I started by laser cutting all the parts for the core structure. Then I assembled the robot and soldered the cables to the external alimentation.

I initially 3D printed a static pen holder and wrote the basis of the software to test every component and make sure the plotter was drawing precise shapes. Later, I designed the dynamic pen holder that can lift the pen up and down in order to draw more complex shapes. I went through about 4 or 5 design iterations before having a convincing piece that would not be imprecise when lifting the pen.

I also added limit switches to automatically set the β€œhome”/origin position of the plotter. Additionally, I connected a buzzer to the Arduino. It gives a nice audio feedback to the person using the plotter about the current state of the procedure (started, ready to draw, finished).

Turtle language

I implemented a turtle language interpreter/REPL (Read Eval Print Loop) in C so that we can provide instructions to the plotter using this language.

Note: learn more about the turtle language here https://turtleacademy.com/playground.

One can input turtle programs directly using the Arduino Serial Monitor. No modifications have been made to the original syntax of the language. It supports multi-lines input (with indentation) and it is not spacing dependent.

Code

The code for the project was mostly written in C (a few .cpp and .ino were required to interact with the Arduino ecosystem).
To add a bit more to the challenge, I also decided not to use any external libraries (except for the Arduino.h). I wrote the code that manages the servo and the steppers from scratch (see 2d_plotter/src/hardware for more information).

🏁 Result

Here are a few pictures showing the final plotter from different angles:


Here is a short video demonstrating the result:
The quality of the video is not perfect, but we can see the plotter drawing a dotted line correctly.
Here are a few pictures of example drawings that the robot made:
I had a lot of fun building this robot and programming the software for it. It was the first time I programmed an interpreter in C, but it was simpler than I originally thought.
I ended up receiving the maximum grade for this project, so the teaching staff seemed to also agree that I managed to produce a great 2D plotter robot.