You are browsing as a guest. Sign up (or log in) to start making projects!

Pen Plotter

Hardware
  • 8 Devlogs
  • 53 Total hours

A mostly 3D printed pen plotter using stepper motors, an ESP32, servos

Open comments for this post

4h 15m 32s logged

Pen Plotter - Devlog 8

I’ve been working on drawing SVGs. The trick here is to combine everything into one single path in inkscape and also approximate curves and ellipses etc to lines. I’ve also fixed a lot of strange bugs, one of which was caused by a timer overflow, which happens after 9 minutes in micropython. This caused a crash, but now it’s fixed. I also updated the acceleration routine, and now it only activates when the pen is up. I’ll start working on version 2 soon which will fix a lot of the precision issues I’ve had with this version, and also be far more capable.

0
0
4
Ship #1 Pending review

# Pen plotter - Ship 1
## Introduction
This is a pen plotter I've been making over the past few weeks. It uses NEMA 17 stepper motors, timing belts, 3d printed parts and an esp32.
I've got it to draw images of my cat, Onyx, as well as some fractals and space filling curves.

I created a simple G-code language called P-Code that runs the machine. Most of the processing is split between the pc, where it processes the images and turns them into the P-Code, and the ESP32, which draws lines from the P-Code.

I also added some other features, such as end switches for toolhead homing, which was very difficult to do before, and also an emergency stop button for when things went wrong.

## Design
At first, I created a very simple x-axis only prototype, and I thought I learnt enough from that to attempt a corexy design. Quite quickly though, I realised that corexy was a mistake. See instead of using a separate belt system for the X and Y axis, this uses 2 belt systems on both the X and Y axis. This is good because the motors are stationary, and a motor doesn't have to ride on the Y axis, but it makes things 10x more complicated. After a while I gave up and used a gantry system instead. I also used timing belts instead of the string I used on the first prototype, which wasn't nearly precise enough. I made quite a few mistakes, which resulted in me having to reprint a part. The area of the plotter is about 15000 x 16000 steps, which translates into around 190x200mm, which I'm very pleased with.

There are still a lot of problems with the design, such as:
- Some screwholes are impossible to reach
- It's a pain to tension the belt
- The pen up/down mechanism causes a lot of wiggle
- It's very hard to get the belt around the motor on the x axis
- The motor almost doesn't fit in the hole on the x axis
- It's impossible to make the rods on the Y axis parallel without building a full frame, which is slightly outside of the budget for this project, so I had to leave one corner unscrewed to allow for some play
- The double motor system is great but it makes moving the carriage manually very difficult
- The 2 motors can get out of sync meaning one side is slightly further along the Y axis from the other.
- The cable sometimes gets caught, skipping steps at best, or at worst breaking something
- There are a lot of loose connections on the breadboard, I'll get a custom pcb at some point

As you can see, I ran into a huge amount of issues. But that didn't stop me, as you can see.

## Software
I used Micropython on ESP32 for this, which was a good choice because it would have taken me 10x longer if I used ESP-IDF for it, which is the official C SDK. At first, it could only draw horizontal, vertical and diagonal lines, not lines at an angle, because both motors travelled at the same speed. Because of this I implemented Bresenham's line algorithm, and also learnt how to use the @micropython.native decorator which makes code run much faster. The 5000 steps per second speed I was aiming for wouldn't be realistic without native.

Other than the demo of the hilbert curves, there's a number of demos linked in the readme of the Github repo.

Next, I hope to implement SVG reading, so I can draw many more things, as I won't have to write custom code to draw something new.

  • 7 devlogs
  • 49h build
Video of Project → See source code →
Open comments for this post

5h 29m 11s logged

Pen Plotter - Devlog 7.

I’ve been working on drawing sierpinski triangles and hilbert curves as well as drawing images with canny edge detection.

0
0
1
Open comments for this post

10h 16m 53s logged

Pen Plotter - Devlog 6.

I’ve been working more on the gantry system, and I got my first prototype up and running.

I used steel rods, NEMA 17 stepper motors, and timing belts for this. Other than that it’s almost all 3d printed. I designed a couple of parts badly, mainly forgetting to put a hole into one of the motor parts, so that the shaft wouldn’t fit. Other than that, it worked surprisingly well.

The first few images I drew were of my cat, Onyx, and I used the system I described in a previous devlog where it converts the image into lines. I’ll also need to try canny edge detection, as that would probably work quite well, but I’ll need to work more on the plotter’s software because it can only draw horizontal, vertical, and diagonal lines at the moment. I’ll also work on converting svgs, and also text possibly

0
0
3
Open comments for this post

8h 25m 29s logged

Pen Plotter - Devlog 5

I’ve been working on a gantry system. Not sure if I mentioned it on the last devlog, but corexy is very very painful to design.

I scrapped that after a while and started work on a much more basic gantry design. As I’m writing this, the parts for that system are printing, so I’ll update this once I have a basic prototype up and running.

I’ve also been working on canny edge detection for the images, which finds the edges in an image and turns them into contours that I can draw on the machine. I used python opencv and recycled a lot of code from the previous line-based approach.

I’ll try out both using lines and contours for drawing images, and I’ll see which works better. I suspect that the lines will look much better, but I’m certain they’ll take ages to draw.

Both these methods still output my custom p-code language which will be used on the pen plotter

Next up, I’ll assemble the basic prototype and try to get it working. While I’m waiting for the parts to print, which will take about another 3 hours, I’ll look into possibly using sine waves to draw things, and changing the amplitude, and also a method using zig zag lines which have variable spacing

Oh, and I also worked on a bit of hardware, because the new system uses an extra stepper motor I had to wire up 2 motors in series which is way easier than using another driver and more precise also

0
0
2
Open comments for this post

5h 13m 8s logged

Pen plotter - devlog 4

I’ve been taking a break from cad, and instead working on converting images to toolpaths for the future plotter.
The first method I tried was using lines. For each pixel there is a block 10x10 steps wide, and if the image is very dark in that region, it’ll draw 10 lines in there, if it’s brighter it might only draw 5.

I also developed my own g-code like language called p-code, where there are only a few commands: MOVE X Y, PEN UP/DOWN, HOME, and SPEED (in steps per second). I turned the images into a series of p-code commands.

Since the pen plotter isn’t finished yet (and to be honest won’t be for a while), I made a simple interpreter and displayed the images using a matplotlib LineCollection.

In the future I’ll be exploring other methods of making images display, such as:

  • Dots of variable spacing
  • Sine waves of variable amplitude
  • Zig Zag lines of variable density (but constant height)
  • Converting SVG images into paths
  • Finding outlines in images and drawing them, possibly using something like canny edge detection
0
0
3
Open comments for this post

10h 2m 50s logged

Pen plotter - devlog 3

CoreXY system

For some strange reason, I decided to scrap the old version with the single x axis, and the string drive. Instead, I’m going for a CoreXY system with fancy timing belts. After 10 hours of wrangling with Fusion and trying to get a functional design, I’m starting to slightly regret it, and I almost wish that I just went with a generic gantry system or even a bed slinger

I posted this devlog because I’m up to the 10 hour limit, and I need to post or else my time won’t count. By chance it happens that I’m just about finished the first prototype of the CoreXY system, and just need to wait a couple days until the parts arrive. It uses timing belts and idlers, NEMA 17 stepper motors, and a single SG90 servo motor, plus a bunch of parts I’ll 3D print myself.

What next?

I’ve had so many issues with this project:

  • The CAD is a complete mess and I’ll almost certainly have to remake it using a better method
  • I still don’t know if the CoreXY will even work, I’ll need to wait and see
  • I don’t know if the screws are strong enough to hold it onto the baseplate
  • There’s probably a number of parts with clearance issues and the carriage probably won’t run properly

So next I’ll work on making the first prototype and after that, if it works I’ll take a break from CAD to work on some software for it, and get it to draw things. If it doesn’t work… I guess back to CAD.

0
0
3
Open comments for this post

8h 42m 56s logged

Devlog 2 - X axis done.

Taking lessons from the last devlog, I completely reworked the pulley system at the end. I also fixed the print settings for the spools, but had other issues.

But in the end I managed to achieve an amazing result, which draws dashed lines. It uses a servo motor to move the pen up and down and a stepper using what is sort of a capstan drive, however heavily modified.

For some reason I decided after this to completely redesign the whole thing into a corexy plotter instead, I think it was a terrible decision but let’s see how we do in 10 hours…

One problem I had is that the pen holder is very very wobbly, either I’ll just tighten the tolerances or maybe change it so that the servo is attached directly. Another is the servo mount - as you can see I had to break some of it off to mount the servo as I didn’t account for the wires.

0
0
3
Open comments for this post

25m 23s logged

Pen plotter - first devlog.
I had issues with lookout that meant that I lost about 3 hours of recorded time, but now I have very simple prototype. I did a little programming on the esp32, but this was mostly just writing a test program and setting up the environment.

There are a number of issues with the current prototype: one of the holes on the carriage is smaller than the other, the stepper didn’t fit in the holder, the thing attaching the thread to the carriage snapped the thread, the spool at the end was too loose, and the spools had terrible print quality. There are an number of other issues that I’ll just ignore for now, and fix later.

0
0
16

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…