Power & Source of Big Ideas

Integrating IMU as Android native IMU

Moderators: chensy, FATechsupport

Hello All,

I want to add an IMU (accelerometer, gyroscope, magnetometer) to a NEO4 with Android 8, and it needs to look "native" because it needs to work with any APP.

I'm not comfortable with linux code but I can read some C and Java and took a look at FA's Android 8 source for the NEO4 and there seems to be code for some IMU chips (from Ivensense and others):

https://gitlab.com/friendlyelec/rk3399-android-8.1/blob/master/hardware/rockchip/sensor/mpu_vr/libsensors/software/core/driver/include/linux/mpu.h

Can I connect one of the chips mentioned in this file to one of NEO4's I2C buses and will it automatically be used by the Android sensor API? Is there something else I need to do? To which of the I2C buses should I connect it (I2C1 is being used by the camera)?

If someone has any info or pointers to info I'll be much appreciated.

Thank you and best regards
Nuno wrote:
Hello All,

I want to add an IMU (accelerometer, gyroscope, magnetometer) to a NEO4 with Android 8, and it needs to look "native" because it needs to work with any APP.

I'm not comfortable with linux code but I can read some C and Java and took a look at FA's Android 8 source for the NEO4 and there seems to be code for some IMU chips (from Ivensense and others):

https://gitlab.com/friendlyelec/rk3399-android-8.1/blob/master/hardware/rockchip/sensor/mpu_vr/libsensors/software/core/driver/include/linux/mpu.h

Can I connect one of the chips mentioned in this file to one of NEO4's I2C buses and will it automatically be used by the Android sensor API? Is there something else I need to do? To which of the I2C buses should I connect it (I2C1 is being used by the camera)?

If someone has any info or pointers to info I'll be much appreciated.

Thank you and best regards


You will very likely need to build the kernel with the driver for the IMU you want to use. I think Android needs some changes too, to enable the driver but as I have not done this other than the RIL, not sure where to look. The drivers usually modprobe the bus to find the devices but some may need some code changes to tell it what I2C bus to use.

If I get time this coming week whilst I am away on business, I'll dig around the kernel and Android 8 source and see if I can find something. Which IMU are you looking to use?
Hello Dave,

Thanks for the answer. I'm looking to use the triple axis accel/gyro MPU6050 and the LSM303DLHC magnetometer, since they are mentioned in the include file I posted a link to and I can get my hands on them. I'll dig more to see what I can find. I see there's some activity in I2C bus #2 at startup, but there's nothing connected to it in the board.

Many thanks

Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 10 guests