The V5 Rotation Sensor is one of the powerful V5 sensors which are designed for complete integration with the V5 robotics platform.
The following article will cover:
- Description of the Sensor
- How the Rotation Sensor Works
- Setup of the Rotation Sensor
- Adding the Rotation Sensor as a Device in VEXcode V5
- Common Uses of the Rotation Sensor
- Uses of the Rotation Sensor on a Competition Robot
The V5 Rotation Sensor is capable of measuring the following values:
- Rotational position
- Total rotations
- Rotation speed
The rotational position is measured from 0° to 360° with a 0.088 accuracy. The angle is determined absolutely and is not lost when the robot is powered off.
Rotations is the number of revolutions forward or reverse, and can be reset to zero as needed. The rotation value is not stored when the robot is powered off.
Shaft speed is measured by the sensor in degrees per second.
The Rotational sensor is compatible with both the 1/8” and the 1/4” VEX shafts.
The housing of this sensor has a shaft hole which is sized for the 1/4” VEX Shaft. This shaft hole is capable of rotating within the housing of the sensor.
The sensor housing also has a screw mounting hole which passes completely through the housing and will accommodate #8-32 screws in order to mount the sensor.
Note: The Rotational Sensor comes with two metal shaft inserts which can be inserted into the ¼” shaft hole in order to accommodate the ⅛” VEX shafts.
The width of the V5 Rotation Sensor allows it to be nested into a piece of C-Channel.
In order for the Rotation Sensor to be functional with the V5 Robot Brain, the sensor’s V5 Smart Port and a V5 Robot Brain’s Smart Port need to be connected with a V5 Smart Cable. The Rotation Sensor will work with any of the 21 Smart Ports on the V5 Robot 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.
How the Rotation Sensor Works
The V5 Rotation Sensor’s rotating shaft hub position is changed into electrical signals (using a Hall effect sensor). The sensor's internal electronics convert these signals into output signals to be received as an input by the V5 Brain.
As previously mentioned, the Rotational Sensor will remember its rotational position from 0 to 360 degrees even if the power is removed. So in that respect, it works similarly to a 3-wire potentiometer. However, unlike a potentiometer, it can also continuously rotate and measure many shaft rotations like a 3-wire Optical Shaft Encoder.
The Rotational Sensor combines the best features of the 3-wire sensors into an updated package that mounts easily with structural metal and uses the V5 Brain’s Smart Ports.
The Rotation Sensor needs to be paired with a programming language such as VEXcode V5 or VEXcode Pro V5 to create a user program for the V5 Robot 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 with the Rotation Sensor to:
- Set the rotational sensor’s position to a specified degree, such as 0 degree.
- Measure the angle in degrees which a shaft has rotated between 0 and 360.
- Measure position by either turns of a shaft or total degrees turned of the shaft.
- Measure shaft speed in degrees per second (dps) or revolutions per minute (rpm).
Setup of the Rotation Sensor
Placement: The rotational sensor needs to have a shaft inserted through its shaft hole to be functional. Be sure to securely attach the sensor using an #8-32 screw through its mounting hole.
Special care should be used to assure the shaft is aligned with the structural holes, bearings, and the shaft hole of the sensor so there is no binding which will inhibit the shaft from turning.
Reading Rotation Sensor Values: It is helpful to use the Device Info screen (dashboard) on the V5 Robot Brain to see the information the Rotation Sensor is returning. This can be done with the sensor connected to the Brain with the following steps:
Remove the V5 Brain Magnetic Screen Protector, turn on the Brain, and touch the Devices icon.
Select the Rotation Sensor icon on the Device Info screen.
The device info for the rotational sensor will display the angle a shaft has been turned, the amount of rotations the shaft has turned, and the shaft speed (velocity). Selecting the section of the screen with the ‘Set Zero’ will reset the values to zero.
Note: Be sure the V5 Robot Brain has the latest version of firmware.
Adding the Rotation sensor as a device in VEXcode V5
Whenever a sensor is used with a programming language, it needs to be configured within that language. With VEXcode V5 and VEXcode Pro V5, this is accomplished by using the ‘Add a device’ feature. To provide an example of this, the following steps will add the Rotation Sensor as a device within VEXcode V5.
Select the Devices icon.
Select ‘Add a device.’
Select the Smart Port that the Rotation Sensor is plugged into on the V5 Robot Brain.
Once the port is chosen, select ‘DONE.’
Note: There is an option to change the name of the Rotation Sensor in the text window from Rotation1 to a different name and an option to change the direction in which the sensor measures rotation.
Once the Rotation sensor has been added to your user program, a new set of sensor commands will become available.
Note: There is a difference between setting 0 in the dashboard and setting 0 in code. When using the dashboard, the zero position is stored inside the rotation sensor and is maintained when power is lost. When 0 is set in code it will not be maintained when the V5 Brain is turned off.
Common Uses of the Rotation Sensor
The Rotation Sensor can produce measurements which can be used to change the behavior of the robot.
These features can be used with either:
- The ‘Device info’ option on the V5 Robot Brain.
- Using the example project ‘Rotation Sensing’ found in the ‘Open Examples’ option in the File menu of VEXcode V5.
- Writing a custom user program with one of the VEXcode programs.
As previously mentioned, the Rotation Sensor can measure shaft angle, shaft position, and speed of shaft rotation. The V5 Smart Motors also have excellent internal encoders which can measure some of these same values.
Nonetheless, there are many applications in which the Rotation Sensor can provide additional valuable readings. Also, the rotational sensor's ability to provide an absolute value (a value which will not change after the robot's brain has been turned off) can be a huge advantage.
Some examples are:
Controlling position: The shaft for the 84T gear (step 32, V5 Clawbot build) found on the V5 Clawbot’s arm could be replaced with a longer shaft so a Rotational Sensor can be inserted on the shaft and mounted to the tower of the Clawbot (steps 35,36). This will allow the V5 Brain to always know the angle of the Clawbot’s arm.
Note: the lower Hex Nut Retainer in Step 23 will need to be replaced with a flat bearing in order to accommodate the mounting hole of the Rotation Sensor.
Once the sensor is in place, students can be challenged to use the feedback from the sensor to move, stop, and hold the V5 Clawbot’s arm at 3 different heights when buttons are pressed on the V5 controller.
- Input/Output ratio reading: Another great classroom use of a Rotation Sensor is with the study of sprocket and gear ratios. A Rotation Sensor can be placed on the output shaft of the “driven” side of the sprocket/gear ratio. A 1:1 power transfer ratio can be used to record an expected output reading for the Rotation Sensor when the V5 Smart Motor is set to a certain power/speed for the input shaft “driving” side. Then different ratios can be assembled and the expected output for the ratio can be compared to the reading for the actual output.
Uses of the Rotation Sensor on a Competition Robot
The Rotation Sensor will provide an excellent competitive advantage for competition robots. The ability to measure shaft angle, position, and shaft speed will provide a great deal of information to control the robot's behavior, such as:
- Flywheel speed: Some advanced flywheel designs use a ratchet system to drive the flywheel which throws a ball game piece. This is done so while power is not being applied to the flywheel by the V5 Smart Motor, the flywheel can free spin rather than losing energy from the resistance of the motor. In this type of design, a Rotation Sensor used on the flywheel’s shaft can provide a good method for the measurement and control of its speed.
- Isolated wheel/Rotation Sensor: There may be a case (pushing game pieces or other factors) where a robot may experience drive wheel slippage. As soon as the wheels driven by a V5 Smart Motor begin to slip, the values from the motor’s encoders are no longer valid. In this case, an isolated Omni-Directional Wheel with a Rotation Sensor on its shaft can be added to the robot’s chassis to accurately measure the movement of the robot. It is advisable to have this wheel assembly “spring” loaded through the use of rubber bands or latex tubing. This design will allow the measurement wheel to maintain adequate contact with the field surface without lifting the drive wheels off the floor.
- Game example: In the 2020 - 2021 VEX Robotics Competition game, Change Up, a Rotation Sensor could be placed on the shaft of the robot’s arm and it could be programmed to move to the exact height of the top of the goals to score balls.
No matter what the application the VEX V5 Rotation 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 for the imagination of the user.
The V5 Rotation Sensor is available on the VEX Website.