SPI Optical Flow Sensor Work With GoPiGo3?

The Roomba vac and Create3 robot combine three sensors to maximize the “odometry” estimate of position in a room - wheel encoders, an inertial measurement unit, and a “near optical flow” sensor.

The most common math for combining sensor data, “sensor fusion”, is the Extended Kalman Filter, and has so far been beyond my reach to implement on my GoPiGo3 robots, but it is of interest none the less.

For the GoPiGo3 to incorporate a third odometry estimate data source such as this $20 SPI Near Optical Flow sensor some smart hardware type would need to determine:

  • Does the GoPiGo3, which uses SPI for Raspberry Pi to “Red Board” comm, play nice on SPI?
  • Would a second SPI device slow the GoPiGo3 SPI timing in any way?

Just thinking out loud…


That very topic is something I was actively researching and the answer is “I don’t know”.

If I remember correctly there are two SPI select pins on the Raspberry Pi, but I am not sure the GoPiGo uses them and in any event, the pin used is often not selectable and is hard-wired to the first select pin.


I’m pretty sure it uses /devspi0, but don’t know if something using /devspi1 would be ignored.

Wish @Matt was around to tell us all about the hardware design.


Hold on a few moments while I look this up.

Ahhh! Found it!

1 Like

Looking at the schematic, it appears that the GoPiGo uses SPI select #1, which is the same SPI select used by everything else too.

If that thing can use SPI select #2, you should have no problems.

You just have to make sure that whatever software drives it keeps SPI select 1 at a logical zero so that the GoPiGo isn’t selected too.