In May I moved into a new office with the great guys of The Future of Everything. The office has really nice big windows and we thought about what we could do with them. I remembered hektor, this super cool 2D drawing machine. What if that thing could draw directly onto the window?
So, here is Der Kritzler (kritzeln is german for scribble).
Here is a list of parts needed:
- Motor mount and pen holder, laser cut MDF, 5mm Formulor (german partner of Ponoko)
- 2 stepper motors, NEMA 17. e.g. Reichelt
- 2 suction cups with mount, esska
- Various M5 and M4 bolts, screws and washers, 2 ball bearings Screws and More
- 2 toothed belt pulleys, Mädler
- 6 m toothed belt, Mädler
- Arduino or breadboard compatible Arduino clone
- 2 stepper drivers, A4983, Pololu
- Standard servo (missing on the photo)
- Power supply, 3-12V, 2250 mA, conrad.de
Most sources are german, but I assume that all parts are pretty common. The toothed belt was extremely expensive, almost 20 Euro per meter and I ordered 6. There has to be a cheaper source, especially because I don’t need the best material available.
The SVG to cut the motor mount and the pen holder was my first attempt to have something laser cut. To be honest, it was my second, the first one was a complete fail. This one worked. I designed it in Inkscape because I haven’t decided yet which 2D CAD tool to use. Inkscape can be really annoying but you can get it done. The design is not optimized so it makes a lot more cuts than actually needed, which makes it more expensive.
The motor is mounted with its axis towards the motor holder. That way the belt is kept as close as possible to the window. I had to use the black tubes as spacing washer, because the thread on the bolt doesn’t go up all the way. I should look closer next time at what bolts I order.
Assembling the pen holder is quite easy. I just used some wood glue to glue all parts together.
I am using the drivers with quarter stepping, which means 800 steps per revolution of the motor. The pulley has a circumference of 62.8 mm, that gives a resolution of ~0.08 mm per step which is far enough for such a device.
The driver board is connected as follows:
- 2B – black
- 2A – brown
- 1A – blue
- 1B – red
- MS1 – GND (via 100k resistor)
- MS2 – VCC
- MS3 – unconnected (means low, has internal pull down resistor)
- RESET and SLEEP are connected
The connections from the Arduino are:
- pin 6 – Debug LED
- pin 8 – Servo signal
- pin 9 – Driver 1, DIR
- pin 10 – Driver 1, STEP
- pin 11- Driver 2, DIR
- pin 12 – Driver 2, STEP
The firmware boots up and expects the motor mounts to be 1500 mm placed apart from each other. The pen holder is placed in the middle with 1060 mm on the timing belt to each side. That position has to be the same every time the machine is powered on because it has no feedback where the pen holder really is.
The Kritzler is then ready to receive commands from the host machine. Possible commands are:
- m dx dy (move relative)
- l dx dy (line relative)
- M x y (move absolute)
- L x y (line absolute)
For every new command it is computed how much steps had to be executed to move the pen to the new position. That involves a bit of geometry because we have to transform the position in x,y into a position that depends on the length of the two belts. If the command is a move command, the servo is used to keep the pen away from the window.
For debugging it is also possible to connect to the Kritzler via a simple terminal. Then you can examine the plotting area, for example, by simply typing M 1000 1000 into the terminal and see where the pen goes to.
I used Processing for implementing the host software. Processing was the first choice because it is primarily targeted for graphics programming and plays well with Arduino. Any other software that could talk to the serial port would work here as well.
The host software falls into two parts. The first part is for reading an SVG file and sending it to the machine. It starts with loading the first SVG file from a directory if there is one. Then you could still scale, mirror and move the shape on your canvas. If everything fits, the drawing is sent to the Kritzler, one instruction after another.
The other part is used to transform bitmaps into more or less pretty SVG files. I have two snippets at the moments. One converts a bitmap into a SVG by using some sort of halftone algorithm. It produces a horizontal line with more or less jitter, dependent on how dark the current pixel is. The second uses ImageMagick and Potrace to convert a bitmap into an b/w SVG file. That black outline is then filled with diagonal lines by another small Processing sketch.
All tools read and write files from special directories. That means tools can be somewhat chained together. One reads files, preprocesses it and stores them in a new directory. Another tool then reads that file and sends them to the Kritzler. To process the SVG files, I first used the built-in functionality of Processing. After some poking around I switched to Geomerative which is a really capable SVG library for Processing.
This is the very first drawing done by the machine. I used a whiteboard foil on the window which worked pretty well. The pen is a permanent marker. I tried many different pens until now. Whiteboard markers are great for drawing on the window. They could be wiped off easily but are not very intense. My favorites for drawing directly on the window are pens with liquid chalk. Although all I tried have some kind of valve to fill the head. That means you have to monitor the drawing process and when the chalk gets thin, stop the drawing to refill the head. There must be an easier way. Maybe making my own liquid chalk?
This is my first project that uses ropes, gears and motors. The hardware could be build prettier and cheaper. Maybe I’ll build another more optimized one. We’ll see. Nevertheless I am quite pleased with the outcome. Always great to see people passing the window and then get attracted by the Kritzler, while he paints on the window.
This project is based on great software and inspired by some super cool 2D plotting devices.
Links and Downloads
- Hektor, first in the list!
- Sprites Mods Online Whiteboard
- Vertical Plotter, Arduino Forum
- Geomerative, SVG lib for Processing
- ImageMagick, THE image processing tool for the command line
- Potrace for converting bitmaps to vector graphics
- More hi-res pictures at Flickr
- Sources, Arduino and Processing at Github