# Rotation Sensor

![V5 Rotation Sensor](https://3510336827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7yGVyBrcpSR8SDSikj%2Fuploads%2FLthIMz3lnouATT9ygI5y%2Frotationsensor.png?alt=media\&token=ef6a55c9-4019-4648-b0be-3ae166a194eb)

### Functionality

The <img src="https://3510336827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7yGVyBrcpSR8SDSikj%2Fuploads%2F8P6gLH7ozCJo1G4Usynb%2Frotationsensor_icon.png?alt=media&#x26;token=6b695d24-1585-42ae-85a1-f0f142e8060b" alt="" data-size="line"> **V5 Rotation Sensor** is an smart sensor to determine the angle bound by \[0,36000) and the position in centidegrees, as well as the angular velocity in centidegrees / second.  The sensor connects to the [V5 Brain](https://wiki.purduesigbots.com/vex-electronics/vex-electronics/vex-v5-brain) through a smart port, and functions similarly to a[ encoder](https://wiki.purduesigbots.com/vex-electronics/vex-sensors/3-pin-adi-sensors/encoder) or [potentiometer](https://wiki.purduesigbots.com/vex-electronics/vex-sensors/3-pin-adi-sensors/potentiometer).&#x20;

### How it Works

The measurement component of the sensor is comprised of a Hall Effect sensor that measures the magnetic field of 2 magnets to track the absolute angle (\[0,36000)) of the rotation sensor. The angle resets every full rotation of the rotation sensor. A chip inside the rotation sensor (a Cortex M0+) then keeps track of the total rotations which acts as the relative position measurement, which does not reset every rotation.

Since the rotation sensor angle ([get\_angle](https://pros.cs.purdue.edu/v5/pros-4/group__cpp-rotation.html#gac675e49bc52b4b25ce2351742b69b6cb)) is absolute, as it's based on the magnetic field generated, the angular position of the shaft will not reset when it loses power. However, since the chip loses power the position ([get\_position](https://pros.cs.purdue.edu/v5/pros-4/group__cpp-rotation.html#ga28a657dab4a1609b0bddc8ba0c345b57)), which is relative, of the rotation sensor is not tracked and it resets to zero every time the sensor is turned on.

#### Teams/Individuals Contributed to this Article:

* Alyssa Agarie (Former VEX Competitor)
* [BLRS](https://purduesigbots.com/) (Purdue SIGBots)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.purduesigbots.com/vex-electronics/vex-sensors/smart-port-sensors/rotation-sensor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
