The intention of this project was to make a 2D plotter which utilized a robotic arm to draw on a sheet of paper. I wanted to do this project to implement some of the math I learned in my intro to robotics class, specifically the inverse kinematics of a 2R arm for which the derivation is partially shown below.
The inverse kinematics take the input of some given x and y position, and output what the angles of the joints need to be so that the endpoint is at the desired location. I thought that this would be perfect for a CNC plotter, as the g-Code would describe the desired position, and then using python code I could move the robot arm into place.
CADOnce I had the basic idea, and had ordered all the parts that I could not 3D print, I began to work on the CAD for the robot. I designed a base to hold the 1st stepper motor, along with a small protrusion which would show where to place the paper, as in the theoretical model the origin is at the center of the joint, but this is physically impossible.
Using the specs of the parts had ordered I sized the robot arm links at 160mm, so that they would have enough reach to cover the entire paper. I also used an assembly file in Solidworks to test the movement of the robot arm, and make sure that there would be no unexpected collision.
Then once I had all the parts completely designed I was able to 3D print them and wait for the non printed parts to arrive.
Once the parts had arrived I was able to assemble the entire robot arm, combining my 3D printed parts with the stepper motors, machined shaft, pulleys, universal hub, belt, servo and sharpie. Most of the connections were done using screws from the OEDK, which were mostly metric M2 size.
CodeThen I began working on the code in python, with the basic idea of taking in g-code, and moving the arm accordingly. I implemented the math from my robotics class to write a function which would take in the desired x and y, and output the needed angles of the servos. Then I separately wrote code using Adafruit's CircuitPython to control the stepper motors, specifically moving them a desired degree amount at some set speed. Then I combined the two programs and added a g-code interpreter, ignoring complicated G commands like circular interpolation. My g-code interpreter was simple in that it would only do linear or direct movement, and the z value controlled whether the pen was up or down.
When testing my code I was able to get correct results from my inverse kinematics, as well as have the stepper move to the correct position using my code. However when it was all put together into the robot arm, I found that the stepper motors had too high of a step size to function. The stepper motors used had 200 steps per revolution. This was accounted for in my code, however as it was not possible to move the motors by small fractions of steps, the overall resolution of the plotter was lacking. The large step size was amplified when the arm is further extended, as I was only able to move the arm in increments of 1.8 degrees. In addition, the motors lacked torque, and while they could move the arm fine without the sharpie, as soon as the pen touched the paper the friction was too much for the motors. Because of this inaccuracy, I kept the test file as a simple square to draw, while the code can technically handle any given g-code.
FixesThis project should be simple to fix by using stepper motors with a built in gearbox. This would solve both the lack of torque and high step size, and would be easy to implement, only requiring changes in the CAD to fit different sized motors, and changing the step size in the code. With a smaller step size, the resolution should greatly improve, and the higher torque should allow the motor to move while the pen touches the paper.
Comments
Please log in or sign up to comment.