# How To Get Two Motors to Spin at Exactly the Same Speed

Hello! I am a coach of several VEX IQ teams. One of my teams has looked to YouTube for inspiration, and has determined that they MUST build a DR4B (All of the good VRC robots have it, so it must be the best idea). They have it built… But, they are struggling because the motors aren’t running at the same speed. Therefore, one side goes up faster than the other. I’m NOT a programmer, and I don’t know how to help them. Can you teach me how to ENSURE the two motors spin at exactly the same speed, in simple enough language that a fifth grader can understand it? They are trying to program using RobotC, but they are being held back because their coach doesn’t know how to do it.

1 Like

For VEX IQ specific questions: http://www.vexiqforum.com/

However, I’ll try to help. In VRC, there is no way to set motors at exactly the same speed. This usually isn’t a huge problem, because VRC usually has more motors on a single mechanism, which more or less averages the speed.

Uneven lifting is still a problem. Check to make sure that there is as little friction as possible on the slower side; that’s more likely to be the problem. If grease is legal in VIQ (I can’t remember if it is), I’d use it on that side.

You can also use the built in encoders in the motors to determine how fast the motors are actually moving, not how fast you set them, and adjust the set speed accordingly. Someone who knows IQ a little better would have to help you with that, though.

Even in VRC, the best way to ensure that twin mechanisms raise at the same rate is to link them mechanically. Run a shaft clear across the robot to tie the left and right arms together.

I would suggest that you learn the fundamentals of programming. As someone who is leading a team, you should be able to advise or assist all the team’s members. When I first started robotics in 6th grade, the only programming I “knew” was the software that came with the Lego Mindstorms NXT (graphical based language). Being my entire team’s first year of robotics, each member only did what they were comfortable with. At that time only one of our five team members knew how to program, so he did all the programming for the season. As someone who was a builder and driver, it was hard to communicate with the programmer about changes or improvements. Throughout the next season, I taught myself both Javascript, robotC and some Java, from online resources. I’ll admit that some concepts were unclear when I first learned them, but when I saw them in other programming languages it started to make sense. Just having a fundamental understanding of programming in robotC made it significantly easier to communicate suggestions to our programmer, and allowed me to make changes as I saw fit.

That being said, everyone has faced this issue in their time with robotics and there are many ways to solve this problem. When you read this article, it’s very important that you recognize why this problem exists, and methods of solving this. Don’t be overwhelmed if you don’t understand the programming right away because you can always ask your questions here.

I’m surprised that this hasn’t been suggested. We use PID for these kinds of things. You should be able to find plenty of sources by searching up PID on Google or on the forum.

I will give the caveat that I have no VEX IQ experience… But I would be more concerned that one side has more friction that the other if there is a significant difference between the two sides. Programming the other side to be slower, basically, is just putting a band-aid on the issue. If the difference is slight, make sire both sides are mechanically linked and it should even out. I would want to see it to give more specific advice.

Alright, so there’s two things you should do to mitigate this problem. However, I want you to keep in mind that the way to fix this is NOT necessarily to keep the motors moving at the same speed - the best way is to mechanically cause the right side to pull the left side up.

## 1.

To mechanically stabilize the RD4B, first use rubber bands to assist it by stretching them to points on the upper bar and on the lower bar of each stage, as I’m sure your 5th graders have seen in videos of VRC robots. Ideally these rubber bands should be able to hold the lift up on its own without any force from the motors. Second, link both sides together by putting an axle all the way through from one side’s gears to the other’s, and do copious amounts of cross-bracing, keeping in mind that triangles are going to be stronger than parallel cross-braces. Third, (and I hope you’re already doing this), remember to gear each side down. By that, I mean have the motor powering a small gear that is linked to a large gear, in order to have a more manageable speed and torque configuration.

## 2.

To actually move the motors at the same speed, use PID. PID is a reasonably simple algorithm in which you set a target for the motors to go to in terms of distance, (or velocity, but don’t do that, and the reason why is a bit too complicated for this purpose). The motors will then speed up at the start, then gradually slow down as they approach their target. A good resource for PID is a guide by George Gillard.

The example he uses is a drive, but it can easily be applied to lift motors.

I’d also like to say that your VEX IQ kids should almost certainly not be using a DR4B. Granted, I haven’t done super in-depth game analysis on Ringmaster, but I doubt that a DR4B is the best way to accomplish the task just because the VRC kids use it for a completely different game. I’m guessing you want them to do their own thing and figure it out for themselves, which is awesome, but maybe steer them away from the DR4B. It’s up to you, of course. Just pass my two cents on to them, please.

I would recommend that you solve this problem mechanically as has been mentioned by everyone else above me. But, when we were in VEX IQ, there was a function which meant that we could run multiple motors at the same speed and at the same time:
setMultipleMotors(speed, Motor port1, Motor port 2, Motor port 3, Motor port 4)

You can read more about this function in the RobotC documentation, although you will have to use natural language which unfortunately means you might have to sacrifice some more advanced functions. Hope this helps,
Atlantis

Disagree, scoring rings on the center vertical pole is a great application for DR4B, other ways to do it too.

@daddycrusader if you are using Graphical RobotC, then use the setMotorTarget() command instead of the moveMotor() command. setMotorTarget() will use the PID controller in the smart motor I believe. In this case two motors that are not physically linked should come close to being equal. They will end up in the same place. However, do all of the things mentioned above with friction, rubber band assist, etc… and if you can, physically link them.

I built a DR4B out of vex iq parts…

I would say don’t build one!

First, you could use set motor Target to make sure that both motors make it to the same place, but I just used regular arm control with one button. I used a motor on each side and a 5:1 ratio on each side. Reached well over the high pole easily. Have both arm control commands use the same button.

The problem with vex iq is that the plastic flexes and bends. You need additional space between everything because of the bending. They will bend more once you put a little weight on it, so what worked well as minute ago ceases to work once you install your claw. You only have 11x20 to work with. You have to mount the motors at the bottom because they are so heavy, and they would just be in the way otherwise.

If you want your kids to have a good time encourage them to try one later in the year. Buy some long smart cords for when that day comes.

An 8 bar will easily reach the top of the tall pole as well, and will be much easier to build!

Good luck!

My daughter built a RD4B for VEX IQ this summer. Here’s the link to the video. If yo watch it, please leave her a comment or suggestion. Thanks!

This is their 2nd year of IQ, so they are not very experienced yet, but that robot had many, many problems, so they decided to scrap it. Gears kept popping off, and as she strengthened it, the arm grew heavy and even doubled and tripled gears began stripping. The joints were popping apart frequently. It was very bouncy and hard to control. There were probably solutions to all these problems, but she decided there was not enough reward for the effort. Maybe she will try it again later.