Using the Inertial Sensor with VEX V5

Description

The Inertial Sensor is a combination of a 3-axis (X, Y, and Z) accelerometer and a 3-axis gyroscope. The accelerometer will detect a change in motion (acceleration) in any direction and the gyroscope electronically maintains a reference position so it can measure a rotational change of position in any direction against this reference.

The combination of these two devices in one sensor allows for effective and accurate navigation, as well as, controlling any change in the motion of a robot. A detection of a change in motion can help decrease the chance of a robot falling over when it is driving or while it is climbing over an obstacle.

The housing of this sensor has a single mounting hole which allows it to be easily mounted to the robot’s structure. In addition, there is a small indentation in front of the mounting hole which marks the sensor’s reference point. On the bottom of the housing, there is a round boss which is sized to be inserted into a square hole of a piece of structural metal. This will keep the sensor fixed to its attachment point. On the back of the sensor housing is a V5 Smart Port.

Sensor's reference point Round boss on the bottom of the housing

Diagram illustrating V5 sensors, including various types and their functions, as part of the V5 Category Description in the VEX Knowledge Base.

Diagram illustrating V5 sensors, including their types and functionalities, as part of the V5 Category Description.

There is a diagram on the housing next to the mounting hole which indicates the orientation of the axis for the Inertial Sensor.

In order for the Inertial sensor to be functional with the V5 Brain, the sensor’s V5 Smart Port and a V5 Brain’s Smart Port need to be connected with a V5 Smart Cable. The Inertial Sensor will work with any of the 21 Smart Ports on the Brain. When connecting a V5 Smart Cable to the ports, be sure the cable’s connector is fully inserted into the port and the connector’s locking tab is fully engaged.

V5 Interial Sensor Inertial Sensor Smart Port V5 Brain Smart Port

Diagram illustrating various V5 sensors, including their types and functionalities, as part of the V5 Category Description section.

Diagram illustrating V5 sensors, including various types and their applications, as part of the V5 Category Description for robotics.

Diagram illustrating various V5 sensors, showcasing their features and functionalities, as part of the V5 Category Description in the context of robotics.

How the Inertial Sensor Works

Both the accelerometer portion and the gyroscope portion of this sensor produce a smart signal feedback to the V5 Brain.

Accelerometer: The accelerometer measures how fast the sensor changes its motion (accelerates) along the X-axis, the Y-axis, and/or the Z-axis. These axis are determined by the orientation of the Inertial sensor. For example, one orientation could have a robot’s X-axis as its forward and backward motion, its Y-axis as its side to side motion, and its Z-axis as its up and down motion (such as the robot lifting itself up off the field on a suspension pole).

The accelerometer measures a change in motion when its internal electronics detect a change in inertia and this creates a change in its reading. The faster the change in motion the more the reading changes. Note: This may be a larger positive value or a larger negative value depending on the direction of the motion along the axis.

Acceleration is measured in g’s (unit of gravitational acceleration). The maximum measurement limit for the accelerometer portion of the Inertial Sensor is up to 4g. This is more than enough to measure and control most robot behaviors.

Gyroscope: The gyroscope, rather than measuring linear motion along the 3 axis, measures the rotational motion around the 3 axis. The sensor measures this rotation when the internal electronics create a fixed reference point. As the sensor rotates away from this reference point it changes the output signal.

It takes a short period of time for a gyroscope to establish its reference point (calibration). This is commonly called the initialization or startup time. (Note: It is recommended using 2 seconds for a calibration time or start the sensor’s calibration within the pre-auton portion of the competition template. When using the sensor within the VEXcode V5/VEXcode Pro V5 drivetrain functions, the calibration is included within the function.)

An electronic gyroscope also has a maximum rate of rotation. That is, if the object the sensor is measuring is spinning faster than the gyroscope can measure its rotation, the sensor will return incorrect readings. The maximum rotation rate for the Inertial Sensor is up to 1000 degrees/second. Once again, this is more than enough to measure and control all but extreme robot behaviors.

Axis labeled on Inertial Sensor 3 Axis 3 Rotational Axis

Diagram of V5 sensors, illustrating various sensor types and their connections, used in robotics for enhanced functionality and performance.

Diagram showing various V5 sensors with labels indicating their types and functionalities, illustrating their placement and usage in robotics applications.

Diagram illustrating V5 sensors, showcasing various types and their functionalities, including color sensor, distance sensor, and inertial sensor, as part of the V5 Category Description.

The Inertial Sensor needs to be paired with a programming language such as the VEXcode V5 or VEXcode Pro V5 to create a user program for the V5 Brain to utilize the sensor’s readings to control the robot’s behavior.

The V5 Brain in concert with a user program can be used to convert the Inertial Sensor readings into many measurements including: a heading, an amount of rotation, a rate of rotation, an orientation, and an amount of acceleration.

Placement of the Inertial Sensor

The placement of the Inertial Sensor is very important to its accurate readings. As previously mentioned, it is essential to align the Inertial Sensor along the axis the robot will be experiencing a change in motion. This alignment determines how the sensor produces measurements in reference to the spatial orientation of the robot. These measurements allow the user program to change the robot’s behavior.

There might be an isolated case where an Inertial Sensor will be placed on a robot’s external component, but for most applications, the sensor will be placed on the drivetrain’s chassis.

The Inertial Sensor always adjusts its orientation when it calibrates so the rotational measurement is the same. This allows the sensor to be placed in any of the 6 possible mounting positions.

Six possible mounting positions for the Inertial Sensor

Diagram illustrating V5 sensors, including various types and their connections, used in robotics for enhanced functionality and performance. The image provides a visual reference for understanding sensor integration in V5 systems.


Reading Inertial Sensor Values: It is helpful to use the Device Info screen on the V5 Brain to see the values the Inertial Sensor is returning. This can be done with the sensor connected to the Brain by:

Diagram illustrating various V5 sensors, including their types and features, as part of the V5 Category Description in the V5 Sensors section.

Remove the V5 Brain Magnetic Screen Protector, turn on the Brain, and touch the Devices Icon.

Diagram illustrating various V5 sensors, including their types and functions, as part of the V5 Category Description in the V5 Sensors section.

Touch the Inertial Sensor icon on the Device Info screen.

Diagram of V5 sensors, illustrating various types and their functions, including distance, color, and gyroscopic sensors, used in robotics applications.

Touch the Calibrate frame on the Inertial screen.

Move the Inertial Sensor forward and backward, side to side, up and down, and rotate it in different directions. This should change the values on the screen and rotate the 3-D cube.

Common Uses of the Inertial Sensor:

The Inertial Sensor can produce several measurements which can be used to change the behavior of the robot. Some of these include:

Heading: When the Inertial sensor is used to move the robot to a heading, it will move to a fixed heading in reference to a point which is established when the sensor was calibrated. In other words, if the robot is set to a heading of 90o from its starting position, it does not matter whether the robot has a current heading of 45o or a heading of 120o, it will turn to reach a heading of 90o.

Amount of rotation: Unlike the heading value, the amount of rotation has the robot rotating a certain amount from its current orientation. In this case, if the robot turns 90o and then turns 90o again, it will be at 180o to its starting position.

Rate of rotation: The rate of rotation is how fast the robot spins. Whether the robot is turning to a heading or rotating for an amount, the speed at which the drive wheels are turning will determine how fast the robot turns. Some of the units used to measure this are degrees per second (dps) and revolutions per minute (rpm).

Acceleration: As mentioned previously the Inertial Sensor can measure acceleration, how fast the robot changes its motion along an axis. Interestingly, while the robot is stationary, its side to side and its front and back acceleration will be 0g, but the robot’s up and down acceleration will read 1g because the Earth’s gravity is exerting 1g of force on the robot.

Pendulum: An interesting classroom activity is to mount an Inertial Sensor to a long piece of structural metal and then attach the other end to a stationary tower with a shaft or shoulder screw so it can swing down like a pendulum. Next, attach a long Smart Cable between a V5 Brain/Control System and the sensor. Program the V5 Brain to print the sensor’s acceleration values to the Brain’s Color Touch Screen. Have the students explore how swinging the Inertia Sensor on the end of the pendulum changes the sensor’s values.

Tumble Robot

Diagram illustrating V5 sensors, including various types and their features, as part of the V5 Category Description in the VEX Knowledge Base.

Tumble Robot: Another fun classroom activity is to have the students assemble a Tumble Robot. A Tumble Robot is designed to be able to drive upside down as well as right side up. Have the students write a user program using the Inertial Sensor to navigate a path. Then have them investigation how the robot’s behavior changes when it is driving upside down.

Uses of the Inertial Sensor on a Competition Robot:

The Inertial Sensor will provide a great competitive advantage for competition robots. Some of these uses include:

Navigation: In addition to setting headings or the amount of rotation for the robot to turn, the Inertial Sensor readings can be used to program the robot so it will travel in a straight line along a given heading. This is especially helpful during the autonomous portion of a match or during a Programming Skills run. Also, through the use of some higher-order mathematics, it is possible to use the acceleration values to write a function that can determine the robot’s change in position.

Stability: Perhaps one of the most disheartening things is to see your robot sprawled out on the playing field after it has tipped over. The Inertial Sensor can be used during both operator controlled and autonomous periods to detect if the robot is starting to tip and then the user program can make the robot take an auto-corrective action. This could take place while the robot is driving fully extended or while the robot is attempting to climb an obstacle.

No matter what the application the VEX Inertial Sensor is used for, there is no doubt it will be a welcomed addition for teams. The function of the sensor’s values are open to the imagination of the user.

The Inertial Sensor is available on the VEX website.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: