Robotic Writing Arm
Preface
As part of a 4th year computer science project, I was part of a small team that built a robotic pen plotter capable of drawing simple shapes. The device uses two servomotors to move a stylus radially across two axes to draw a shape. A third servo is used to lower and lift the stylus. The intention of this project was to take the BrachioGraph library, and implement a closed-loop control system by adding sensors to both servomotors in order to aid the device in correcting its movement and drawing more accurately. Potentiometers were added to the two main servomotors, and had to be calibrated to have a digital representation of the exact location of the stylus. Additional Python code was written to make use of this data and make slight modifications to the movement of the stylus.
A Raspberry Pi was used to run the BrachioGraph library in Python which would vectorize a given image or shape and then draw it by controlling the drawing device. An Arduino was used to monitor the potentiometers and send a 10-bit number for each potentiometer to the Raspberry Pi to notify the software of the drawing arm's position on the board.
The device immediately after assembly and first test
Rewired to be more ergonomic with varying wire lengths
The device with its arm parked 90 clockwise to calibrate the position modifier in software
The device during power testing (it must run reliably using 5V 2A max)
A bit of code
Arduino code for the closed-loop control system
Python code for offsetting the "parked" position
3D Printing
Calibrating the device
Short compilation of attempts at drawing before the device was properly calibrated
Upon power-on, the servomotors immediately attempt to center the arm, however the coordinates of the correct "park" position are unknown. This results in the servomotors erratically moving at a force that can easily damage the device. Prior to completing calibration, it was necessary to be ready to disconnect power to the servomotors at any moment.
By the fourth software revision, the device stopped rushing out of bounds and seemed to attempt to draw something. It was 180° outside of the drawing area, and the stylus-up / stylus-down functions seemed to be reversed, however this was not a difficult problem to fix.
Success
The first successful drawings were these simple squares. They are mostly to test that the device properly parks, lowers and raises the stylus correctly, and the servomotors move smoothly.