Wiki

Clone wiki

mecanumrover / Optical_Flow_Odometer

The Optical Flow Odometer uses two Avago ADNS-5020-EN sensors to measure travelled distances. The sensors were salvaged from old optical PS/2 mice (type WYSE MO42KOB). The communication protocol is basically SPI, but since the sensors operate at 5V, a voltage level converter is inserted between them and the ESP32. The ADNS-5020 requires only few external parts (LED and regulator capacitors) and has a simple interface.

The odometer board is mounted to the underside of the rover chassis, with the sensors pointing to the floor. The typical sensor-to-surface distance is only 1-2mm, so the "mouse" lenses were replaced by simple CCTV lenses with 6mm focal length. This increased the surface distance to about 4cm and allows for focus adjustments. I used the original mouse LEDs for surface illumination.

Each sensor provides single-byte values for delta-x, delta-y, surface quality (SQ) and shutter. In the current configuration, the x/y motion resolution is about 44.5 counts/cm (or 113 cpi). The ESP32 calculates a weighted average of the x/y values from the left and right sensors, based on the surface quality reading. The polling frequency is 20Hz to avoid overflow of the x/y registers (-127..127) at higher speeds.

Calibration depends on exact focusing of the lenses and on optimal illumination of the surface below the sensors. It is possible to read the image data (15x15 pixel greyscale, corresponding to 3x3mm of floor area) from the sensors in order to focus the lenses. However, it is much easier to read only the SQ values and adjust the sensors for maximum SQ.

The sensors are mounted on a simple PCB, together with the LEDs (for surface illumination).

odometer_board.jpg

The odometer board in place. The sensors are 4cm above the surface and 15cm apart at both sides of the chassis.

odometer_mounted.jpg

more resources:

Schematic

The original plan was to use two pairs of sensors. However, I had no success with reliable communication of more than two sensors on the same bus, although the datasheet claims that they should not interfere with each other as long as only one sensor is enabled. Therefore, only two sensors are used in the current configuration, and the other two are disconnected. I use a 74HC138 8-bit-decoder to drive the sensors' chip-select inputs. This reduces the interface width (and thus the number of ESP32 GPIO pins).

odometer_schematic.png

Updated