Fab Academy 2019

Progress Documentation - Christian Schmidt

Machine Design

Building Things to build other things, part 2

Together with the Mechanical Design week, this week's task was to build a three axis machine. This week, the focus was on automating the machine that we built before, which was a sky-cam like ring with a light sensor (more details on our group page). My contribution was the realization of a control algorithm that randomly samples cartesian coordinates inside the frame, converts these coordinates to a number of steps each motor has to move, and finally moves the motors accordingly. I did this by using the geometry of our frame to figure out the required change of length of each rope. To troubleshoot the algorithm, I also implemented an interactive control system.

Making use of Geometry

Our goal is to write the lengths of the four wires holding the sensor as a function of the sensors cartesian coordinates. The frame is a cuboid with dimensions lxl_x, lyl_y, and HH, for width, length, and height.

The four rope hinges are mounted at the pole tops at the corners of the frame. The positions of these hinges are named A,B,C,A, B, C, and DD, in clockwise order. The length of the corresponding rope is named a,b,c,da, b, c, d, respectively. Putting the origin of our coordinate system in the middle of the frame at zero height gives them the coordinates

A=(l^x,l^y,H)TA = (-\hat l_x, -\hat l_y, H)^TB=(l^x,l^y,H)TB = (-\hat l_x, \hat l_y, H)^TC=(l^x,l^y,H)TC = (\hat l_x, \hat l_y, H)^TD=(l^x,l^y,H)T.D = (\hat l_x, -\hat l_y, H)^T.

Now, let's name the midpoint of our sensor ring MM, and note that the mounting holes have a displacement of RR along the coordinate x- and y-axis, compared to the midpoint MM. Then, assuming wires of zero thickness and a weight of the sensor large enough to pull the wires straight, we have

MA=a\|M - A\| = aMB=b\|M - B\| = bMC=c\|M - C\| = cMD=d\|M - D\| = d

This is exactly what we wanted: the length of wire as a function of the midpoint coordinates M=(mx,my,mz)TM = (m_x, m_y, m_z)^T. For example, the length of the wire at AA is a=(mx+l^x)2+(my+l^y)2+(Hmz)2a = \sqrt{(m_x+\hat l_x)^2 + (m_y+\hat l_y)^2 + (H-m_z)^2}.

Given the length of the wire at the starting point, we can determine the change of length for each wire, Δs\Delta s. To relate Δs\Delta s with the number of steps needed to achieve this change, we calculate

δw=Number of steps per rotation2πr,\delta w = \frac{\text{Number of steps per rotation}}{2 * \pi * r},

where rr is the radius of the winding attached to the motor. Again, we are assuming an infinitely thin wire.

Now, we can implement the control algorithm.

Controlling stepper motors

The A4988 drivers that we used make it really easy to control stepper motors; all that's needed is one pin to generate pulses to the drivers' step pin, and one pin to control the direction the motor is turning by setting the drivers dir pin to logic high or to logic low. In order to improve start and setting behavior, we used a linear acceleration and deceleration curve.


Downloads