Go Down

Topic: GY-521 Accelerometer + Gyro (Read 642 times) previous topic - next topic

Rycco

Hello, in past days i bought new GY-521 sensor.
After a while of trying to get it work, I finally received some data from it. I used sketch from the website : http://playground.arduino.cc/Main/MPU-6050
But i dont think everythink is working properly.

I added some lines to print out the registers which were read from the GY-521.
You can have a look at it here  : http://pastie.org/8125686
Here is what i get over serial from board : http://pastie.org/8125717

I dont know why is this happening ... u can see the that the gyro y value is not changing although the registers value is changing.
Also the temperature changes when i lean the device.

Erdin

I smell something fishy.

If you do everything in the normal way, it probably works.

Check with a magnifier if the chip is actually the MPU-6050.
Use a normal Arduino board, like the Arduino Uno or Nano or Mega or so.
Download the newest Arduino software. Version 1.0.5 at the moment. Download it in a new folder, so I don't get mixed up with old things.
Don't install any other libraries.
Use the Arduino 5V pin to power the GY-521 Vcc.
Run the sketch and it will work (I think).

Don't change the sketch and show the output from the beginning (with WHO_AM_I byte and so).

Rycco

Ok, but how to make it work with DUE, its operating on 3,3V.
Sketch was not changed i just added few lines to the output to see more info.

Erdin

The DUE had a problem with the return value of endTransmission.
I don't know the status of that bug at the moment.

Can you tell me where the reference for Wire.setModule() is ?

Do you have an other Arduino board ?

Rycco

I have copy like due, ARM processor, operating voltage 3,3V
Wire.setModule just selects one of the I2C channels because my board have 4 of them.
Transmission is going good i can read who_am_i and receive 0x68.
Also i can read the registers with data like temp,accel,gyro but the numbers are little bit crazy :/ as you can see

Rycco

[SOLVED]

http://pastie.org/8127043

Sensor working very well.
The board integer was 4 byte long so i chaned the int definition in union to int16_t.
Working clearly now.

Go Up