# PMW3901 Optical Flow Sensor

## Ardupilot Quick Start Guide

To enable the Holybro PMW3901 optical flow sensor in Ardupilot, set *FLOW\_TYPE* to 4 and *SERIALx\_PROTOCOL* to 18.

<figure><img src="https://2367252986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLIgtGDAvVGkCKGOJb1bR%2Fuploads%2FltimhfeSe9sRo199RWQl%2Fimage.png?alt=media&#x26;token=7a5d7d5d-4654-424a-9dcc-42f1e6248022" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2367252986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLIgtGDAvVGkCKGOJb1bR%2Fuploads%2FXc4jsWy5fRERip10IZjS%2Fimage.png?alt=media&#x26;token=424b0c19-32e8-45f5-abde-e3a88fc9111e" alt=""><figcaption><p>Telemetry 2 is used for this example</p></figcaption></figure>

If you are not sure which serial port you are using, here is a list of serial mapping for the Pixhawk 6 family:

* SERIAL1 -> UART7 (Telem1)
* SERIAL2 -> UART5 (Telem2)
* SERIAL3 -> USART1 (GPS1)
* SERIAL4 -> UART8 (GPS2)
* SERIAL5 -> USART2 (Telem3) (not included on 6C Mini)

Once the sensor is correctly configured, check the *opt* related values from the status tab. If the values are non-zero while moving the sensor around, you are good to go.

<figure><img src="https://2367252986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLIgtGDAvVGkCKGOJb1bR%2Fuploads%2Fe8hRwiSBwgAeKQeEbEdt%2Fimage.png?alt=media&#x26;token=32d7dc40-31a9-40c3-b440-26e55af4b579" alt=""><figcaption></figcaption></figure>

{% embed url="<https://ardupilot.org/copter/docs/common-optical-flow-sensor-setup.html>" %}
Optical flow test and calibration guide from Ardupilto WIKI
{% endembed %}

## PX4 Quick Start Guide

To enable the Holybro PMW3901 optical flow sensor in PX4, simply set *SENS\_EN\_PMW3901* to enable, and the *SENS\_TFLOW\_CFG* to the corresponding port that sensor is connected to.

To save the settings, reboot or power cycle the flight controller.

<div align="left"><figure><img src="https://2367252986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLIgtGDAvVGkCKGOJb1bR%2Fuploads%2FlVDYMcd76qx7SHGZkHyL%2Fimage.png?alt=media&#x26;token=4d7ed8f5-f4a0-487b-b540-deefa20b0841" alt="" width="375"><figcaption></figcaption></figure> <figure><img src="https://2367252986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLIgtGDAvVGkCKGOJb1bR%2Fuploads%2FSD6TTAoWayUH8cM9zFeB%2Fimage.png?alt=media&#x26;token=053233c7-a468-4fb4-a4eb-6e260c43e974" alt="" width="563"><figcaption></figcaption></figure></div>

Once the sensor is correctly configured, you can head to MAVLink Inspector->OPTICAL\_FLOW\_RAD section to check the sensor reading to make sure the sensor is operational.

<figure><img src="https://2367252986-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLIgtGDAvVGkCKGOJb1bR%2Fuploads%2FFiODSDglpzwq0ugZtZcg%2Fimage.png?alt=media&#x26;token=df94f95a-f2b2-427a-8fba-0215089dea64" alt=""><figcaption></figcaption></figure>

{% embed url="<https://docs.px4.io/main/en/sensor/optical_flow.html>" %}
For more setup tips, visit PX4 official WIKI
{% endembed %}


---

# 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://docs.holybro.com/pmw3901-optical-flow-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.
