I have read the different threads about the MPU 6050 so this will be another one of those.
This is the first time I use MEMS, so please bear with me.
I wanted to understand how to properly use accelerometer and gyroscope function and tried using some sample code. Errors after errors, I tried looking for another example which compiled: http://playground.arduino.cc/Main/MPU-6050
"MPU-6050 Short Example Sketch
By Arduino User JohnChi"
It compiled fine but when operating it, all the data I got was "-1" for every value.
Any idea why?
What seems weird in this code is that it does not referto any specific pin (neither digital nor analog in).
If you want to use a library for the job, I have gotten the MPU-6050 to work and i did it using the wonderful library provided by Jeff Rowberg, it is a well written and easy to use library which will allow you to get the most out of your MPU-6050 (also DMP support):
Using that library i got the MPU-6050 to work perfectly with the processing teapot demo, and for any application that i needed it for.
Steps to do:
1 ) make the the i2c_scanner detect it.
2 ) Run the Short Example Sketch that you mentioned.
3 ) Connect the interrupt and try to make the i2cdev as mentioned by TheHonestGuy work.
First the i2c_scanner has to detect it.
You should not tell us that you have wired it correctly, you should tell us how exactly you have wired it
Connect it like this:
Uno 5V pin to module VIN
Uno GND to module GND
Uno SDA (or A4) to module SDA
Uno SCL (or A5) to module SCL
You could make a photo of your wiring.
Do you have a very cheap Arduino Uno from Ebay ? They have sometimes missing traces or shortcuts on the board.
The I2C bus is for communication between chips inside an device. It was developed by Philips to be used inside their televisions. It became popular and many sensors have a I2C bus. The microcontroller on the Arduino Uno is the ATmega328P, which has a I2C bus on pin A4 and A5, and also on the extra pins (near the usb connecter) called 'SDA' and 'SCL'.
Haha, I just said that because I copied exactly the steps on the video.
I will give 2 images for the price of one:
Regarding the equipment, I bought everything off Robotshop. The Arduino seems genuine.
I think I get it now. If you want to communicate using I2C bus, you need to use A4 or A5 pins? I do not have any SDA and SCL pins near my USB (or at least none that I can see).
Thanks for the photos. I think everything is connected okay. If the i2c_scanner can not find it, then perhaps something is broken.
Do you have a multimeter (to measure the 5V input of the module and the 3.3V output of the voltage regulator on the module). Do you have a magnifier (to check the soldering of the MPU-6050 chip).
I thought I would check first the VIN (5 volt input) By putting 2 more wires (the blue one) in to measure the voltage in parallel (its a bit hard to put in the multimeter probes in a breadboard). I got 0V.
I don't think so. Measure the straightup square pins, the VIN and GND.
Or put extra wires in the breadboard, one for VIN and one for GND and measure those at the other end.
The voltage regulator is the little black smd component, with 2 pins on one side and 3 on the other. Measure the voltage of the pins, one of them should be 3.3V.
But I think I found the problem... the pins and not touching correctly the breadboard. When I hold them in place I get a big bright LED which shows it powers correctly.
Now it seems powered but I still get not I2C found.
Another weird thing. If I connect my uno my the MPU powered my compature can't find COM8...
Yes it can. Apparently it is only when I get power to the MPU6050 board that COM8 becomes unavailable. You also year the discintive "USB unplugging sound". I need to disconnect/reconnect the arduino and restart the arduino IDE. It starts working again.
Could it be that the USB can't provide enough power for both the MPU and the Arduino board?
The MPU-6050 requires very little current. The led on the module uses perhaps 10mA and the MPU-6050 sensor a lot less.
Something is wrong. Perhaps a damaged capacitor or broken sensor.