Need Help with MPU 92/65 Sensor

Hi Everyone, I am super new to Arduino and in need of help and suggestions with the Invensense MPU 92/65 sensor.

I am trying to build a wearable mouse so ideally, I can use my feet to control my laptop. (I know it is too advanced for my level but it is an urgent project so I have no choice to fly first instead of walking. )

I received MPU 92/65 sensor as a gift so I am using it with Arduino Leonardo board.

I have been searching around the internet for some examples and came across a few. But so far, they are not really working for me. The examples I have found on the internet either using MPU9250 library or MPU 6500 library. My first basic question is, are they both compatible with MPU 92/65?

I also tried using this code-Source: arduino-pro-micro-and-mpu-9250,

#include "Wire.h"
#include "I2Cdev.h"
#include "MPU9250.h"

// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU9250 accelgyro;
I2Cdev   I2C_M;

int16_t ax, ay, az;
int16_t gx, gy, gz;
int16_t mx, my, mz;
float Axyz[3];
int rightbutton = 4;
int leftbutton = 5;

void setup()
  // join I2C bus (I2Cdev library doesn't do this automatically)
  Serial.println("Initializing I2C devices...");
  Serial.println("Testing device connections...");
  Serial.println(accelgyro.testConnection() ? "MPU9250 connection successful" : "MPU9250 connection failed");
  pinMode(leftbutton, OUTPUT);
  pinMode(rightbutton, OUTPUT);

void loop()

  float pitchrad = atan(Axyz[0] / sqrt(Axyz[1] * Axyz[1] + Axyz[2] * Axyz[2])); // radians
  float rollrad = atan(Axyz[1] / sqrt(Axyz[0] * Axyz[0] + Axyz[2] * Axyz[2])); // radians

  float rolldeg = 180 * (atan(Axyz[1] / sqrt(Axyz[0] * Axyz[0] + Axyz[2] * Axyz[2]))) / PI; // degrees
  float pitchdeg = 180 * (atan(Axyz[0] / sqrt(Axyz[1] * Axyz[1] + Axyz[2] * Axyz[2]))) / PI; // degrees
  float Min = -15;//-30, -45, -15
  float Max = 15;// 30, 45, 15
  int mapX = map(pitchdeg, Min, Max, -6, 6);
  int mapY = map(rolldeg, Min, Max, -6, 6);
  Mouse.move(-mapX, mapY, 0);
  Serial.print(" - ");
  int leftstate = digitalRead(leftbutton);
  int rightstate = digitalRead(rightbutton);
  //Serial.print(leftstate); Serial.print(rightstate);
  if (leftstate == HIGH) {
    Serial.print(" Left Click! ");;
  if (leftstate == LOW) {
  if (rightstate == HIGH) {
    Serial.print(" Right Click! ");;

void getAccel_Data(void)
  accelgyro.getMotion9(&ax, &ay, &az, &gx, &gy, &gz, &mx, &my, &mz);
  Axyz[0] = ((double) ax / 256) - 1.6;
  Axyz[1] = ((double) ay / 256) - 2.1;
  Axyz[2] = (double) az / 256;

it works in general but the control is not ideal for me. It moves way too quick and the mouse keeps drifting even when the board is still. Should I add a delay somewhere in the code?

What is the most efficient way to do the calibration each time when I use it?

For the click, given I am going to wear it on my feet, I am considering using force pressure sensors. But this will be my next concern. If you have any other advice, please let me know.

Thank you very much!

MPU 92/65 sensor

No idea what that is. Post a link to the exact module.

it is an urgent project so I have no choice to fly first instead of walking

Please explain why this advanced project is "urgent", and you are expected do it without proper preparation.

Consider posting in the Gigs & Collaborations forum section and hiring someone to do it for you.

Will try the Gigs&Collabrations board! Thank you for the advice!~