OpenMarine

Full Version: How to connect MPU9250
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I bought an mpu9250, one just like this:
[attachment=2098]

I have 2 questions really:

  1. How do I wire it up to the Raspberry Pi.
    I have seen some that are straight SCL to SCL (pin3) and SDA to SDA (pin2) and then a GND and 3.3V from pin1.
    https://medium.com/@niru5/hands-on-with-...2378fa6dbc

    I have also seen a connection that has ECL to SCL and EDA to SDA.
    https://makersportal.com/blog/2019/11/11...gnetometer

    Which is the correct one?

  2. How do I get the compass data into SK?Does it go directly? I saw someone here saying that did it through PyPilot. Do I need to do that?

Can you, please, point me to a how-to or an existing thread?

Many thanks,
Yiannis
just look here: https://pinout.xyz/pinout/i2c

you must use openplotter pipilot plugin, it should see it automaticaly and then switch to compass.
then calibrate button.

good luck
holger
(2023-03-23, 10:06 PM)holgerw Wrote: [ -> ]just look here: https://pinout.xyz/pinout/i2c

you must use openplotter pipilot plugin, it should see it automaticaly and then switch to compass.
then calibrate button.

good luck
holger

Thank you for the repsonse.

I connected it correctly. I can see this in the terminal:
Code:
sudo i2cdetect -y 1
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                        

And I2C shows the same:
[attachment=2099]

GPIO Map shows it too:
[attachment=2101]

But PyPilot cannot see the IMU anyway:
[attachment=2100]

And in calibration nothing changes on the screen, no matter what I do to the IMU:
[attachment=2102]

But I can see the data from PyPilot in SingalK, so at least that's something. It's just that they are all ZEROS.
[attachment=2103]

Any other ideas?

TIA,
Yiannis
ok, there is no data from your IC-sensor, only the IC Adress is recognized by i2c scanning.
The Problem is now somewhere in the PiPilot Plugin or your sensor.

my pipilot plugin (without pilot HAT) shows this:
[attachment=2104]

so your sensor is not recognized. sorry for this. 
if you have spare esp8266 available you could burn tasmota on it and try your sensor on this system to check if it is defective. 

but for now i would try another of these cheap sensors from another brand.

eventually you may dig into the hardware requirements of the pipilot plugin software on github to find if your sensor chip (printed on the ic) is supported. Maybe it is simply defective or faked (but i don´t believe this). 

Holger

PS: about the SK data (all zeros) - the OP-plugin makes automatically an path to SK, even if it is not filled with correct data ;-)
(2023-03-23, 11:49 PM)holgerw Wrote: [ -> ]ok, there is no data from your IC-sensor, only the IC Adress is recognized by i2c scanning.
The Problem is now somewhere in the PiPilot Plugin or your sensor.

my pipilot plugin (without pilot HAT) shows this:


so your sensor is not recognized. sorry for this. 
if you have spare esp8266 available you could burn tasmota on it and try your sensor on this system to check if it is defective. 

but for now i would try another of these cheap sensors from another brand.

eventually you may dig into the hardware requirements of the pipilot plugin software on github to find if your sensor chip (printed on the ic) is supported. Maybe it is simply defective or faked (but i don´t believe this). 

Holger

PS: about the SK data (all zeros) - the OP-plugin makes automatically an path to SK, even if it is not filled with correct data ;-)

Hi Holger,

Thanks for your help. I was suspecting incompatible or defective IMU, so you have somehow confirmed my suspicions. I have put an order for some inexpensive ones just to experiment on my "bench".

If I find a cheap one that does the job relatively OK, I will use it on the boat. If not, I will se what I will do.

I will update when I have more results; at least now I know what I am looking for.

Thanks for your time,
Yiannis
Your MPU-92/65 contains two separate chips - an MPU6050 accelerometer/gyro (address 0x68) and an AK8963 compass (address 0x0C).

Most MPU9250 boards have a single I2C connection to both MPU6050 and AK8932 in parallel. But yours has separate connections - SCL/SDA to MPU6050 and ECL/EDA to AK8932.

Since you haven't connected anything to ECL/EDA, your compass isn't detected at 0x0C. So you need to add 2 extra wires connecting SCL to ECL and SDA to EDA.
This is Good News, i Hope it will help Others 2.
(2023-03-24, 01:04 AM)TVR Wrote: [ -> ]Your MPU-92/65 contains two separate chips - an MPU6050 accelerometer/gyro (address 0x68) and an AK8963 compass (address 0x0C).

Most MPU9250 boards have a single I2C connection to both MPU6050 and AK8932 in parallel. But yours has separate connections - SCL/SDA to MPU6050 and ECL/EDA to AK8932.

Since you haven't connected anything to ECL/EDA, your compass isn't detected at 0x0C. So you need to add 2 extra wires connecting SCL to ECL and SDA to EDA.

Hi TVR,

I tried it yesterday, but I also tried it again today, and I only see the 0x68 address detected. I even tried connecting only the ECL, EDA to see if it makes any difference, but no.

I believe that PyPilot reads data from the accelerometer and gyro, too. So I should be seeing something there, but there is nothing. Still, thanks for your input.

Regards,
Yiannis
Your Board uses is really old chips, so maybe better get an newer one:

1. Ouick Alternative to try: set it to the other I2C Adresse 0x69 by grounding the AD0 line. Maybe this will help to get it recognized by pipilot.
You have only one I2C Chip on your Board, the little one is only an VoltageRegulator for 3,3 V.

2. Get an more modern/acurate IMU-Chip, this sometimes has also more Sensors on Board.
What is the alternative for MPU-6050?
The alternatives you can use in place of the MPU6050 include the following:
ADXL335 (3-axis accelerometer)
ADXL345 (3-axis accelerometer)
MPU9250 (9-axis IMU) +++
i would go for the last one.....

3. Try your chip on an esp8266 with this "ESP Easy" Program to check it. Use only the normal SDA/SCL Lines.
You could interface this ESP with Signal K via WiFi and JSON Commads later.

Here is some more Info, https://www.letscontrolit.com/wiki/index.php/MPU6050
---------------------
The board will default to address 0x68. Ground pin AD0 for the alternate address of 0x69 (on the GY-521 the address pin has a pull-up resistor to Vcc).
The pins XCL, XDA and INT are not used and can be left unconnected.
---------------------


Holger
(2023-03-24, 01:13 PM)holgerw Wrote: [ -> ]Your Board uses is really old chips, so maybe better get an newer one:

1. Ouick Alternative to try: set it to the other I2C Adresse 0x69 by grounding the AD0 line. Maybe this will help to get it recognized by pipilot.
    You have only one I2C Chip on your Board, the little one is only an VoltageRegulator for 3,3 V.

2. Get an more modern/acurate IMU-Chip, this sometimes has also more Sensors on Board.
    What is the alternative for MPU-6050? 
    The alternatives you can use in place of the MPU6050 include the following:
    ADXL335 (3-axis accelerometer)
    ADXL345 (3-axis accelerometer)
    MPU9250 (9-axis IMU) +++
    i would go for the last one.....

3. Try your chip on an esp8266 with this "ESP Easy" Program to check it. Use only the normal SDA/SCL Lines.
You could interface this ESP with Signal K via WiFi and JSON Commads later.

Here is some more Info, https://www.letscontrolit.com/wiki/index.php/MPU6050
---------------------
The board will default to address 0x68. Ground pin AD0 for the alternate address of 0x69 (on the GY-521 the address pin has a pull-up resistor to Vcc).
The pins XCL, XDA and INT are not used and can be left unconnected.
---------------------


Holger

Hi,

I don't have an ESP8266; I want to order one. I am not familiar with it at all, I read that it is a WiFi chip, but I guess I connect via a serial (USB) interface to it. Sorry to sound like an idiot, but is this is OK? https://www.amazon.co.uk/dp/B07GYW4T5F/

In other news, I got 2 different IMUs and again they don't seem to be working.

First one is this:
https://www.amazon.co.uk/dp/B09FGHHHKL

The other is this:
https://www.amazon.co.uk/dp/B07TZJK43F
Which has a very unusual (I think) address of 0X0d

While I have been testing these I noticed this in System Check. Are these normal?
[attachment=2110]

Thanks for your help,
Yiannis
Pages: 1 2