Optical Flow Sensors for Drones: Indoor Positioning Guide

Optical Flow Sensors for Drones: Indoor Positioning Guide

Quick Answer

An optical flow sensor gives a drone horizontal velocity from the movement of ground texture beneath it. Pair that with a downward rangefinder and the flight controller can hold position where GPS is unavailable. For a simple ArduPilot build, choose the combined MicoAir MTF-01P; choose the Holybro PMW3901 when weight and broad firmware support matter more.

What an Optical Flow Sensor Actually Measures

Think of it as an optical mouse facing the floor. It compares successive images and reports movement across two axes. It does not create a map or provide an absolute position. The flight controller also needs height data to turn image motion into useful ground velocity, so a flow-only module needs a separate downward rangefinder.

This distinction matters indoors. GPS can tell a drone where it is globally, while optical flow only helps it resist local drift over a visible surface. We would use flow for warehouse hovering, low-altitude inspection or a GPS-denied transition, not as a substitute for GPS on a long outdoor mission.

PMW3901 or MTF-01P?

Choice Flow sensor Rangefinder Interface Best fit
Holybro PMW3901 PMW3901, 95Hz Separate unit required UART, 19,200 baud Very light builds; 0.6g module
MicoAir MTF-01P Integrated, up to 100Hz Integrated, advertised to 12m MAVLink over UART for ArduPilot Cleaner wiring and indoor positioning

The Holybro PMW3901 measures 14 × 11 × 5mm and needs another sensor for height. That keeps the flow board tiny, but adds wiring and configuration. PX4’s own guidance recommends about 4m of range for indoor use and at least 10m for outdoor work where GPS may degrade.

Holybro PMW3901 UART optical flow sensor with cable and protective mount
The PMW3901 is the lighter choice, but it still needs a downward rangefinder to scale movement correctly.

The MicoAir MTF-01P combines both measurements in a module under 5g. Its product specification quotes 0.1–10m for optical flow and 0.05–12m for ranging. ArduPilot’s setup example deliberately sets the usable rangefinder maximum to 8m. We would pick the MTF-01P unless every gram or a separate longer-range sensor matters.

Current ArduPilot Setup: Do Not Copy the Old Parameters

The old recipe of SERIALx_PROTOCOL = 9, FLOW_TYPE = 1 and EK2_GPS_TYPE is wrong for these UART products. For the Holybro module, its current documentation specifies SERIALx_PROTOCOL = 18 and FLOW_TYPE = 4. Configure its separate rangefinder independently.

For the MTF-01P, select “mav-apm” in MicoAssistant, then use SERIALx_BAUD = 115, SERIALx_PROTOCOL = 1, FLOW_TYPE = 5 and RNGFND1_TYPE = 10. ArduPilot also documents RNGFND1_ORIENT = 25 for a downward-facing sensor. On ArduPilot 4.5 or later, its MTF-01 page notes an extra MAVLink ID and serial forwarding setting, so follow that page rather than guessing.

Before trusting Loiter, remove the propellers and confirm non-zero opt_m_x, opt_m_y, opt_qua and range data in Mission Planner. Then make a short AltHold test between roughly 0.5m and 3m. Only after checking the log should you set EKF3 horizontal velocity to optical flow with EK3_SRC1_VELXY = 5. Our ArduPilot setup guide covers the flight-controller basics first.

Mounting and Surfaces Decide Whether It Works

  • Point it straight down. Set the documented sensor orientation if its axes do not match the airframe.
  • Give it texture and light. Concrete and patterned floors track better than glossy white floors, water or darkness.
  • Keep the lens clear. Landing dust and a cable crossing the view can ruin quality without an obvious wiring fault.
  • Respect range limits. ArduPilot limits height when flow is the only horizontal source and the rangefinder reaches its configured maximum.

Optical flow is a low-altitude velocity aid, not indoor GPS. If you need room-scale mapping, repeatable waypoints or obstacle avoidance, add an external navigation system or companion computer. For sensor-led builds, see our drone sensors collection and our guide to adding positioning sensors to a drone.

FAQ

Can a drone hold position indoors without GPS?

Yes. A downward optical flow sensor plus a rangefinder can provide the velocity and height data needed for local position hold, provided the floor has visible texture and lighting is adequate.

Does a PMW3901 need LiDAR?

It needs a downward distance source. A ToF or LiDAR rangefinder supplies the height required to scale image movement into ground velocity.

How high can optical flow work?

It depends on the lens, lighting, texture and rangefinder. Treat the configured rangefinder maximum as the ceiling and test well below it before relying on position hold.

Back to blog