This site uses cookies to deliver our services and provide a basic level of website functionality. The four different types of cookies are: Strictly Necessary cookies, Functionality cookies, Performance cookies and Advertising cookies. By checking the box and clicking the button below, you are informing Rapid Electronics Ltd that you agree to the use of these cookies as detailed in our Privacy Policy.

Industry Schools FE/HE Site: Industry Site: Schools Site: FE/HE Site: Mobile
+44 (0)1206 751166
Build Blitz Robot Technical Information

VEX IQ Build Blitz Robot Technical Information

Here is our first look at some of the more technical aspects of a VEX IQ Bankshot robot.

Chris Calver from Team C2 discusses how you can test the speed of your flywheels to see if you are getting as much speed as the calculations would lead you to believe:

VEX give a specification for the motor which when coupled with our known gear ratio allows us to calculate a theoretical maximum flywheel speed. However, if the motor is not powerful enough to drive the gearbox at that speed, the flywheels will never achieve the theoretical maximum.

There are a few ways that we can measure the actual flywheel speed.

  1. Physically count the number of revolutions over a known period of time
  2. Write a program to count the number of motor rotations over a known period of time (e.g. 1 minute)

Firstly, let's look at option 1, physically counting the rotations. Before we start, we need to have a look at the specification for the motors themselves.

On the VEX IQ website, VEX quote the “Free Speed” as 120rpm (revolutions per minute).

This means that when there is no load for the motor to turn, it should spin 120 full turns every minute. We can check how close our motors are to this specification using a really simple test.

Firstly, I fitted the two motors from our launcher to a plate so that they are side my side. I then added a small shaft and put a large 60-tooth gear on each shaft. I then marked one tooth on each gear with some white correction fluid so that it is easy to see and used a standoff as a stationary marker on the plate.

Next, I ran a really simple program that turns both motors on to 100% so they are running at full speed. Because the motors don't turn that fast, I can see every time the white tooth on the gear passed the standoff marker. It's slow enough so that I can count every time it goes past.

I need to know how many times it goes past the marker in 1 minute – this will give me how many revolutions per minute (rpm) the motor has done. However, I don't want to sit and count it for 1 minute so I will count it for 30 seconds and then multiply the answer by 2 to give me the rpm value.

Check out the video to see this in action.

In 30 seconds, I counted 59rpm which multiplied by 2 (to give a full minute) is 118 so pretty close to specification, especially if we take into account that I may have made an error of 1 or 2 whilst counting.

Stroboscopes

My gear ratio on the flywheel is 1:9 – for every 1 turn of the motor, the flywheel turns 9 times. This means if our motor runs at the theoretical maximum 120rpm, the flywheel turns at 1080rpm, or 18 times per second. This is going to be too fast to count so we need another way to measure it – a stroboscope.

A stroboscope is an instrument which is specifically designed to measure the speed of rotation of an object without having to be physically in contact with it. It works by pulsing a bright light at a known frequency. Check this video out to see exactly how this works:

I don't have a stroboscope. You may have one in your school but if not we can make one using some equipment that you probably do have. For this, we need a function generator (or frequency generator) that is capable of producing a square wave. We also need a bright white LED and a dark room. I have put one white mark on each flywheel which will be the reference markers. See mine in action in the video. It's not perfect, but it does the job!

Using ROBOTC to calculate flywheel speed

Finally, I wrote a little program in ROBOTC to calculate how fast the motors are turning. It then multiplies the motor rpm by the gear ratio to tell us how fast the flywheels are turning.

Each VEX IQ Smart Motor has a built-in encoder that can tell us how many degrees the motor has moved. This program works by accelerating the flywheels to full speed. Once the flywheels have reached full speed, it then resets the motor encoders to zero and waits for 10 seconds. At the end of the 10 seconds, the encoder values are stored in a variable and the flywheels are switched off.

We then divide the encoder value by 360 to turn the value into degrees into number of rotations. This number is then multiplied by 6 to give us a full minutes worth of rotations and therefore rpm (revolutions per minute).

Finally, we can multiply by the gear ratio to give us the flywheel speed. In this case, we multiply by 9.

You can download the ROBOTC program from here.

#pragma config(Motor, motor4, rightDrive, tmotorVexIQ, PIDContro
#pragma config(Motor, motor5, rightLauncher, tmotorVexIQ, PIDContro
#pragma config(Motor, motor6, intake, tmotorVexIQ, PIDContro
#pragma config(Motor, motor7, launcherLoad, tmotorVexIQ, PIDContro
#pragma config(Motor, motor11, leftLauncher, tmotorVexIQ, PIDContro
#pragma config(Motor, motor12, leftDrive, tmotorVexIQ, PIDContro
//*!!Code automatically generated by 'ROBOTC' configuration wizard

task main()
{
//set up some variables to store the motor and flywheel RPM
int launcherSpeed = 0;
int leftLauncherRPM = 0;
int rightLauncherRPM = 0;
int leftLauncherFlywheelRPM = 0;
int rightLauncherFlywheelRPM = 0;
int gearRatio = 9; // stores the gear ratio (i.e. 9 = 1:9)
displayCenteredTextLine(1, "Winding up...."); //display a message on line 1

//start the launchers
//this for loop accelerates the flywheel slowly over a period of
//5 seconds (i.e it loops 100 times and pauses for 50ms each time)
//It starts at zero and gradually increases the speed to 100

for(launcherSpeed = 0; launcherSpeed <=99; launcherSpeed++)
{
setMotorSpeed(leftLauncher, launcherSpeed);
setMotorSpeed(rightLauncher, launcherSpeed);
wait1Msec(50);
}
setMotorSpeed(leftLauncher, 100);
setMotorSpeed(rightLauncher, 100);

//wait 3 seconds to allow to stabilise and make sure the flywheels are
//running smoothly at full speed

wait1Msec(3000);

eraseDisplay(); //clear the display
displayCenteredTextLine(1, "Starting RPM count"); //show a message on line 1


//reset the launcher encoders to zero
resetMotorEncoder(leftLauncher);
resetMotorEncoder(rightLauncher);

//..then wait ten seconds before taking the new encoder reading
wait1Msec(10000);

//get the motor encoder values (in degrees) and divide by 360 to work out
//the total number of rotations since the encoders were reset.
//Then multiply by 6 to get number of revolutions in a minute (rpm)
//as we only recorded the values after 10 seconds of rotation

leftLauncherRPM = (getMotorEncoder(leftLauncher)/360) * 6;
rightLauncherRPM = (getMotorEncoder(rightLauncher)/360) * 6;

//caculate the flywheel speed by multiplying motor speed by gear ratio
leftLauncherFlywheelRPM = leftLauncherRPM * gearRatio;
rightLauncherFlywheelRPM = rightLauncherRPM * gearRatio;


//display the results on the screen
eraseDisplay();
displayTextLine(2, "SIDE MOTOR FLYWHEEL");
displayTextLine(3, "Left %d %d", leftLauncherRPM, leftLauncherFlywheel
displayTextLine(4, "Right %d %d", rightLauncherRPM, rightLauncherFlywhe

//..and decelerate the flywheels over a period of 5 seconds
for(launcherSpeed = 100; launcherSpeed >0; launcherSpeed--)
{
setMotorSpeed(leftLauncher, launcherSpeed);
setMotorSpeed(rightLauncher, launcherSpeed);
wait1Msec(50);
}
setMotorSpeed(leftLauncher, 0);
setMotorSpeed(rightLauncher, 0);


while(true)
{
//program gets trapped in this while loop at the end
//so we can see the results on the screen
//This will generate a warning in ROBOTC as it is an
//infinite loop with no instructions. You can ignore
//the warning and just hit X on the Brain to end the
//program.

}
}

In this article, Chris Calver looks at the battery life of the Team C2 VEX IQ Bank Shot competition robot

VEX IQ Battery

In my video on testing flywheel speeds, I talked a bit about the importance of keeping your batteries fully charged at competition. Someone from VEX later said to me that with IQ, motors would run at full speed consistently for the full battery life – so I decided to put this to the test!

One of the reasons that the battery should provide a near constant voltage throughout usage is that it is a Nickel Metal Hydride (or NiMH) battery. One of the characteristics of an NiMH battery is that they have a very low internal resistance which allows them to deliver a near-constant voltage until they are nearly completely discharged.

To put this to the test, I put a full charged battery in our robot and wrote a ROBOTC program based on the one I used in the flywheel tests. This checked average flywheel speed every 10 seconds and stored it so I could log the speed of the flywheels over a long period of time. The results were quite interesting!

The graph below shows two lines. The red one is the right motor and the blue one is the left motor. The left axis shows motor speed in rpm and the bottom axis shows the time into the test in seconds.

Flywheel Speed vs. Battery Life graph

We already know from my flywheel speed video that my left flywheel is a bit less efficient than the right one, which explains the gap between the two motor rpm lines. There are two things that are really interesting.

The first one is how flat the two lines are – this means that the flywheel motor speeds are staying really constant. They only drop off suddenly at the end after nearly 1400 seconds when the battery is about to run out.

The second interesting thing is how long the batteries last, 1400 seconds is nearly 25 minutes! That’s 25 minutes of the flywheels running constantly at full speed which is a lot longer than I would have expected. Admittedly, no balls were fed into the launcher and this would reduce the battery life due to the motors having to accelerate the flywheels again but it does go to show that there is no danger of our battery running out in a match, or even after 5 or 6 consecutive matches.

I need to know how many times it goes past the marker in 1 minute – this will give me how many revolutions per minute (rpm) the motor has done. However, I don't want to sit and count it for 1 minute so I will count it for 30 seconds and then multiply the answer by 2 to give me the rpm value.

Battery Indicator

You might like to do some tests of your own so you know how many matches you can expect to be able to compete in at maximum performance before you need to recharge your batteries. As a VEX Competition referee, the majority of robot failures I see at competitions are due to bad battery management.

Moral of the story – IQ batteries last a long time, but make sure you know how long in your particular robot so that you can always ensure you have enough power to complete the match!

Basic drive train control

Learn how to use MODKIT to program your robot chassis to respond to basic joystick commands

Programming joystick buttons

Use buttons to control motors on your robot and learn how to program some more advanced features

Simple Autonomous Movement for Programming Skills

Chris Calver shows how to use the Drive Train block to navigate around the field autonomously

Using the Colour Sensor in Greyscale Mode and Introducing the Gyro

This video looks at using the colour sensor in greyscale mode to detect the black lines on the field. Chris shows you how to print values to the screen for debugging.

Precise Turns Using a Gyro

The Gyro sensor can be used to make precise turns and avoid errors accumulating over time. Make sure you calibrate the gyro properly for maximum accuracy!