There are hundreds of DIY Arduino plotters that have been made over the past few years, but nearly all of them just take in pre-made instructions to generate an image. This device is different. With a built-in screen and camera, the Portable Portrait Painter created by Ben Lucy can take a picture and start drawing it automatically.
Users start by stepping in front of the camera and positioning themselves correctly. After pushing a button to snap a photo, the image is processed and converted into a series of lines and associated pressures. The machine draws by moving a pen along 2.5 axes, with two stepper motors for the X and Y axes, along with a servo for controlling how hard the pen is pressed against the paper.
The X axis is situated on a rail that moves horizontally and gets driven by a timing belt around a pulley and idler. Similarly, this assembly is mounted on two rails that help it glide forwards and backwards with 4 pulleys and a stepper motor.
The brush holder is mounted onto a single rotational axis that lets it lift from the page when necessary. It's spring loaded to ensure adequate force gets applied to the paper.
This project consists of 48 3D printed parts, a wooden box and plate, and a PCB with all of the electronics mounted onto it. Lucy started by laser cutting the baseplate and mounting the rails and pulleys for the Y axis. Next, he assembled the X axis by attaching the stepper motor and idler onto their respective sides. The brush holder has a servo motor that turns a cog within a rack and pinion system to raise or lower the brush.
The stepper motors are "blind", which means that they are unaware of their positions when the device is first powered on. Because of this, two limit switches were installed at the end of each axis to tell the controller where the "home" or "zero" position is. To power the whole thing, a 12V rechargeable battery is used, along with a charge/protection circuit. A pair of TMC2208 drivers are used to provide power and control to the stepper motors. The camera is connected to the Arduino MEGA Pro board with 18 wires, and the screen uses 8.
After everything was joined together, the camera and screen were fastened to the top of the baseplate.
The software is what makes this device special. It begins by attaching and setting the servo to a certain position, as well as moving the stepper motors into their home locations. Next, the camera and screen are initialized to display the battery level. After setup is complete, an infinite loop is entered where a new frame is displayed from the camera every time one is available. An image can be captured by pressing the "Camera Button" to freeze the current frame onto the screen.
When it's time to paint, the user can press the "Paint Button". This causes several things to happen sequentially:
- Each axis is zeroed
- The image is processed using histogram equalization to increase the contrast for more detail
- Brush positions are calculated by how dark a pixel is (darker = more pressure on the page)
- Each row gets "printed" using the previous step's values
After everything is done, the axes return to their normal positions and the screen and camera are restarted.