This project documents the design process of programming a drawing robot which is able to move to coordinates set on a whiteboard, creating designs and letters.
Components of the Drawing Robot:
DC Motors with Encoders: Control the robot's movement on the x-y plane and track motor position respectively.
Servo Motor: Control the drawing markers by lowering/lifting them when needed.
Arduino Nano IoT: Central control unit for processing commands and controlling motors and contains a wifi module.
Arduino Nano Motor Carrier: Supports control of the motors.
Batteries: Provide power supply.
The MATLAB code used here defines specific x-y coordinates on the whiteboard for the robot to move to, and then transforms them to angular displacements for precise movement control. Here’s how it works:
Defining Target Coordinates
I defined the target postion by setting x and y values in meters.
2. Converting Coordinates to Angular Displacement
The code then uses trigonometry and the initial string lengths (Z_i) to compute the required angular displacement for each motor to reach the x-y target.
3. Setting Motor Movement with PID Control
After calculating the angular displacement, the PID controller adjusts motor movement. PID gains are crucial to ensure the motors accurately achieve the desired set points by fine-tuning the speed and stability of the movement.
4. Verifying Target Position Achievement
The robot assesses if it has reached the designated coordinates by comparing the encoder count (angle of rotation) with the expected value from the PID calculation.
There are 3 main servo positions we tested:
No Marker Drawing Servo Position: 0.50
Marker 1 is Drawing Servo Position: 0.30
Marker 2 is Drawing Servo Position: 0.67
In our robot, PID control helped us get the motor to reach its target position smoothly. Here’s how each gain helped:
P (Proportional) adjusts the speed based on how far the motor is from the target.
I (Integral) corrects any consistent offset from the target.
D (Derivative) helps reduce overshoot by slowing down when getting close to the target.
For our experiment, we aimed for 5 revolutions forward and backward, testing different PID values to see which gave the closest results. The first set of PID gains—P = 0.8, I = 0.0, D = 0.01—was the most accurate, hitting nearly 5 revolutions both ways. This setup gave us stable and precise control for the drawing mechanism.
To set up the coordinate system, I used the measreuments for the Base L1 and L2 of the robot's starting position. See images below to see how I used Pythagoreans theorem to find x and y. The measurements for L1, L2 and Base were done manually at first with these readings:
Base = 0.61m L1 = 0.36m L2 = 0.36m
By measuring the lengths from the motor to the pulleys and the target x-y coordinates, I was able to find the necessary string lengths that correspond to the angles the motors need to rotate, determining the physical movements on the whiteboard.
To calculate the motor torque limit for the available 12 Volt supply, I first referenced the motor specifications provided in the documentation. The torque is typically calculated using the formula:
T=VR⋅K
where T is torque, V is voltage (12 V), R is the resistance, and K is a constant specific to the motor characteristics. This gives an approximation of the maximum torque that can be achieved under no-load conditions.
The motor load and torque vary at different locations on the whiteboard due to the varying lengths of string pulled by the motors. For example, when the robot is near the edge of the whiteboard, the load on the motors increases because the effective radius from the pulley increases, leading to greater angular displacement needed. Specifically, the right motor would experience increased torque when moving towards the right side of the whiteboard due to the greater distance to cover as it must pull more string compared to the left motor.
The torque at every coordinate was determined by a series of equations:
x, y1 and y2 were broken down into their components using theta1 and theta 2. This formed 4 different equations for x1, x2, y2 and y1 with respect to their angle theta.
Since the robot is stationary at each coordinate, the law of inertia, Fnet=0, was used to write the Fnet of both tension forces:
-T1(sinθ1) + T2(sinθ2)= 0 and T1(cosθ1) + T2(cosθ2)- mg = 0
From there T1 (f1) and T2 (f2) were determined:
F1 = Weight*sin(tθ 2)./(sin(tθ 1).*cos(θ 2) + sin(theta2).*cos(θ 1))
F2 = Weight*sin(θ 1)./(sin(θ 1).*cos(θ 2) + sin(θ 2).*cos(θ 1))
To express this in term of torque, and not force, the following equations can be used:
T1 = F1/2; T2 = F2/2
From the definition of torque: Tau1 = T1*r_spool; Tau2 = T2*r_spool
The torque surface plot shows how torque varies by position, helping to set safe drawing limits. Areas where torque exceeds the limit are masked, and regions near pulleys or the bottom are restricted.
Due to gravity, the speed of the motors moving up down were faster than moving up and against gravity. The torque affects how far left and right the robot can move- respective to the maximum torque. There is a greater chance of the motor being inconsistent and failing when it passes its torque limit.