top of page

PID Controlled Drawing Arm

Spring 2022

In my Electronics & Controls II class, I made a 2-motor arm that would move a pen around a paper with PID conrol. 

Part One: Motor and encoder setup

The first step to designing the system was hooking up a DC motor with a magnetic encoder, and H-bridge, and an Arduino MKR 1010. We laser cut a motor arm out of MDF and attached it to the motor. In order to test the system, we drove the motor in MATLAB at different PWMs and plotted each step response. Using a transfer function, we determined the time constant and DC Gain for each curve, both with the arm and without. To do so, the K value (DC Gain) was estimated from points on the plot, then the TF inverse Laplace was used to compute an estimate for the y value of the time constant. Then these values were plugged into the general equation and plotted. We adjusted the constants until the curve looked like a good fit.

PID Control

We first learned how to adjust proportional and integral gains to follow a setpoint using speed control of the motor. Once we developed a script that did that well, we adjusted it to do position control of the motor. We switched to proportional and derivative control gains for that controller. We plotted both theoretically calculated gains, and then manually adjusted the gains until we got a nice looking plot with less error. 

Inverse Kinematics and (Failed) Drawing Execution

In order to have the arm draw a shape, we first needed to determine where it could physically reach. We calculated and plotted the accessible region, and picked points in a rectangle within that region. We used inverse kinematics calculations to get the two motor positions over time needed to draw a rectangle. This would act as out set point for controlling the motor positions to draw our shape. Unfortunately, our hardware setup was quite flawed.

 

The motors we were given had a lot of static friction, and the produced torque was not high enough to overcome this consistently. Additionally we could not find a maximum bending torque for the motors, but it is probable that we exceeded it. We did not exceed 1 N*m, but the cheap motors still deflected a lot under that load. To improve that in the future, we would shorten the motor arms or invest in higher quality motors.  Ultimately the system just did not work because the friction in the motors caused them to jump around erratically. Everyone in the class had this outcome and we discussed using more robust stepper motors to resolve it, but we did not have enough time to try this given the timeframe of the assignment. 

© 2023 by Sasha Blake. Proudly created with Wix.com

bottom of page