{"id":23288267,"url":"https://github.com/gruvw/2d_plotter","last_synced_at":"2025-04-06T16:29:57.256Z","repository":{"id":230951549,"uuid":"764669660","full_name":"gruvw/2d_plotter","owner":"gruvw","description":"EPFL BA6 / MIT CS-358 / 2D Plotter Robot / Personnal Project","archived":false,"fork":false,"pushed_at":"2024-04-02T09:18:33.000Z","size":82733,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T05:41:49.551Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gruvw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-28T13:58:17.000Z","updated_at":"2024-04-01T17:08:09.000Z","dependencies_parsed_at":"2024-04-01T19:38:46.259Z","dependency_job_id":null,"html_url":"https://github.com/gruvw/2d_plotter","commit_stats":null,"previous_names":["gruvw/2d_plotter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2F2d_plotter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2F2d_plotter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2F2d_plotter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gruvw%2F2d_plotter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gruvw","download_url":"https://codeload.github.com/gruvw/2d_plotter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247512090,"owners_count":20950786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-20T03:15:45.609Z","updated_at":"2025-04-06T16:29:57.222Z","avatar_url":"https://github.com/gruvw.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 2D Plotter Robot\n\nLucas Jung 324724 ([@gruvw](https://gruvw.com))\n\nEPFL BA6 / MIT CS-358 / 2D Plotter Robot / Personal Project\n\nThis **2D Plotter Robot** is a device that can draw user defined drawings on a small sheet of paper based on a provided computer program.\n\n\u003cimg src=\"docs/plotter/plotter_iso_front.png\" width=\"600\"\u003e\n\n**Note**: this README was also made available as a **PDF** for portability purposes (see `README.pdf`). However, the video won't work and the layout is not perfect on the PDF version (see `README.md` for Markdown based document).\n\n## Result\n\nHere are a few pictures showing the final plotter from different angles.\n\n\u003cdiv\u003e\n    \u003cimg src=\"docs/plotter/plotter_top.png\" height=\"200\"\u003e\n    \u003cimg src=\"docs/plotter/plotter_side.png\" height=\"200\"\u003e\n    \u003cimg src=\"docs/plotter/plotter_iso_front.png\" height=\"200\"\u003e\n    \u003cimg src=\"docs/plotter/plotter_iso_back.png\" height=\"200\"\u003e\n    \u003cimg src=\"docs/plotter/plotter_cable.png\" height=\"200\"\u003e\n    \u003cimg src=\"docs/plotter/plotter_side.png\" height=\"200\"\u003e\n\u003c/div\u003e\n\n### Drawings\n\nYou can see below some pictures of the drawings that the plotter achieved to draw.\n\n\u003cdiv\u003e\n    \u003cimg src=\"docs/drawings/inscribed.png\" width=\"170\"\u003e\n    \u003cimg src=\"docs/drawings/hilbert.png\" width=\"170\"\u003e\n    \u003cimg src=\"docs/drawings/rose.png\" width=\"170\"\u003e\n    \u003cimg src=\"docs/drawings/heart.png\" width=\"170\"\u003e\n    \u003cimg src=\"docs/drawings/magic_s.png\" width=\"170\"\u003e\n    \u003cimg src=\"docs/drawings/sun.png\" width=\"170\"\u003e\n    \u003cimg src=\"docs/drawings/holder_test.png\" width=\"170\"\u003e\n\u003c/div\u003e\n\nMost of the drawings have an impressive precision.  \nHowever, I noticed a small loss of precision when drawing with the 3D printed dynamic penholder.\nIt is due to a small amount of play that occurs with the moving piece slightly tilting the pen.\nIt is not noticeable for most of the drawings.\n\n### Video Demonstration\n\nHere is a short video (click on thumbnail to watch) demonstrating the plotter drawing a dashed line.\n\n\u003ca href=\"https://youtu.be/-nplPBwFOKw\"\u003e\n    \u003cimg src=\"https://img.youtube.com/vi/-nplPBwFOKw/maxresdefault.jpg\" alt=\"Video demo of the 2D plotter robot\" width=\"640\" height=\"360\"\u003e\n\u003c/a\u003e\n\n**Note**: Link of the video for accessibility purposes \u003chttps://youtu.be/-nplPBwFOKw\u003e.\n\n## Technical informations\n\nThe code for the project was mostly written in **C** (a few `.cpp` and `.ino` were required to interact with the [Arduino](https://www.arduino.cc/) ecosystem).  \nTo add a bit more to the challenge, I also decided not to use any external libraries (except for the `Arduino.h`).\nI wrote the code that manages the servo and the steppers from scratch (see `2d_plotter/src/hardware` for more information).\n\n### Project structure\n\nA short explanation of the project structure in this directory:\n\n- `2d_plotter/src`: contains the source code for the project.\n    - `draw/`: basic drawing functionalities.\n    - `hardware/`: abstraction layer used to interact with hardware components, exposes helpful functions to control the servo and the steppers in a safe way (automatic software limits).\n    - `main/`: entry point of the program along with the three procedures `square_inscribe_circle`, `hilbert_filling`, `turtle_REPL`.\n    - `turtle/`: the implementation of the turtle language interpreter.\n- `CAD/`: contains all the computer designs.\n    - `exports/`: the `.stl` files for the different parts.\n- `docs/`: hosts the images used in this README.\n- `turtle/`: contains examples of turtle programs that can run on the 2D plotter.\n\n### Turtle language\n\nThis project implements a turtle language interpreter/[REPL](https://en.wikipedia.org/wiki/Read–eval–print_loop) (Read Eval Print Loop).\n\n**Note**: learn more about the turtle language here \u003chttps://turtleacademy.com/playground\u003e.\n\nNo modifications have been made to the original syntax of the language.\nIt supports multi-lines input (with indentation) and it is not spacing dependent.\n\nYou can find examples of programs that ran on the plotter in the `turtle` directory (`.turtle` files).  \nThe programs should be sent to the Arduino by using the Serial Input monitor.\n\n### Additional information\n\nI added a few other things to the project:\n\n- Two limit switches are used to automatically set the \"home\"/origin position of the plotter. Before running a program, the plotter will initiate a setup procedure by moving up to the limit switch (in each direction) in order to reset to the home position without human intervention.\n- I extended the original turtle instruction set to support the following instructions:\n    - `backward \u003cdist\u003e`: goes backward for `\u003cdist\u003e` steps.\n    - `circle \u003cradius\u003e`: draws a circle from current position and heading (rotated circle around starting point) of the given `\u003cradius\u003e`.\n    - `home`: to return to the home position (always on the same exact spot thanks to the limit switches).\n    - `setheading \u003cangle\u003e`: sets the heading of the turtle to the given `\u003cangle\u003e`, useful to rotate drawings (uses a 2D rotation matrix).\n- I also added a buzzer connected 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).\n- Well structured source code with abstraction layers over the hardware and drawing functions (directory based separation of concerns).\n- Extended documentation, both in the code with comments and here on the `README.md`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgruvw%2F2d_plotter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgruvw%2F2d_plotter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgruvw%2F2d_plotter/lists"}