Reference firmware for PixArt's PAT9125EL sensor and evaluation board. "Hello World" and "Library" contain the exact same files. Please import just one of the two into your mBed compiler as a new program and not as a library.

You are viewing an older revision! See the latest version

Guide for Any Platform

This Wiki page provides a detailed guide on how to setup and operate PixArt's PAT9125EL sensor with the Nordic nRF52-DK.

Hardware

500
NOTE: This image shows the Nordic nRF52-DK microcontroller as an example.

  • 1.) PC with Windows Operating System
  • 2.) Any Microcontroller & Associated Cables (often USB-A male to USB-B male or USB-A male to micro-USB male)
  • 3.) PAT9125EL Evaluation Board
  • 4.) Standard Male Pin Headers
  • 5.) Jumper Cables
  • 6.) Soldering Station
    • NOTE: PC and soldering station not included in image.
      • You will need to solder the pin headers to the evaluation board similar to the following image:
        300

Importing Code

With the sensor connected to the microcontroller, we can now import code into the microcontroller to start talking to the sensor. For the firmware code, please visit this product's components page here: https://os.mbed.com/components/PAT9125EL-Evaluation-Board/

  • 1.) Login/create an mBed account.
  • 2.) Import the reference firmware into mBed's online compiler using the "Import program" button. You can find this in the link above. /media/uploads/PixArtVY/import_program2.jpg

  • 3.) Make sure the selected platform is the platform that you are using. /media/uploads/PixArtVY/mbed_compiler2.jpg

  • 4.) Make sure that you are using the proper library. Only one of the SPI/I2C libraries should be in use. Simply comment out the one that is not in use. /media/uploads/PixArtVY/commheaders2.jpg

  • 5.) Make sure your microcontroller is plugged into your PC. It should show up as a separate drive similar to the (C:) drive. Then, you can compile the program and save the HEX file into your microcontroller. 800800
    • NOTE: If you suspect your code did not import properly, please try unplugging the device, plugging it back in, and then re-compiling and saving the code into the device.

Connection

Please refer to the image and notes below for pinout details.
700
/media/uploads/PixArtVY/i2ccommfuncs.jpg/media/uploads/PixArtVY/spicommfuncs.jpg

  • VDD and VLD on the PAT9125EL evaluation board connect to any VDD pin on the Nordic nRF52 microcontroller.
  • GND on the PAT9125EL evaluation board connect to any GND pin on the Nordic nRF52 microcontroller.
  • NC = No connection.
    • NOTE: For the SPI version, you will need a 2-to-1 connection because this sensor uses 3-Wire SPI (data pin "SDA" on the evaluation board is bi-directional). The SDA pin on the evaluation board needs to connect to BOTH the MISO and MOSI pin that have you assigned to your microcontroller.
    • NOTE: For the I2C version, the "ID" pin on the evaluation board determines the slave ID depending on what it is connected to. (High = 0x73, Low = 0x75, NC = 0x79). By default, please connect this pin to GND (Low) unless you have altered the firmware.
      • To change the slave ID in firmware, you will need to alter the second line of code in I2CcommFunctions.h /media/uploads/PixArtVY/9125_slave_id.jpg

Functional Test

  • 2.) Open Tera Term and go to File > New Connection or use the hotkey "Alt + N". Select "Serial" and choose the COM port corresponding to your microcontroller. Then click on "OK". /media/uploads/PixArtVY/tera_term_serial.jpg

  • 3.) Go to Setup > Serial Port and set the baud rate to 115200. Then click on "OK".
    /media/uploads/PixArtVY/tera_term_baud.jpg

  • 4.) Go to Setup > Terminal and change "Receive" from "CR" to "LF". Then click on "OK".
    /media/uploads/PixArtVY/tera_term_receive.jpg

  • 5.) With the hardware wired up properly, the firmware loaded into the microcontroller, and the terminal emulator set up, we should now be able to see the sensor working. If you move your finger in front of the sensor (remember the working distance is 3-30mm), you should see outputs on the terminal: /media/uploads/PixArtVY/tera_term_output.jpg
    • "deltaX" and "deltaY" show the number of counts detected per report.
    • "X-axis Counts" and "Y-axis Counts" show the total number of counts recorded throughout runtime.

Thank you for choosing PixArt! If you have any questions, feel free to contact us at: sales_us@pixart.com.


All wikipages