Skip to content

Developing a MPU6050 driver for the tri-axial accelerometer.

Notifications You must be signed in to change notification settings

fdcavalcanti/driver-mpu6050

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPU-6050 Linux Device Driver

This project aims to create a very simple kernel module to communicate with Invensense's MPU-6050 using I2C, focusing on accelerometer data acquisition.

I'm also using this project as a learning tool for Linux Device Driver and Kernel Module development. I encourage this approach to anyone who is also interested on the subject.

Right now, this module can provide constant accelerometer reads up to 150 Hz, which can be done through IOCTL calls.

The follow features are under development, such as:

  • Sample rate configuration
  • Full scale range selection (AFS_SEL)
  • Read from FIFO or directly from accelerometer registers
  • Temperature monitoring

Environment

This project is under development on a Raspberry Pi Zero 2W but should work on other systems, given that the necessary header files are available.

Usage

To compile and insert this module:

juvenal@pi:~ $ cd driver-mpu6005/driver
juvenal@pi:~/driver-mpu6050/driver $ make
juvenal@pi:~/driver-mpu6050/driver $ sudo insmod mpu6050.ko

To remove the module (can be executed anywhere):

juvenal@pi:~/driver-mpu6050/driver $ sudo rmmod mpu6050

Recommend checking dmesg for debugging information.

After inserting the module, move to the test folder, compile and run the accelerometer read test.

juvenal@pi:~/driver-mpu6050/test $ gcc -o test_ioctl test_ioctl.c 
juvenal@pi:~/driver-mpu6050/test $ ./test_ioctl 

About

Developing a MPU6050 driver for the tri-axial accelerometer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published