Setup Optical flow problem


I followed the configuration method described on the site

(which I consider to be very poorly explained) (I have a lot to say but my low level of English does not allow it)

in any way I managed to reach the stage of the first flight

but I escape this step that I can not find or understand:

“Range Sensor Check
Check the EKF5.meaRng message in the flashlog from your flow sensor calibration test. Check the following:
There is continuous range measurement.
It outputs a range on the ground that is 10cm of the expected value”

after I found this:

“First Flight (Copter Only)
Set EKF_GPS_TYPE = 0 (we don’t want the optical flow being used by the EKF at this stage)”

the EKF_GPS_TYPE does not exist in copter 3.4 it is right ?

and then say this :
"Pre-Arm checks
To allow arming and taking off in Loiter without a GPS the GPS arming check should be turned off as shown
below. Unchecking “All” and “GPS” and leave all other options checked.

But do not say anything about the GPS_configuration box

well any way I did a test flight… did not let me arm with the GPS unplugged,(strange I set up the Pre-Arm checks) … I connect the GPS and I flew at 1m and the drone seemed very reactive gave small accelerations, stayed level but going up and down in a range of 10 - 20cm

Well, here are the logs.

in advance thanks

sorry no matter what I try the logs do not want to load…

reading in neighbor post

I discovered that the PxFLOW needs a separate rangefinder connected to the flightC ?
Is that correct??

does it mean that the one that has integrated is useless?:face_with_raised_eyebrow:

and what about all the copter I’ve seen fly without a separate rangefinder ?

Well, put aside your copter and read the online documentation throughly. Your question clearly indicates that you did not do this, since the first paragraph of pxflow doc say the following:

Although the sensor has plus a built-in Maxbotix LZ-EZ4 sonar to measure height, this has not been reliable enough over a range of surfaces in testing, so its readings are not used and instead a separate Range Finder such as the LightWare SF10b must also be attached to the vehicle.

Yes, I do.
but when they say “sonar to measure height, this has not been reliable enough over a range of surfaces in testing”

Makes me think that they try to warn us to use it with caution.
but seriously what happens with all the other copters that are flying without a separate rangefinder ?

not you believe that it is crazy to add a zensor that is not going to be used?
There must be an explanation to that.

I’m just trying to understand

They add a sonar, but later figured out that sonar is not precise enough to support optical flow. For using Px4Flow optical flow and not having small jumps and insecurities, you need a lidar. No alternatives, anything else gives you degraded performance.

I doubt that this sentence could be interpreted as a warning :“so its readings are not used and instead a separate Range Finder such as the LightWare SF10b must also be attached to the vehicle.


The px4flow original design and firmware was a standalone unit that was developed by the same team as the PX4. If you are using it with the PX4 Flight Stack it is working with the attached sonar.

The ArduPilot code (here) is different, the OpticalFlow firmware is different as well, it is using a different algorithm (KLT instead of original SD) this is why you need to flash the px4flow in order to work wit ArduPilot and this new firmware DOES NOT use the attached sonar to do the optical flow scale adjustment, is processed within the EKF hence the requirement for a rangefinder distance signal attached to the FC. BTW, you can use the px4flow Mavbotic if you connect it to the Flight Controler interface (analog or serial)and setup as the rangefinder.
But most of the use case are recommanding a laserbased rangefinder for distance and accuracy.

Hope that is helping understand why :wink:


:star_struck: what an incredible explanation … Now everything makes sense

now I have to consider to switch to the PX4 firmware?..
Actually, the optical Flow was my option to guaranteed that my drone would not hit the ground during the flights ( I live in the mountains). I am not planning to fly inside. So, what do you recommend me as a cheap and good option Range Sensor?

Ardupilot offers a better integration of px4flow and if you are in mountains you will need a rangefinder to fly in terrain following mode
I am using a garmin lidar lite v3 but I will try the newly release 20 meter tf mini from benewake , at 40$ its a deal if it works ok.

Could you tell me where to buy it?
I could not find it at 40$

I ordered at robotshop, should be avail next month
No driver yet but it should be easy to adapt
I will certainly write a blog about it here…stay tuned

1 Like

how did you do that ?
I also want to ordered one, how can I do it, if they are not available yet?
Where exactly are you going to post it?
Can you tell me when you post it?

Yes this is back order , ETA is oct 3
Once tested and working I will write a blog on this site

I’m looking for beneke tf too. Hope the shop stock enough to meet demand

Hai could you please give me a tip on how to connect the Maxbotix sonar to Flight Controller as a seperate range finder ? Px4 flow has only one I2C output so how should I connect the sonar to pixhawk.
Im stuck at the moment!
Thanks in advance!
I would like to add some details:
FC - pixhawk px4 mro
software - missionplanner 1.3.68
copter - AC V 3.6.11
px4 flow - shows opt_m_x and y values when connected directly by usb and sonar shows no readings
-when connected via pixhawk both opt_m_x and sonar readings are zero.
AHRS_EKF_TYPE = 3 (although in available options only 1 and 2 are visible, i coulnt understand why but when i gave 3 it didnot show any error) ), EK2_ENABLE = 0, EK3_ENABLE=1 , GPS_TYPE = 0
note: my pixhawk FC and optical flow are on the table at the moment and not mounted on a copter.
but still atleast the flow camera should show some readings right :thinking:
all in all im quite stuck at the moment. . . any help would be really apprciated :slight_smile:


Depending on the model , it is either a serial , analog or an I2C interface on the MaxBotic.
Refer to the wiki for configuration and connection:

Thanks !
I have visited this link before.having pxflow v1.3 ahd I believe it is I2c interface ’ MaxBotix I2CXL-MaxSonar-EZ’ butpx4flow_testing the problem is px4 flow v1.3 has only one I2c output so i dont understand how to connect the sonar seperately to pixhawk.
Is this range finder connection essential for optical flow to show some readings when connected to pixhawk?

Yes it is… No rangefinder == no standard Optical Flow operation == no x - y data on Mission Planner screen == no data on logger

3 things necessary to make OF work:

  • A good source of power (dedicated UBEC)
  • The correct firmware
  • A RangeFinser connected to the Flight Controller

Read - Read and Read again the wiki on PX4FLOW

1 Like

@ppoirier in every version? Or it is only needed in the older versions of the PX4?

Hey @anish ,

I am also facing the same problem with the PX4Flow with sonar. I also read that wiki but after purchasing it with sonar I thought somehow I can use that sonar as a separate rangefinder but now I don’t know exactly how.

So can anyone suggest that if I desolder that sonar and then I use it with the IC2 port as mentioned here so it will work or the whole PX4flow will be damaged? Because as of now I am not able to purchase a new lidar lite v3. This is the Sonar which use in PX4Flow.

I will be glad if someone can give their suggestions on it.