After recently seeing a couple of cool pen plotter projects, and with me having wanted to build a pen plotter for a while now, I decided to finally approach this a few months back. However, buying dedicated pen plotters can get pretty expensive, but since I have access to a Prusa MK4S, I wanted to try turning it into one. A 3D printer can already precisely move its print head around in all three dimensions, so basically all it needs is a pen instead of a hot nozzle. So, that was my challenge, building an attachment to the 3D printer that can then be controlled using regular G-code.

This post is mostly about the hardware side of it. If you are interested in what I actually plotted with it, check out the generative business cards and the Bad Apple!! animation I made.

Attaching the attachment to an attachment on the printer

Before thinking about the pen holder itself, I had to figure out where to even attach something on the print head. The MK4S has a few spots on the print head that you can mount things to, but on my printer, these were already taken by an additional print fan holder, a metal part that is not installed by default. So I had to attach my attachment to this attachment.

Luckily, I found this model of only the fan holder metal part and could use it as a negative shape in Tinkercad to subtract from my own parts so they fit right onto it. This is also the reason why I will not share any STL files directly: the attachment is highly specific to my printer with this exact fan holder (and later the linear rail). However, you can feel free to remix the latest Tinkercad file linked in this post and edit it to make it fit your needs.

Close-up of the MK4S print head with the black print fan holder mounted below the extruder motor. The print head from the side, showing the angled print fan holder above the printer bed. The print fan holder from the front, a black plate with two screws attached to the side of the print head.

Iteratively designing the attachment

v0: Starting with someone else's design

I did not start from scratch. The first holder I tried was the Pen Plotter attachment for Prusa MK4 by abikloro. Since I could not attach it as intended because of the fan holder, I modeled a custom clip-on element that could be attached with a screw. This version did work for a long time and the first city business cards were plotted with it.

The first pen holder in blue with its zig zag spring, holding a fineliner above a sheet of paper with the first plotted test lines created by manually moving the print head using the dial. Close-up of the blue zig zag spring holder attached to the print head, with two screw clamps holding the pen. The first real plot in progress, cyan hatched shapes being drawn onto a sheet on the printer bed.

But I had a few problems with it: It was wiggling quite strongly, likely due to my clip attachment element, up to a few mm when the pen made turns on the paper while drawing or when it set the pen down on the paper. The sliding element was too tight for me, so I had to flex the edges to make it slide nicer, which also lead to more wiggling. I eventually replaced the included zig zag spring with a rubber band, which worked a bit better. Changing the pen was a hassle, it took me around two minutes each time, plus recalibrating the height was tedious. It eventually broke, the really thin clamps holding the pen simply broke apart. So, I decided instead of reprinting a new version, I would make my own.

v1: Too many parts [Tinkercad]

Tinkercad model of the first own design, a yellow pen holder with triangular pen seats, an orange slider, a green rail and a red mount cut out to fit the fan holder.

For my first own design, the idea was to have multiple different parts that each attach to each other, with a spring at the top to hold the pen down. The red part uses the fan holder as a negative to hold onto it, with the green one being a part of the red one in the print. The orange part then slides up and down the green one, and is also inserted into the yellow pen holder on the other side. I had to separate the orange and the yellow parts, because I would otherwise be unable to physically insert the yellow one into the green one. The spring would sit at the top of the yellow part, pressing against an identical element on the underside of the green top.

It didn't actually work that great. The printer would print all parts just a few tenths of a mm too large, so nothing fit properly into each other, even after a few attempts of leaving some clearance between parts. The negative of the fan holder was also too thick, so the whole thing jiggled around, and the spring did not work as I hoped either.

View from a balcony over the Amalfi coast, with the colorful houses of Vietri sul Mare on a hillside and the sea and beach below.

However, I liked the idea of the pen sitting in a triangle shape at the top and bottom, and it being held in place by a screw (two in later versions, as that holds better). This made changing the pen much faster and the pen drawing more stable.

I then went on vacation to the Amalfi coast (Vietri sul Mare), and after that it took me until October to pick this project back up again.

v2: Do I even need it to move? [Tinkercad]

Tinkercad model of the second design, a single yellow pen holder with a triangular pen seat at the top and a ring with a screw hole at the bottom, attached directly to the fan holder.

Looking back at v0 and v1, almost all of my problems came from the part that lets the pen slide up and down: it wiggled, it was too tight, or it did not fit at all. So during the vacation, I was thinking: do I even need that vertical movement? What if I just leave it out?

So, this version is a single part that is screwed directly onto the fan holder, with the pen clamped into it, and nothing in it can move. I also shrunk the negative of the fan holder in width so that it would not jiggle around anymore.

However, just as I suspected already, there are reasons for the vertical movement after all. The pen was scraping across the paper in some spots, and did not reach the paper in others. This is obviously because the print bed is not perfectly even. The differences are only fractions of a millimeter, but for a hard tip pen, that is already the difference between not drawing at all and being pressed hard into the paper.

So the pen has to be able to move up and down a little, with something to press it back down onto the paper, be it a spring, a rubber band or simply some weight with gravity. That way, the printer will ower the pen until the pen touches the paper everywhere, and a bit lower still, and the pen itself adjusts to the surface. That way the pressure is the same everywhere.

The blue v2 holder mounted on the print head, holding a grey fineliner above the paper. Close-up of the v2 holder, showing the triangular pen seat at the top and the two nuts attaching it to the fan holder. Close-up of the bottom ring of the v2 holder, with a long screw pressing the pen into the triangular seat.

v3: Rubber bands [Tinkercad]

Tinkercad model of the third design, a yellow pen holder with two rings and a vertical groove, sliding on an orange and green mount. The v3 Tinkercad model from another angle, showing the groove in the yellow pen holder and the pegs for the rubber band.

Returning to vertical movement then, but this time much simpler, with only three parts and without a spring. Instead, with a rubber band attached to the static part (orange) pulling the pen holder (in yellow) down onto the paper. At first, I accidentally had it inverted, so it pulled the pen up instead. The pen holder also got its second screw here.

But the problem was still the same as in the first iteration: the up and down movement was hard to get right. The print layer lines made it hard to move the parts along each other, and getting the width of the sliding part right to have smooth movement without it shaking around was hard, too. It was just too shaky. I had to re-evaluate whether I didn't want to resort to buying some proper linear rail instead.

v4: A proper linear rail [Tinkercad]

Tinkercad model of the final design, a yellow pen holder screwed onto the dark blue carriage of a light blue linear rail, with a blue cylinder representing the washer weights. The v4 Tinkercad model from the back, showing the green mount on the fan holder that the linear rail is screwed onto.

At first, I wanted to buy a wide dovetail guide, similar to what I had so far. But then I found the MGN9H 100mm linear rail, which worked great for me. I usually don't buy on Amazon, but it was significantly cheaper (and more importantly in stock in the first place) that way. The carriage of the rail I got is a bit rough to move in one spot in the middle, but since the pen really only moves a few mm at most, so this wasn't an issue so far.

Since I wanted to ensure that there were no more moving parts in MY part of the design, I used screws for literally everything: for attaching the linear rail to the fan holder, and for attaching the carriage to the pen holder. There was no space for a rubber band this time, so I used gravity to hold the pen down, with a stack of washers on a screw at the side to add some weight.

And so, v4 works really well for me, and I can change the pen really fast as well.

The final green pen holder on the MK4S, holding a pen on a metal linear rail, with a stack of washers and a wing nut next to the pen as weight. Close-up of the final holder from the front, showing the linear rail, the green pen holder and the washer weight hovering above a plotted sheet.

Failed prints

Here are (most of) the parts that did not make it:

A pile of failed 3D printed pen holder parts in blue, green and white on a wooden table.

Telling the printer to draw

The holder is only half of it, the printer also needs to be told what to do. Since a 3D printer reads G-code, a list of movement commands, I simply generate one as well, just without any heating or extruding. My pipeline produces SVG files, one per pen, and vpype with the vpype-gcode plugin turns these into G-code using a small profile I wrote for the printer. The Prusa printers use the Buddy G-Code commands.

Lifting the pen simply means moving the whole print head up. Here's the start of one of the files the business cards were plotted with (comments added by me):

M862.3 P "MK4S"              ; only run on an MK4S
G90                          ; absolute coordinates
G21                          ; millimeters
G1 Z10 F3000                 ; pen up
G0 X-0.250 Y196.893 F12000   ; travel to the start of a line
G1 Z5 F3000                  ; pen down
G1 X0.254 Y196.625 F2000     ; draw
G1 X0.254 Y198.125 F2000
G1 X-0.250 Y198.393 F2000
G1 Z10 F3000                 ; pen up again

And then this repeats a couple of thousand times. A single pen of a single business card sheet has between 2000 and 7000 lines of these, with up to around 1000 pen lifts.

In a first version of the script, the printer would home itself at the start of every single file, which works fine with a spring that can give way, but not with a pen that is clamped in place, as it would drive the pen right into the bed. It also just takes more time to re-home every time. So now, I home the printer once with no pen inserted, move the print head to 6-7mm above the bed, and clamp the pen so that it just touches the paper. Since the printer then goes down to 5mm, the pen gets pushed up the rail by 1-2mm and rests on the paper with its own weight plus the washers. The files also never turn off the motors at the end, so the position is kept from one file to the next, which means I calibrate once and then can plot as many files as I want, only having to lift the print head and swap the pen in between.

As for the speed: the very first version drew at 6000 mm/min, but after a test with different speeds, I determined that 1200-2000 mm/min worked much better, as the ink could properly flow out, and corners were drawn a lot nicer.

Ending

From the first holder in early July to the final one at the end of October, it took me a while to get there. Looking back, sometimes it's just better to buy a proper part like the linear rail instead of trying to 3D print everything yourself.

Since then, the plotter has worked reliably through over 80 business cards and 77 pages of Bad Apple!! frames, and changing the pen is quick now instead of taking minutes every time. So if you have a 3D printer and want to try pen plotting, it can definitely be worth a shot, just be prepared to adapt the holder to your own printer.

And if you have not yet, check out what I made with it: the generative business cards and the Bad Apple!! animation.

A large pile of business card backsides on a wooden table, each showing "yanwittmann.de, Software Engineer" surrounded by generated patterns in various colors. All printed Bad Apple!! frame pages laid out on the floor.