Jump to content
I2Cdevlib Forums


Popular Content

Showing most liked content since 01/21/2018 in all areas

  1. 1 point
    I have made an Arduino sketch that simplifies the task of calibrating the MPU6050's offsets. Easy steps: - Wire your MPU6050 to your Arduino. - Put the MPU6050 as horizontal as possible and leave it there, don't touch it. - Check the sketch in order to configure your MPU's I2C address (0x68 or 0x69). - Upload the sketch to your Arduino. - Open Arduino serial monitor and send any character to the Arduino. - Wait. - Write down your offsets for that particular MPU6050 and use them with library's functions "...setoffset..." in your projects. There are also a few options in the code in case you want to fine tune it. There may be bugs, or maybe it does not converge for everyone, so let me know your experience. I use it with an Arduino DUE, configured to 400KHz I2C bus speed, but I think you can use any Arduino and standard bus speed (100KHz). If people find it useful maybe Jeff can add it to the library once it is bugfree. Happy new year. UPDATE 30th January: New version 1.1 available. It fixes a bug related to variables overflowing in Arduinos other than the DUE. MPU6050_calibration_v1.1.zip
  2. 1 point
    The output of gyro goes to a max of 32,768. If its fine what is the sensitivity factor I must be using? setFullScaleGyroRange is also set to 250 dps. Not even sure if the output should be in this range And the Z axis gyro values are erratic. Could someone help me with that too! !!
  3. 1 point
    Michael Watts

    STM32 F4 I2CDevLib Port

    Was this ever taken forward? We're interested in this platform too.
  4. 1 point
    Hi sir, I am also using MPU6050 accelerometer and gyrometer with arduino UNO. I followed the wiring, VCC to 5v of arduino GND to GND of arduino SDA pin to A4 pin of arduino SCL pin to A5 pin of arduino AD0 to GND of arduino INT to Pin 2 of arduino And I ran I2C scanner code which is given here : http://playground.arduino.cc/Main/I2cScanner But it is not detecting the address. Which is 0x68 default, given in the manual. And when I dump other code to detect the X Y X axes of accelerometer and gyrometer, it is giving only -1 value. Please help me out.
  5. 1 point

    STM32 F4 I2CDevLib Port

    i am working on a project "Evaluation of a 3 axis accelerometer and gyroscope".I just have the theoretical knowledge about I2C and all other related aspects regarding this project but i am new to the programming and have no idea how to start the coding part.Here is the short description of my project. I have STM32F407 microcntroller board and GY521 breakout board(MPU6050) my microcontroller acts as a master and mpu 6050 acts as a slave and interfacing has to be done to establish the so called "communication"between these two via I2C bus and code has to be written in software Cocoox Coide MPU 6050 consists of accelerometer and gyroscope sensors which reads sensor values....when interfacing is done.....This is what the project is all about.So could you please help me in coding
  6. 1 point
    Hi Ben, The numbers you are seeing appear to be all multiples of 4. This is extremely unlikely in a real-world situation, and makes me think that the way you are reading registers and/or converting data for storage in your variables has a problem with (1) register read orders, (2) byte orders, or (3) bit orders. Or, possibly, you are shifting values somehow after reading them. The various ACCEL_*OUT_H/L registers each contain 8 bits of the 16-bit raw sensor value. The _H register is the high byte (MSB), and the _L register is the low byte (LSB). If you read them independently and combine them, then you should store them into a signed 16-bit integer container something like this: int16_t accel_x = (ACCEL_XOUT_H << 8) + ACCEL_XOUT_L; Is this what you are doing, or something very close anyway?
  7. 0 points
    I am not sure I am correct or not but Integration of angular velocity should give you static angle right?
  8. 0 points
    hi jeff! Shame Include me in this topic with questions rather than answers, electromechanical engineering student I am, I am Colombian, from there the reason for my writing. AM Working with the MPU 6050 and I want to ask if possible control by an FPGA, a Spartan 3e exactly, I researched on the web but I always find that when using this sensor with arduino, or through microcontrollers, I have able to find information (FPGA + MPU6050) Sorry for the inconvenience, I hope I can collaborate, thank you very much.
  9. 0 points
    hola jeff! que pena incluirme en este tema con preguntas en vez de soluciones, soy estudiante de ingeniería electromecánica, soy colombiano, de ahí el porque mi escritura. estoy trabajando con el mpu 6050 y quisiera preguntarte si es posible controlarlo por medio de una FPGA, exactamente una Spartan 3e, he investigado en la web pero siempre me encuentro con que el sensor se controla por arduino o por micro controladores. disculpa la molestia, espero me puedan colaborar, muchas gracias
  10. 0 points
    Sir, I used the MPU 6050 program from Github...its strange that all my a/g values shows zero ....dont know whether its a communication program or problem with my library please help me out as i am new to this. the program i used is: #include "Wire.h" #include "DebugUtils.h" // I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files // for both classes must be in the include path of your project #include "I2Cdev.h" #include "MPU60X0.h" #include <SPI.h> // class default I2C address is 0x68 // specific I2C addresses may be passed as a parameter here // AD0 low = 0x68 (default for InvenSense evaluation board) // AD0 high = 0x69 MPU60X0 accelgyro; int16_t ax, ay, az; int16_t gx, gy, gz; #define LED_PIN 13 bool blinkState = false; void setup() { // join I2C bus (I2Cdev library doesn't do this automatically) Wire.begin(); // initialize serial communication // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but // it's really up to you depending on your project) Serial.begin(38400); // initialize device Serial.println("Initializing I2C devices..."); accelgyro.initialize(); // verify connection Serial.println("Testing device connections..."); Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed"); // configure Arduino LED for pinMode(LED_PIN, OUTPUT); } void loop() { // read raw accel/gyro measurements from device accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); // these methods (and a few others) are also available //accelgyro.getAcceleration(&ax, &ay, &az); //accelgyro.getRotation(&gx, &gy, &gz); // display tab-separated accel/gyro x/y/z values Serial.print("a/g:\t"); Serial.print(ax); Serial.print("\t"); Serial.print(ay); Serial.print("\t"); Serial.print(az); Serial.print("\t"); Serial.print(gx); Serial.print("\t"); Serial.print(gy); Serial.print("\t"); Serial.println(gz); // blink LED to indicate activity blinkState = !blinkState; digitalWrite(LED_PIN, blinkState); }
  11. 0 points
    Hi Jeff , sorry to reopen this post... I am a french student in an engeneering school and I am using the crius aiop v2 on my robot. On this board there is an MPU6050 and I am communicating with it thanks to your code. I tested a lot of codes like the one on arduino playground and the one of Kristian Lauszus with the Kalman filter. However I am still having big issues with this sensor... Correct me if I am wrong but when I am reading the raw data for the accelerometer I am supposed to get for x, y and z : 0 , 0 and 0.98 right ? However when I am just reading the right registers (my sensor is put still on my desk) I am getting those values instead : accX accY accZ 8324.00 4768.00 14496.00 8208.00 4768.00 14536.00 8216.00 4704.00 14296.00 8288.00 4684.00 14608.00 8356.00 4724.00 14464.00 8372.00 4784.00 14588.00 8280.00 4736.00 14408.00 8332.00 4748.00 14356.00 Since I am using your code, the sensor is set on a scale range of +/-2g which means that the sensitivity of the accelerometer is of 16384 LSB/g. I know that to understand the raw datas I need to divide them with the sensitivity and get something near 0, 0, 0.98 even if there is an error. However with the values I am having it is no where near from what it should be... I tried the code from arduino playground and I am having the same raw datas, the same thing with the Kalman filter... There are a lot of guides but I must be missing something... I am just reading the right registers but those raw datas doesn't make any sense at all... So I would like to know if you think those datas are strange and if you happened to find something similar, I happened to find some talk on the internet which says that there is a version of the MPU6050 that doesn't have the same scale ranges and not the same sensitvities... I don't think I have that much of bad luck... Thank you for your help, Ben.
  12. 0 points
    Hi @vrutangs, The accelerometer and gyroscope measurements are explained in the MPU-6050 datasheet in the GYRO_CONFIG and ACCEL_CONFIG register descriptions (sections 4.4 and 4.5 on pages 14 and 15). The scale of each depends on the sensitivity settings chosen, which can be one of +/- 2, 4, 8, or 16g for the accelerometer and one of +/- 250, 500, 1000, or 2000 deg/sec for the gyroscope. The accelerometer produces data in units of acceleration (distance over time2), and the gyroscope produces data in units of rotational velocity (rotation distance over time). The output scale for any setting is [-32768, +32767] for each of the six axes. The default setting in the I2Cdevlib class is +/- 2g for the accel and +/- 250 deg/sec for the gyro. If the device is perfectly level and not moving, then: X/Y accel axes should read 0 Z accel axis should read 1g, which is +16384 at a sensitivity of 2g X/Y/Z gyro axes should read 0 In reality, the accel axes won't read exactly 0 since it is difficult to be perfectly level and there is some noise/error, and the gyros will also not read exactly 0 for the same reason (noise/error).