• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    C++
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Interfacing PixArt PMW3360 with Arduino

PMW3360_Arduino

Interfacing PixArt PMW3360 with ATMega32u4 based Arduino boards

Parts info

Pin connection

  • MI = MISO
  • MO = MOSI
  • SS = Slave Select / Chip Select
  • SC = SPI Clock
  • MT = Motion (active low interrupt line)
  • RS = Reset
  • GD = Ground
  • VI = Voltage in up to +5.5V
[Module] --- [Arduino]
      RS --- (NONE)
      GD --- GND
      MT --- Pin 7 (PE6, INT6) -> movement interrupt
      SS --- Pin 10 (PB6)
      SC --- SCK (PB1)
      MO --- MOSI (PB2)
      MI --- MISO (PB3)
      VI --- 5V

// in Mouse example
[Button] --- [Arduino]
    Left --- Pin 1 (PD3, INT3)
   Right --- Pin 0 (PD2, INT2)
   
* Connect the other pole of a button to GND

Sketch Descriptions

  • PMW3360DM-Burst/
    • Minimal example for burst read on PMW3360 sensor
    • displacement in X and Y axis are printed when a motion is detected.
    • Serial Plotter is a nice way to visualize the result.
  • PMW3360DM-Mouse/
    • Fully functional mouse (w. 1k polling rate) example with two buttons (left, right)
    • Default CPI and debounce time can be set (see #define sections in the source code)
    • Commands (newline (\n) should be placed at the end of each command)
      • Q: toggle surface quality report (can be seen thorugh Serial Monitor or Serial Plotter)
      • I: print device signature
      • C[number]: Set cpi level, example) C1600\n = set CPI to 1600.
  • PMW3360DM-Camera/
    • See raw image captured from the sensor.
    • It outputs 1297 numbers in a plain text (dilimited by space character ' ')
      • [0] -- [1295]: 36x36 array of sensor image
      • [1296]: Surface quality value
    • A GUI version visualizer (PMW3360DM_Camera_Viewer/) is implemented on Processing (http://processing.org).
      • Press 's' to save the captured frame.
  • (Legacy) Module/Arduino Examples/

How to use

  • Build the circuit as described.
  • (PMW3360DM-Mouse only) Copy the /library/AdvMouse/ to your Arduino library folder
  • Load one of the desired skectch on Arduino IDE.
    • For PMW3360DM-Camera sketch, load PMW3360DM_Camera_Viewer sketch on Processing and run.

Wishlist

Example construction

  • Image that shows wiring between Arduino and PMW3360 sensor module
  • Image that shows all the components crumpled inside a mouse