Drawing Machine
For my Final Project, I attempted to construct a drawing machine that
would trace the edge outlines of a photograph taken by the webcam
using Canny Edge Detection.
Desired Sequence of Events:
Here's what was the desired sequence/routine of events:
1. The machine would wait until a person pressed a push-button connected to the Raspberry Pi.
2. Once the push-button has been pressed, the machine would take a photograph using the webcam connected to the Raspberry Pi. The photograph would have a size of 480 pixels x 640 pixels (default image size for OpenCV).
3. Next, the photograph would be converted to gray color scales and undergo Canny Edge Detection.
4. The machine would draw on the paper in the positions corresponding to the locations of all the white pixels from the result of the Canny Edge Detection. The transition between adjacent pixels would be a set distance. To ensure movement of set distances, a pair of incremental quadrature rotary encoders (one for X direction and one for Y direction) moving along with the servos would provide feedback in the form of counts (rising edges). The machine would continue drawing on the paper until it has covered all of the white pixels from the result of the Canny Edge Detection. The resulting drawing on the paper should fit within a 4 inches x 6 inches area, the same size of a standard photograph taken by most cameras.
Problems:
Unfortunately, the machine was unable to be completed. The number of counts from the encoders needed to move set distances is slightly inconsistent. The axles connected between the servos and the encoders had trouble consistently turning, because the servos and encoders had trouble being kept in place and the encoders' knobs were fairly difficult to turn.
I did put a Python file (called draw_machine_emulation.py) on Github that "emulates" what the drawing machine would do if it had worked (the program shows a separate image screen that is constantly being "drawed" on as it searches for the white pixels from the Canny Edge Detection, showing the complete "drawing" when all the white pixels have been "drawn").
Photos (most recent status):
System Diagram:
Electrical Diagram:
Software Diagram:
Look in Final Project repository on Github
(file is called FinalProjectAI.vsdx)
Mechanical Diagram:
Look in Final Project repository on Github
(file is called FinalProjectMechanicalDesign.pptx)
The primary components are the OpenCM9.04 microcontroller, Raspberry Pi 2 single-board computer, 3 XL-320 actuators/servos, 2 incremental quadrature rotary encoders, and push-button. The physical structure is built with Kinex parts and 3D-printed parts. All the wheels are connected with twine.
GitHub account:
Youtube account: