Component guide · Intermediate · 3 min read
Optical Flow Sensors

PMW3901, Pimoroni PAA5100JE, Holybro H-Flow and CubePilot HereFlow
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
An optical flow sensor is a tiny camera that tracks how the ground moves beneath it, like an optical mouse. Drones use it with a downward rangefinder to hold position indoors without GPS. The PMW3901 is the common chip, the Pimoroni PAA5100JE works very close to surfaces for robots, and the Holybro H-Flow and CubePilot HereFlow combine flow, a distance sensor and an IMU on DroneCAN.
Key specs at a glance
- Chip
- PMW3901 or PAA5100JE
- Range
- About 80 mm to infinity (PMW3901), 15 to 35 mm (PAA5100JE)
- Interface
- SPI (breakouts), UART (Holybro PMW3901), DroneCAN (H-Flow, HereFlow)
- Distance sensor
- Built in on H-Flow and HereFlow
- Supply
- 3.3 to 5 V
- Use
- Drone position hold, robot odometry
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1Holybro PMW3901 Optical Flow Sensor – UART Interface, 6-Pin JST GH Connector₹3,369
Option 2Pimoroni PAA5100JE Near Optical Flow SPI Breakout – 15-35mm Range, 242fps₹2,216
Option 3Holybro H-Flow Optical Flow and Distance Sensor Module – DroneCAN, Pixhawk 4-Pin₹15,529
Option 4CubePilot HereFlow Optical Flow Sensor with Lidar – CAN Protocol, 5V₹15,709
What the Optical flow sensors is
Optical flow sensors such as the PMW3901 and MTF-01 track how the ground moves under a drone, so it can hold position indoors without GPS.
Flow sensors need texture and light. Plain floors, darkness or water confuse them; add a patterned mat indoors.
The flow reading is in pixels, so a distance sensor is needed to turn it into metres per second.
Optical flow sensors pinout
The pins on the Optical flow sensors and what each one does.
| Pin | Function |
|---|---|
| VCC, GND | Power |
| SPI pins or TX / RX | Breakouts and UART modules |
| CAN H / L | DroneCAN modules |
- VCC, GND
- Power
- SPI pins or TX / RX
- Breakouts and UART modules
- CAN H / L
- DroneCAN modules
Wiring the Optical flow sensors
Connect the Optical flow sensors like this.
| Optical flow sensors pin | Arduino Uno | Flight controller |
|---|---|---|
| H-Flow / HereFlow | Not used | CAN port |
| PMW3901 UART | Not used | Serial port |
| PAA5100JE SPI | D13 / D12 / D11 / D10 | Robot microcontroller SPI |
- H-Flow / HereFlow
- Arduino Uno:
- Not used
- Flight controller:
- CAN port
- PMW3901 UART
- Arduino Uno:
- Not used
- Flight controller:
- Serial port
- PAA5100JE SPI
- Arduino Uno:
- D13 / D12 / D11 / D10
- Flight controller:
- Robot microcontroller SPI
Example code
A minimal sketch to check the part works.
CAN_P1_DRIVER = 1
CAN_D1_PROTOCOL = 1 (DroneCAN)
FLOW_TYPE = 6 (DroneCAN)
RNGFND1_TYPE = 24 (DroneCAN)
Reboot, then calibrate flow following the ArduPilot optical flow guide.
Fly in Loiter at low height over textured ground to test.Setup and tuning
connect SPI, I2C or UART to the flight controller as the sensor requires.
pair with a downward rangefinder (some modules include one) so flow is scaled by height.
face straight down, away from motor wash and vibration.
enable the flow sensor in ArduPilot, PX4 or INAV and calibrate scaling.
needs textured ground and good lighting.
What you need
Shop this list7 of 7 found in our store · ₹61,479
Holybro PMW3901 Optical Flow Sensor – UART Interface, 6-Pin JST GH Connector: the part this guide coversHolybro PMW3901 Optical Flow Sensor – UART Interface, 6-Pin JST GH Connector₹3,369
Pimoroni PAA5100JE Near Optical Flow SPI Breakout – 15-35mm Range, 242fps: another version this guide coversPimoroni PAA5100JE Near Optical Flow SPI Breakout – 15-35mm Range, 242fps₹2,216
Holybro H-Flow Optical Flow and Distance Sensor Module – DroneCAN, Pixhawk 4-Pin: another version this guide coversHolybro H-Flow Optical Flow and Distance Sensor Module – DroneCAN, Pixhawk 4-Pin₹15,529
CubePilot HereFlow Optical Flow Sensor with Lidar – CAN Protocol, 5V: another version this guide coversCubePilot HereFlow Optical Flow Sensor with Lidar – CAN Protocol, 5V₹15,709
Holybro Pixhawk 6C flight controller: to use it on a drone or roverHolybro Pixhawk 6C Mini Flight Controller₹21,938Closest match, check the specs
Benewake TF-Luna micro LiDAR (0.2 to 8 m): a low-cost LiDAR alternativeBenewake TF-LUNA Micro LiDAR Distance Sensor (Range: 0.2m~8m) – UART/I2C Interface₹2,329Closest match, check the specs
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
Alternatives and when to choose them
- TF-Luna LiDAR: rangefinder to pair with a flow sensor.
- Benewake TF02 and TF03: longer altitude range.
- LightWare microLiDAR: drone rangefinders.
Common mistakes to avoid
- Flying over plain or shiny floors.
- No rangefinder.
- Mounting tilted.
- Skipping calibration.
Frequently asked questions
Why does my drone drift with optical flow?
The surface lacks texture, lighting is poor, or calibration is off.
Do I need a rangefinder with optical flow?
Yes, height is needed to scale flow into speed.
Does optical flow work outdoors?
Yes, over textured ground in good light, at low height.
Which firmware supports it?
ArduPilot, PX4 and INAV all support common optical flow sensors.
How high can it work?
Usually up to a few metres, limited by the rangefinder.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

