class platypush.plugins.gpio.sensor.motion.pmw3901.GpioSensorMotionPmw3901Plugin(rotation=0, spi_slot='front', spi_port=0, **kwargs)[source]

Bases: GpioSensorPlugin

Plugin to interact with an PMW3901 optical flow and motion sensor


  • pmw3901 (pip install pmw3901)

__init__(rotation=0, spi_slot='front', spi_port=0, **kwargs)[source]
  • rotation (int) – Rotation angle for the captured optical flow. Possible options: 0, 90, 180, 270 (default: 0)

  • spi_slot (int) – SPI slot where the sensor is connected if you’re using a Breakout Garden interface. Possible options: ‘front’, ‘back’ (default: ‘front’)

  • spi_port – SPI port (default: 0)


dict. Example:

output = {
    "motion_x": 3,   # Detected motion vector X-coord
    "motion_y": 4,   # Detected motion vector Y-coord
    "motion_mod": 5  # Detected motion vector module
    "motion_events_per_sec": 7  # Number of motion events detected in the last second
class platypush.plugins.gpio.sensor.motion.pmw3901.Rotation(value)[source]

Bases: IntEnum

An enumeration.

class platypush.plugins.gpio.sensor.motion.pmw3901.SPISlot(value)[source]

Bases: Enum

An enumeration.