Flow setting keeps resetting

Running Copter 3.5rc2, and both poshold and loiter work pretty well. The issue is that every time I remove power, FLOW_ENABLE is set to 0. No other settings are reset, only this one as far as I can tell.

If I set it in mission planner, I can then fly in loiter until I remove power.

What’s going on?

Further update: Flow sensor works fine if I power the FC through USB, but does not boot right if I use battery.

It might be related to this issue found by the PX4 people, seems to work the same way. Is there a good way to verify this?

So for now downgrading to 3.4 appears to work, though I now sometimes get inconsistent results with my Lidar Lite v3 (known issue)

I got same problem like this(using Copter 3.5), have you solved it?

I’ve just tested with AC3.5-rc5 and master and optical flow seems to be working when connected using either a battery or USB. The way I checked if it was working was to connect with the mission planner over a 900mHz telemetry radio and then looked in the Flight Data screen’s Status tab and checked that opt_m_x and opt_m_y were non-zero and changing.

As a side note, the way we set the FLOW_ENABLE parameter to zero when we can’t successfully talk to the flow sensor is not consistent with how we handle other sensors so we should change this. I’ve raised an issue here: https://github.com/ArduPilot/ardupilot/issues/6243

My guess is that the flight controller cannot provide enough power to run the flow sensor through the I2C cable. I think it would be good to remove all other peripherals that are powered by the flight controller (radios, lidar, etc) and try again. Another option would be to try to power the optical flow sensor with a separate BEC. I know wiring that up would be annoying because you’d need to connect the I2C’s VCC and GND wires to a 5V bec but that would be a good test.
A voltage meter could be used as well to check the voltage being provided through the I2C cable.

A dataflash log’s CURR message might also provide info on the CPU’s voltage.

Thanks for you reply.
I also tried to change file like this https://github.com/ArduPilot/ardupilot/pull/6205 I received Mavlink message mavlink_msg_optical_flow and found the value ground_distance changing as I move the drone, but others never changed.
I will try to power flow sensor another way and test again.

caoshiyue, Just for reference, what FC are you using?

Also, I’m not powering the flow module itself through USB, I’m plugging in the USB power to the FC, so the current issue seems odd, the battery should be able to supply way more current than the USB. I’ve been running 3.4.6 for a while, and I know for certain that it works well. The issue starts immediately upon update to 3.5.

The reason I want to use 3.5 (or even 3.6) is the development of guided mode with optical flow. I’m developing an autonomous quadcopter for tight indoor applications, so this helps my efforts significantly.

For completeness, I measured the 5V on the I2C bus: from USB I get 4.3V with the sensor connected, and 4.78 disconnected. From battery I get 4.78 with sensor connected, and 4.88 disconnected. Note here that the lower voltage is the one that works.

Update: I measured 0.1V between BEC ground and I2C (FC) ground, so I connected them. Everything seems to work alright now, though I have not tested extensively. No idea why this works, since I only have the lidar powered from BEC, but it seems to.

Update 2 (kind of unrelated): 13m offset is still a thing on lidar lite v3 if it is not powered right from the start.

UPDATE 3:

Does not work still. Randomly does not connect

Hi ollenorelius. What a coincidence, I am also working on a project which need drone hold position and move autonomously indoor. Can we have a discussion?
Thanks for your advice, I measured I2C bus get 4.8V and sonar get 4.5V when use battery. So I only powered sonar using BEC as you said. But it still doesn’t work. So I have to contact with shop and wait for their reply.
I don’t know is there any difference between 3.4.6 and 3.5 makes my PX4FLOW doesn’t work.

Are you also using HKPilot32?

BTW: I edited my post. Does not work after all.

I’m using Pixhawk.
Now I’m checking the difference between 3.4.6 and 3.6 in code. Have you noticed that in which case it works well?

@caoshiyue,
You’ve got the optical flow sensor loaded with the “PX4Flow-KLT firmware” specified on the wiki of course? http://ardupilot.org/copter/docs/common-px4flow-overview.html

That may be the problem.
I’m using a firmware bought from a company which is further developed based on original version. I have contacted with them. But you see, PX4Flow-KLT firmware didn’t upgrade recently, and my firmware works well under Copter 3.4.6 .

We’ve made fairly significant change to the driver between AC3.4.6 and AC3.5. In short we moved the driver “in-tree” which means we don’t use the PX4Firmware drivers anymore, instead we have our own driver that directly pulls the data in using I2C.

I can’t think of why that would matter but I think it would be best, at least as a test, if you loaded up the flow sensor with the firmware we recommend. If that clears up the problem then we know it’s something going on in the alternative flow sensor software.

I am using the recommended drivers, and I see the problem. It gets way worse with the other drivers though.

It appears the problem has been resolved by powering the I2C bus from BEC. It’s strange that it worked on 3.4, but it was probably on the edge there too. Make sure to get a nice crispy 5V on there.

Thanks for your time Randy, seems you were right from the start!

1 Like

Olle,
That’s really great news. Thanks for the effort to get it sorted and reporting back!