> For the complete documentation index, see [llms.txt](https://docs.holybro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.holybro.com/pmw3901-optical-flow-sensor.md).

# 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="/files/JFdhbwZEuFaqEPkHo3rK" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/M4bGlLtNpeyoQftexWBF" 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="/files/xPi8trPu9M0nrWyNVB5t" 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="/files/T5noQelZrWuGcgZlcXkX" alt="" width="375"><figcaption></figcaption></figure> <figure><img src="/files/AZ1Cx0GF08aXa14G4kqn" 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="/files/w0UZMz07qgxZTTrpMgV0" 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.holybro.com/pmw3901-optical-flow-sensor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
