MPU-6050-based gyro to U3 IO Shield?

Post Reply
DNZ
Posts: 13
Joined: Tue Jan 21, 2014 10:09 pm
languages_spoken: english, russian
ODROIDs: ODROID-U3
Contact:

MPU-6050-based gyro to U3 IO Shield?

Unread post by DNZ » Thu Jan 23, 2014 9:35 pm

How I can connect MPU-6050-based gyro (GY-87) to my ODROID-U3 IO Shield? What should be changed in the Android kernel configuration?

mdrjr
Site Admin
Posts: 11698
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by mdrjr » Thu Jan 23, 2014 9:42 pm

Connect the MPU-6050 to the arduino pins of the shield.
And program the arduino inside the odroid.

Google is your friend.
http://playground.arduino.cc/Main/MPU-6050

DNZ
Posts: 13
Joined: Tue Jan 21, 2014 10:09 pm
languages_spoken: english, russian
ODROIDs: ODROID-U3
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by DNZ » Thu Jan 23, 2014 9:53 pm

No, this way is not interesting. Yes, of course, under Arduino, I can get access to many digital or analog sensors.
I need to mpu6050 used as the default sensor for Android. As an example, in Odroid-Q2.

mdrjr
Site Admin
Posts: 11698
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by mdrjr » Thu Jan 23, 2014 10:20 pm

https://docs.google.com/file/d/0B5aZmgm ... V5OGs/edit

U3 schematics. Refer to the i2c pins on the 8-pins expasion to know where's the i2c pins and connect your sensor to the i2c pins.
Note that the MPU-6050 supports 1.8V logic and the direct i2c from the SoC is 1.8V logic.
If you are using a breakout board make sure there's no level shift between those.

You'll need to provide the kernel drivers and android hal implementation for such.

DNZ
Posts: 13
Joined: Tue Jan 21, 2014 10:09 pm
languages_spoken: english, russian
ODROIDs: ODROID-U3
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by DNZ » Mon Feb 24, 2014 7:13 pm

Well, I have a working mpu6050 module under Android.

I bought a GM-521 module and modify it for use VLOGIC:

http://alterterra.ru/images/Car/mpu6050_front_1.jpg
http://alterterra.ru/images/Car/mpu6050_rear_1.jpg

AD0 pin used as VLOGIC, and connected to 1.8V. SCL connected to GPX 1.0, SDA connected to GPX1.1, INT connected to GPX1.5 (8 pin connector).

Next, I modify arch/arm/mach-exynos/mach-odroid-u.c:

Code: Select all

907,963d905
< 
< 
< ///////////////////////////////////////////////////////
< #define		GPIO_I2C8_SDA	EXYNOS4_GPX1(1)
< #define		GPIO_I2C8_SCL	EXYNOS4_GPX1(0)
< 
< static struct 	i2c_gpio_platform_data 	i2c8_gpio_platdata = {
< 	.sda_pin = GPIO_I2C8_SDA,   // gpio number
< 	.scl_pin = GPIO_I2C8_SCL,
< 	.udelay  = 5,               // 100KHz
< 	.sda_is_open_drain = 0,
< 	.scl_is_open_drain = 0,
< 	.scl_is_output_only = 0
< };
< 
< static struct 	platform_device 	i2c8_gpio_device = {
< 	.name 	= "i2c-gpio",
< 	.id  	= 8,    // adepter number
< 	.dev.platform_data = &i2c8_gpio_platdata,
< };
< 
< //////////////////////////////////////////////////////
< 
< #if defined(CONFIG_MPU_SENSORS_MPU6050B1)
< #include	<linux/mpu.h>
< static	struct	mpu_platform_data	mpu6050_data = {
< 	.int_config		= 0x10,
< 	.level_shifter	= 0,
< 	.orientation	= {
< 		 0  +1,  0,
< 		+1,  0,  0,
< 		 0,  0, -1
< 	},
< };
< #endif	// #if defined(CONFIG_MPU_SENSORS_MPU6050B1)
< 
< static struct i2c_board_info i2c_devs8[] __initdata = {
< #if defined(CONFIG_MPU_SENSORS_MPU6050B1)
< 	{
< 		I2C_BOARD_INFO("mpu6050", (0x68)),
< 		.irq = EXYNOS4_GPX1(5),
< 		.platform_data = &mpu6050_data,
< 	},
< #endif	// #if defined(CONFIG_MPU_SENSORS_MPU6050B1)
< };
< 
< ////////////////////////////////////////////////////////
971d912
< 
1140,1142d1080
< //////////
<     &i2c8_gpio_device,
< /////////
1813,1817c1751
< /////////////////////////////////////////////////////////////////////
< 	i2c_register_board_info(8, i2c_devs8, ARRAY_SIZE(i2c_devs8));
< /////////////////////////////////////////////////////////////////////
Next I make menuconfig, and add MPU6050B1 (Device Drivers->Misc devices->MPU Timer IRQ, Motion Processing Unit, MPU6050B1 Gyroscope and Accelerometer slave sensor)

I modify drivers\misc\inv_mpu\mldl_cfg.c

Code: Select all

static struct prod_rev_map_t prod_rev_map[] = {
	/* prod_ver = 0 */
	{MPL_PROD_KEY(0,  1), MPU_SILICON_REV_A2, 131, 16384},
.
.
.
	{MPL_PROD_KEY(40, 19), MPU_SILICON_REV_B1, 131, 16384},	/* (B5/E2)   */
//
	{MPL_PROD_KEY(40, 41), MPU_SILICON_REV_B1, 131, 16384},	/* (B5/E2)   */		
//
	{MPL_PROD_KEY(41, 19), MPU_SILICON_REV_B1, 131, 16384},	/* (B5/E2)   */
	{MPL_PROD_KEY(42, 19), MPU_SILICON_REV_B1, 131, 16384}	/* (B5/E2)   */		
};
Rebuild kernel, and install it.

root@android:/# i2cdetect -y -a 4
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
root@android:/#

I see /dev/mpu, /dev/mpuirq, /dev/timerirq, and /dev/accirq

Next, I rebuild hardware/invensense libsensor lib from BSP (mpu3050.h replaced by mpu6050b1.h from kernel, and mldl_cfg.c, mldl_cfg.h )

Code: Select all

OUT_DIR=/media/dnz/sd_root/lib
cp out/target/product/odroidu/obj/lib/libinvensense_hal.so $OUT_DIR/libinvensense_hal.so
cp out/target/product/odroidu/obj/lib/libmllite.so $OUT_DIR/libmllite.so
cp out/target/product/odroidu/obj/lib/libmlplatform.so $OUT_DIR/libmlplatform.so
cp out/target/product/odroidu/obj/lib/libmplmpu.so $OUT_DIR/libmplmpu.so
cp out/target/product/odroidu/obj/lib/sensors.odroidu.so $OUT_DIR/hw/sensors.odroidu.so
http://www.youtube.com/watch?v=yYpaIvd4YwM&hd=1

User avatar
odroid
Site Admin
Posts: 30050
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by odroid » Tue Feb 25, 2014 8:51 am

Oh.. You made it very quickly.
An impressive video on Youtube!
Thank you for the sharing. :D

I want to play some car racing games with the gyros and accelerometers in the MPU-6050. :twisted:

User avatar
sert00
Posts: 745
Joined: Sun Feb 24, 2013 12:26 am
languages_spoken: english,italian
ODROIDs: ODROID-U2*2__ODROID-U3__ODROID-XU-E__ODROID-XU-Ebeta__ODROID-C1__ODROID-XU4
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by sert00 » Tue Feb 25, 2014 10:07 am

Can you elaborate about why you modified the gyro in first part?i'm curious to know if was impossible to reach your goal without the modifies..thanks
great work dude! :)
2x Odroid-U2
2x Odroid-XU-E
Odroid-U3
Odroid-C1+
Odroid-XU4
Lcd touch panel 10.1"
....and many of the goodies available....

DNZ
Posts: 13
Joined: Tue Jan 21, 2014 10:09 pm
languages_spoken: english, russian
ODROIDs: ODROID-U3
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by DNZ » Tue Feb 25, 2014 12:25 pm

sert00 wrote:Can you elaborate about why you modified the gyro in first part?i'm curious to know if was impossible to reach your goal without the modifies..thanks
great work dude! :)

All modules (GY-87 and GM-521) work with 3.3v and 5v logic levels, but U3 have 1.8. MPU-6050 can work with 1.8 logic levels, but needed some change in module - connect pin VLOGIC and pullup resistors (SDA and SCL)to 1.8v. After this modification, module work with more levels, I connect for testing this module to Arduino vith 3.3 v. GI87 correctly modify not happened, with GM-521 make it a lot easier.

User avatar
memeka
Posts: 4244
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by memeka » Tue Feb 25, 2014 1:02 pm

DNZ, my sensors are also 3.3v or 5v. I've used this: http://www.freetronics.com/products/log ... ter-module
I connected 5v (from odroid source) to Hi-V, set up a GPIO to ouput "1" (1.8v) and connected it to Lo-V, and that's it - the converter gives me 4 logic I/O at 1.8v.

DNZ
Posts: 13
Joined: Tue Jan 21, 2014 10:09 pm
languages_spoken: english, russian
ODROIDs: ODROID-U3
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by DNZ » Tue Feb 25, 2014 1:45 pm

memeka wrote:DNZ, my sensors are also 3.3v or 5v. I've used this: http://www.freetronics.com/products/log ... ter-module
I connected 5v (from odroid source) to Hi-V, set up a GPIO to ouput "1" (1.8v) and connected it to Lo-V, and that's it - the converter gives me 4 logic I/O at 1.8v.
Yes, it is the right decision. Unfortunately, I have not found such a converter levels in our stores, but wait a couple of weeks does not suit me ...

DNZ
Posts: 13
Joined: Tue Jan 21, 2014 10:09 pm
languages_spoken: english, russian
ODROIDs: ODROID-U3
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by DNZ » Wed Mar 12, 2014 8:38 pm

I need some help... I buy logic level converter module and GY-88 module (mpu6050, hcl5883 and bmp085). But after power on or restart, sensors not working.

root@android:/# i2cdetect -y -a 8
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
root@android:/#

When I disconnect +5v from Hi-V and Sensor module and reconnect it, I can see sensors under i2cbus:

root@android:/# i2cdetect -y -a 8
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1e --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77 -- -- -- -- -- -- -- --
root@android:/#

I reboot Android, and after:

root@android:/# i2cdetect -y -a 8
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
root@android:/#


Some problems when i2c-gpio initialization?

Iraro
Posts: 14
Joined: Fri May 11, 2018 7:01 pm
languages_spoken: english
Contact:

Re: MPU-6050-based gyro to U3 IO Shield?

Unread post by Iraro » Thu Jun 14, 2018 4:40 pm

how do i interface MPU6050 (GY-521) with odroid xu4(i don't have the shield) ?

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 2 guests