Arduino Pro Micro and MARG MPU-9250 for Inertial Mouse

posted in: Arduino | 14

In this Arduino Tutorial MPU-9250 Orientation Sensor was used. Actually, only accelerometer data was acquired and used to control mouse cursor in air. Please NOTE that  Arduino Pro (Micro) or Arduino Leonardo should be used for this purpose.

Download # Arduino Code (*.ino file)

Download # MPU-9250 Library (*.zip file)

or

Upload Arduino code directly to your Microcontroller from website


If you want to integrate Arduino IDE into your website (as above) sign up here: codebender

[kad_youtube url=”https://www.youtube.com/embed/o09-9n5WrxE”]

14 Responses

    • admin

      I don’t know if it is a clone as you say, it might just work out for you. Just try it out and let us know.

  1. Shane

    Can you get this to work with an Arduino Uno or Mega by any chance, an what changes would need to be made to the code.

  2. danny

    hi, I’m a noob, I’m having trouble with the sketch wanting mouse.h library. I have a pro micro and mcu9265. I just cant get it to compile! I’ve looked for the mouse.h sketch but haven’t found anything that works. Any ideas would be appreciated.

    • admin

      I haven’t used mouse.h. Make sure you follow every step that I show in the video.

      • paul

        In your code you have several references to mouse. Has is this implemented?

  3. Dami

    Hi. Thank you for great sketch.

    Is it possible to remap the x axis (horizontal pointer movement)? I plan to place this mouse on my wrist, and it would be better if the pointer just followed to movements of my hand, eg used z axis (horizontal hand movement) rather than tilting the mouse. Is it possible?
    I tried to change your code but didn’t succeed. Any hint would be appreciated.

  4. Dami

    And one more question. I noticed that the mouse works really smoothly as soon I upload the code into arduino.
    But if I plug it out of the usb port and then reconnect it – the pointer movement is really laggy. Did I miss something?

  5. Anna

    Hi, I don’t understand the meaning of variable “Min”, “Max” and function “map” in your Arduino Code, what do they do? Please explain it for me, I really need it for my project, thank you so much.
    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);

  6. Joe

    is it possible to use z axis for horizontal movement and use delta instead absolute value?
    can you explain me how?

    thanks inadvance

Leave a Reply