Our optical flow do not work on AC3.4 - Why?

I type here after a brief consulting with my friend Ermanno from Italy.

We was trying to install pix4opticalflow, sensor on AC3.4.6 but something was not right. I try to explain here our problem.
We bought the sensor here:

1)We followed the wiki, the sensor was connected via I2C
2)We focused the lens on
3)We have enabled the sensor from the planner
4)We looked at the “status” screen and looked at the values "opt_m_x opt_m_y"
5)Sometimes we can see some numbers, sometimes not, we only see 0.
6)We tried to fly with pre arm check disabled, but it seems that the optical flow was not functioning.
7)We looked again at “opt_m_x opt_m_y” but everything was 0.

Can anyone help us in make the optical flow work correctly?

What range finder or you using along with it?

The one integrated in the sensor.
The sonar.

It is mandatory to use it? Or is not mandatory?

Technically doable, but make sure you’re actually using it! You will need to solder wires from the sonar itself to a plug and connect it to the ADC manually.

Really recommend a lidar lite though, I tried using the sonar myself, but the occasional measurement errors and weird startup behavior got on my nerves!

Thanks for the reply (=

We have tried both I2C and ADC, but not good results.
Can anyone give some detailed explanation about Optical Flow? Just to understand more about it.

Just to make sure , have you read and completed the wiki required steps : http://ardupilot.org/copter/docs/common-px4flow-overview.html

Consider that you have to install 2 devices:
A) RangeFinder : (Preferably a laser based unit on serial or I2C) - configured in Initial Setup and outputting distance (Sonar Range)
B) OpticalFlow : Firmware upgraded - Connected using I2C - Configured in Initial Steup and outputting x - y opflow signal and calibrate it with the IMU as demonstrated in the wiki.

If these 2 sensors work correctly then, you can start using optical flow and use it in tandem with the range finder using the EKF. I suggest you select EKF2 http://ardupilot.org/dev/docs/ekf2-estimation-system.html#optical-flow-and-range-finder-fusion and fly with or without GPS
GPS EK2_GPS_TYPE 3 = use no GPS (optical flow will be used if available)

I personally fly it indoor (no GPS) using a Garmin Lidar Lite Range finder with no problem.
Here is a demonstration of my Q450 doing Red Ball Tracking , using an OpenMV as a color blob detector controlling the precision landing library and you can see the optical flow operate as the velocity controler, making the quadcopter holding its position quite accurately in Loiter mode.

Please note the texture on the rug that is essential to get a good optical flow detection, and you need to adjust the focus for the typical mission (mine was adjusted to 1-3 meter to fly in my garage).

Thank you (=
I will try again following your suggestions!