How to program a synchronized move for two EV3 Motors

Anton

Updated on:

This article describes how to let two LEGO MINDSTORMS EV3 motors do the exact same movement in total harmony and synchronization. Even when the motors have different friction and load they will still synchronize. When you know how to do it, it’s simple. It requires only a little math. Here’s some mathematical background after seeing my windscreen wiper motor synchronising video tutorial on YouTube. First, here’s the video:

In the video, after using the regular motor blocks, I first show some kind of block wave. It is generated by alternating the value of a variable and waiting one second in between. Because motors don’t have infinite acceleration it takes a while before the motor is at the requested position. That’s what the green line shows. Because the green line has flat horizontal bits, the movement still looks jerky.

Synchronised motor movement programming block wave

To avoid the horizontal bits in the motor curve I then move to a sine wave. The numbers it generates are visible in the picture below. Because the movement is smooth, the motor has no difficulty of following it more or less exactly. This gives us the nice windscreen wiper movement. If you build this at home, try to play with the different numbers in the advanced math block to get a feel for what they do.

In another video I explain how you can use this technique to make a lizard move it’s legs and body in coordination.

How to synchronize three LEGO MINDSTORMS motors in a lizard body

Like this article? Help us make more!

Your support matters

We appreciate your support on Patreon and YouTube! Small things count.

Become a Patron

Don't miss a thing

Subscribe below to get an email when we publish a new article.

Share this with someone who needs to know

8 thoughts on “How to program a synchronized move for two EV3 Motors”

    • Because it’s simpler. Under the hood it does nothing but set the duty cycle (voltage) of the motor. The green move blocks have magics under the hood. Intelligence that might interfere with the closed loop feedback system and lead to unclear behavior.

      Reply
  1. What if, instead of a back and forth motion I just want to sync 4 motors as they go around and around? I have built the spider_robot on rebrickable. Now I need a way to get the legs to be syncronized at least as a starting position. The other problem is that for every 1 rotation of a pair of legs the the motor needs to do 3 rotations.
    Mike,

    Reply
  2. I wanna know that if we are using the sine wave to make motors smooth but how when one motor is held and then left back syncs automatically with the other motor. Pls reply fast as we are participating in wro ²⁰²².So we need to implement this in our robot

    Reply

Leave a Reply

Item added to cart.
0 items - 0.00