# Coordinate movement with dc motors

I am making a simple drawing machine using 2 dc motors with closed loop position control, everything work well, except that it can’t draw diagonal line because the two motors doesn’t “sync” with each other. How can I sync the movement of two motor so that they start and stop at the same time even when they travel different distances?

Alternate-axis, proportional, micro-movements (avoiding the word "step").

1 Like

That would be a quite impossible task. One motor must be the "master" with the known speed and the second motor must be speed controlled by your calculation based on the diagonal line you are trying to make.

1 Like

Please give the details of the "closed loop position control", especially the resolution.

What is keeping you from commanding motion in tiny increments, alternating between motors?

I don’t really understand your comment yet but I will try some research than

Move the motors in small steps. When x moves 1, y move 1+(mx+b).

Well for that you use stepper motors. It is literally what they are designed for. To somehow make 2 dc motors go in the same line you must have a lot of things. If you really want to you need potentiometers or encoders to measure the position of motors, then afterwards you would probably need to measure the rpm of the motors and constantly compare them and then, if you really want some level of precision, depending on the load a torque control loop and maybe even current control loop, and the line would still be straighter if you drew it by hand.

Yeah but most dc motors have a bit of inertia and weight to them so thats pretty much impossible.

It is like asking how to make two completely different lights glow exactly the same at any brightness. It is almost impossible.

so basically I can’t actually make it perfectly sync, but I can do many “micro” movements so that it can draw diagonal line that look like some old 8 bits game?

yes I have one 600 pulse per rev encoders for each motor, and I have the rpm of both motors updated each loop.

Ok so, firstly try to make something like this:

``````if (RPM1>RPM2) {
voltageM2++;
}
if (RPM1<RPM2) {
voltageM2--;
}
``````

most stepper motors can have even up to 1000 steps per rotation so, 8 bit is just a tiny understatement.

Tell us how much movement each motor gives per "micro" movement and perhaps there will be help.

Just get 2 nema 17 stepper motors it will make your life a thousand times easier.

I like when people like you say, "impossible."

1 Like

Then this is not closed loop position control, it is closed loop velocity control. You need the former to draw accurate lines.

Many high precision industrial robots use closed loop position and velocity control, rather than steppers, because much finer control is possible. It is also much more energy efficient.