I’m building a drawbot with a self imposed constraint that it’s method of motion is just two rotating disks. One holding the paper and one holding the pen. However, the math to calculate the right rotations in order to move the pen along a given line (eventually an entire vector line art image) eludes me. Can someone point me in the right direction?

I’ve attached an image of the basic idea/layout of the discs since that should make things clearer than my description. :) (note that in order to allow the Center of the pen disk to be outside the paper disk’s area, the pen disk is intentionally larger in size so it can still reach the center of the paper)

proof of concept

  • $\begingroup$ Fundamentally I expect this is going to boil down to "rotate the pen to be the right distance from the center, then rotate the paper to put the desired spot under that" and then extending that somehow to make smooth rotation curves to move through all the relevant points for a line. $\endgroup$
    – VexedPanda
    Commented Jan 19, 2021 at 17:44
  • $\begingroup$ This does not answer the question you asked so I am putting it in a comment. It might be worthwhile for you to study the dozen or so “straight line 4 bar mechanism” designs. Implementing one of those would allow you to generate a straight line using only one input degree of freedom. Some of the mechanisms create exact straight lines, while others generate approximately straight lines. $\endgroup$
    – SteveO
    Commented Jan 19, 2021 at 21:45
  • $\begingroup$ Looking into this more, I’m close to having a simple polar coordinate movement system, the difference is that most systems have a linear radial axis whereas mine is also circular. I’m hoping that means I can use a lot of the code for things like create.arduino.cc/projecthub/ArduinoFT/… and just add an adjustment to the rotations to account for the “warped” axis. But if someone has more specifics, that would be great. $\endgroup$
    – VexedPanda
    Commented Jan 20, 2021 at 3:38

2 Answers 2


Made a quick diagram and a couple of calculations in matlab, let me know if it works for you.

First of all, I am assuming you are considering your piece of paper as your reference coordinate system (CS), in the sense that the coordinates $(x_2, y_2)$, are the input to your problem. Also, I will consider $\theta_1$ and $\theta_3$, as the positions of your stepper motors, both measured from a horizontal line.

The CS $X_1Y_1$ is fixed to the ground. The CS $X_2Y_2$ on the other hand, shares the same origin as $X_1Y_1$ but rotates with the paper. See Figure 1.

We will assume that you already have certain geometric parameters such as: $R$ - distance from the big disk to the pen and $D$ - distance between disk's centers.

So, let's say you want to place the pen in a position $x_2, y_2$. There will be two possible locations where you can rotate the sheet of paper, if you want to meet the pen there. These locations are at the intersections of the two circles with radii $R$ and $r$ (being $r$ the radius of the small disk). I marked them with red crosses in the Figure 2.

$r$ is obtained as follows:

$$ r = \sqrt{x^{2}_{2} + y^{2}_{2}}$$ now, knowing $x_2,y_2$ also allows us to calculate $\alpha_{3}$ as: $$\alpha_{3} = \arctan\left(\frac{y_2}{x_2}\right)$$

If we know $r$, by using $R$ and $D$, we can then find out the angles $\theta_1$ and $\theta_2$, thus:

$$\theta_1 = \arccos\left(\frac{R^2 + D^2 - r^2}{2RD}\right)$$ and $$\theta_2 = \arccos\left(\frac{r^2 + D^2 - R^2}{2rD}\right)$$

These pair $\theta_1, \theta_2$ should satisfy the condition that the points are located where both circles cross.

Now, to calculate $\theta_3$, you apply:

$$ \theta_3 = 180 - \theta_2 - \alpha_{3}$$

Being $\theta_3$ the angle you have to rotate your small disk to be able to meet the pen at the intended position (defined using coordinates $x_2,y_2$).

Now, these set of equations are basically your inverse kinematics.

Now what you need to do is to generate a vector of points in the CS $X_2Y_2$, that will represent the line (you choose the spacing between points).

This vector of points allows you to calculate a vector of $r$ and $\alpha_3$ values as well.

With $r$ and $\alpha_3$, you will now obtain the combinations of positions for $\theta_1$ and $\theta_3$ that will draw the line.

P.S.: This equations don't account for singularities, so you will have to take into consideration the checks that need to be made in order to know before hand if the point you want to reach, is in the reachable space of the robot.

enter image description here


Your line has a series of XY coordiantes relative to an arbitrary frame of reference, e.g. the center of the page you are drawing on, or even, the beginning of the line you are drawing.

The key is to take the XY coordinate and convert them to rotation angles for the tow rotation axes. You have to find two equations which link the two angles ($q_1, q_2$) to the XY coordinates:

$$x = f_1(q_1, q_2)$$ $$y = f_2(q_1, q_2)$$

or the other way around

$$q_1 = g_1(x, y)$$ $$q_2 = g_2(x, y)$$

Obviously the relative position of the centers of your circles to the chosen fixed reference plane will play a role here. You should start by choosing the frame of reference, project all distances to the X and Y axes and try to link everything together with geometrical relationships and get to the equations above.

  • $\begingroup$ I think that's a good rephrasing of my problem. I'm looking more for pointers on implementing q1 and q2, and how to utilize those over time to actually move the pen along the line smoothly. $\endgroup$
    – VexedPanda
    Commented Jan 19, 2021 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.