MPU6000 SPI help

Hello,

I am making my final degree project. It is a bycicle telemetry system (if it finally work i will share my work wit you :sob: )

I bought a drotek MPU6000 sensor that works with SPI and i am having big troubles to make it works. Sincerly, I don’t know a lot about SPI communication an this could be my problem maybe.

To make it work i am using this code: http://diydrones.com/forum/topics/find-here-working-arduino-sketch-for-mpu-6000-arduimu-v3-using

For now, i am only getting illegible letters from the monitor serial. Something like this: ú„¬îpúÀñîp’šgê “›Sgú-5!ú<š•šš_,ß>Jž;Fn<œ9
æŸ9a4Ú4RS®ÒöڄS®púÀñîp’šgè “›S’ú-5!ú|š•šš,ß~Jž;Fnœ9
æŸ9aœ4áŸq¦¹¤öÚ!£! eփš)àÙ8gè “›S’ú
5!ú|š”šš,ß~žž{Fnœ9fŸ¼9aœ4áŸq¦™¤öÚ!£! eփš)àÙ8gè “›S’ú
M }»<ša{˜¬êpúÀñîp’›gê “›Sgú-5!,š•šš_,ß.Nž;Fn<œ9
æŸ94Ú4RS®Ðþú„¬êpúÀñîp’šgê “›Sgú-5!ú,š•šš_,ß.Jž;Fn<œ9 æŸ9a4Ú4RS®ÒöڄS®púÀñîp’šgè “›S'ú-5!ú|š”šš,ß~Jž;Fnœ9 æŸ9aœ4áŸq¦¹¤öÚ!£! eփš)àÙ8gè “›S'ú 5!ú|š”šš,ß~žž{Fnœ9fŸ¼9aœ4áŸp¦™¤öÚ!£! e:˜qîpÒ­ìè “›S'ú M }»<ša{˜¬êpúÀñîp’šgê “›Sgú-5!,š•šš_,ß.Jž;Fn<œ9 æŸ94Ú4RS®ÒþڄS®púÀñîp’šgê “›S’ú-5!ú|š•šš,ß~Jž;Fnœ9
æŸ9aœ4áŸq¦¹¤öÚ!£! eփš)àÙ8gè “›S’ú
5!ú|š”šš,ß~žž{Fnœ9fŸ¼9aœ4áŸq¦™¤öÚ!£! eփš)àÙ8gè “›S’ú
M }»<ša{˜¬êpúÀñîp’šgê “›Sgú-5!,š•šš_,ß.Jž;Fn<œ9
æŸ9`4Ú4RS®ÒþڄS®púÀñîp’šgê “›S’ú-5!ú|š•šš,ß~Jž;Fnœ9
æŸ9aœ4áŸq¦¹¤öÚ!£! eփš)àÙ8gè “›S’ú

There is a way to check if the sensor is working correct? Could you help me with some reference to learn about SPI? I am really sorry for make a very general question but I am absolutely messed up.

Sorry for my english and thanks in advance.

Look in the sketch for this line : Serial.begin(115200) ; That means you have to set the serial monitor to 115200 baud (it is on the lower right of the window).

Thank you Peter!

It was such an error! Now I am able to read something but as I thought something in the sensor is not working fine.

The new monitor serial messages are like this:

############# MPU-6000 Data Acquisition #############
Initializing SPI Protocol…
…SPI Protocol initializing done.

Initializing Digital Motion Processor (DMP)…
Writing DMP memory… done.
Verifying DMP memory… $$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error
$$$ dmpMemory: byte verification error

If it can help I attach my wiring.

Thanks!

Thanks for the photo.

I don't have a MPU-6000 myself, and I have not used that library, but I assume the library is working. You have a 3.3V sensor and a 5V Arduino. However, the MPU-6000 many not get 5V on any of the pins. It might already be damaged (in many cases, a few minutes didn't hurt the sensors).

Could you try to fix that ? I think that module has a 3.3V voltage regulator and the input voltage is the VCC pin ? In that case please use 5V to VCC. When you apply 3.3V to VCC, the voltage regulator output could be 3.2V. With 5V to VCC it is 3.3V and that is better for the SPI bus. The MOSI and ChipSelect signal of the SPI (output of Arduino, input of sensor) may never be 5V. You have to use two resistors per Arduino output pin to lower the voltage. Google for the proper values, perhaps 1k5 and 2k7 (1k5 from Arduino output, 2k7 to GND, the middle point to sensor). The Arduino input (MISO) gets the 3.3V signal from the sensor. That should be enough for the Arduino to see a HIGH level.

Instead of 4 resistors, you can buy a level shifter module that can be used for the SPI bus.

Another option is to use a 3.3V Arduino board. Like the Pro Mini 8MHz 3.3V version.

Thank you Peter_n,

As you said, the problem was that the drotek breakout board needs pullup resistors to work. I finally made it work with the i2c communication because there are a lot of info out there because it works exactly as the MPU6050.

My new problem is that i don't get accurate angles. When the yaw angle is 45 degrees the programm indicates 30-28. I'm using the Jeff Rowberg library.