2024
Building a Self-Drawing Etch A Sketch
A Raspberry Pi robot that turns the knobs of an Etch A Sketch for me. It converts any picture into a single continuous line and draws it in about two minutes.
- Hardware
- Raspberry Pi, 2 stepper motors
- Resolution
- ~300 × 214 pixels
- Algorithm
- DFS + pathfinding
- Drawing time
- ~2 minutes
Drawing in real time, shown at 2× speed.
The idea
I saw incredible Etch A Sketch art online. I don’t have the skills to draw like that by hand, but I do have the skills to build a robot that can. The plan was simple: a Raspberry Pi driving two stepper motors, one on each knob.
Version 1 didn’t work
The knobs pop off to reveal small shafts, so I 3D printed adapters to connect them to the motors, plus a base plate to stop the motors from spinning in place. I measured the plate wrong, so I snapped it in half and hot-glued it on. The bigger problem was the motors themselves: they were too weak and too slow, and they slipped instead of turning the knobs.
Version 2
I bought larger stepper motors and redesigned everything around them. The new base plate holds the motors with screws, so it’s much stronger. The new adapters fit over the original knobs, so I don’t have to pull them off every time I use the machine. It took seven failed prints before the adapters fit perfectly.
Turning a picture into one line
The hard part is that an Etch A Sketch can never lift its pen. Every move leaves a mark, so the whole picture has to become one unbroken path.
- Fit the screen. The drawing area is about 153 × 107 mm and a line is about 0.5 mm wide, so the Etch A Sketch has a resolution of roughly 300 × 214 pixels. I resize the image to that and convert it to pure black and white.
- Clean up. I remove any cluster of fewer than 8 pixels.
- Connect the islands. A pathfinding algorithm links all the separate clusters while crossing as few white pixels as possible.
- Trace one path. A depth-first search walks along the black pixels, and pathfinding backtracks every time it hits a dead end.
- Convert to motor steps. A stepper motor takes 200 steps per rotation. The left knob needs about 4¼ turns to cross the screen and the right knob about 3 turns top to bottom, which works out to 850 steps across and 600 steps down. Each pixel coordinate becomes a step coordinate, and the instructions go to the Raspberry Pi as a text file.
Each color is a separate cluster of pixels. The black lines are the connecting paths the algorithm adds so the whole dog can be drawn in one stroke, starting from the top-left corner.
The result
It draws in real time and finishes a picture in about two minutes. The motors get hot, loud, and shake a lot, but it works, and watching it draw is very satisfying. To celebrate 1,000 subscribers, I had it draw my own play button and hung it on my wall.