comeng18
Posts: 2
Joined: Sat Jan 13, 2018 6:14 pm

(Solved) I2c device not found (MPU6050)

Sat Jan 13, 2018 6:58 pm

Hello
I work to use MPU6050. I'm using this library https://github.com/richardghirst/PiBits ... 50-Pi-Demo but it says " Failed to open device: No such file or directory" but ı scan ı2c device ı look it in 0x68 . I worked very much for solving this problem but ı didn't it.

I updated this code. It is work
https://github.com/Comeng18/MPU6050
Last edited by comeng18 on Mon Jan 15, 2018 3:29 pm, edited 1 time in total.

fivdi
Posts: 203
Joined: Sun Sep 23, 2012 8:09 pm
Contact: Website

Re: I2c device not found (MPU6050)

Sat Jan 13, 2018 7:38 pm

The code linked to was written quite a long time ago and looks like it was implemented for a Raspberry Pi 1. The code assumes that the I2C bus can be accessed using /dev/i2c-0. On a more recent Pi like the Zero, 2 or 3 this is not the case and /dev/i2c-1 should be used.

For example, see
https://github.com/richardghirst/PiBits ... v.cpp#L175
https://github.com/richardghirst/PiBits ... v.cpp#L347
https://github.com/richardghirst/PiBits ... v.cpp#L394

If this code is updated to use /dev/i2c-1 rather than /dev/i2c-0 it may work.

comeng18
Posts: 2
Joined: Sat Jan 13, 2018 6:14 pm

Re: I2c device not found (MPU6050)

Mon Jan 15, 2018 3:27 pm

fivdi wrote:
Sat Jan 13, 2018 7:38 pm
The code linked to was written quite a long time ago and looks like it was implemented for a Raspberry Pi 1. The code assumes that the I2C bus can be accessed using /dev/i2c-0. On a more recent Pi like the Zero, 2 or 3 this is not the case and /dev/i2c-1 should be used.

For example, see
https://github.com/richardghirst/PiBits ... v.cpp#L175
https://github.com/richardghirst/PiBits ... v.cpp#L347
https://github.com/richardghirst/PiBits ... v.cpp#L394

If this code is updated to use /dev/i2c-1 rather than /dev/i2c-0 it may work.
Thank you so much. I updated this code. It is work
https://github.com/Comeng18/MPU6050

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 3 guests