Jump to content
I2Cdevlib Forums

Search the Community

Showing results for tags 'mpu6050'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • I2Cdevlib Web Tools
    • I2C Protocol Analyzer
    • I2C Device Entry Interface
    • I2C Device Library API
  • I2Cdev Platform Discussion
    • Arduino (ATmega)
    • Arduino Due (ARM Cortex M3)
    • MSP430
    • Other Platforms
  • I2C Device Discussion
    • AD7746 capacitance-to-digital converter (Analog Devices)
    • ADS1115 16-bit A/D converter (Texas Instruments)
    • ADXL345 3-axis accelerometer (Analog Devices)
    • AK8975 3-axis magnetometer (AKM Semiconductor)
    • BMA150 3-axis accelerometer (Bosch Sensortec)
    • BMP085 pressure sensor (Bosch Sensortec)
    • DS1307 real-time clock (Maxim)
    • HMC5843 3-axis magnetometer (Honeywell)
    • HMC5883L 3-axis magnetometer (Honeywell)
    • iAQ-2000 indoor air quality sensor (AppliedSensor)
    • IQS156 ProxSense capacitive touch sensor (Azoteq)
    • ITG-3200 3-axis gyroscope (InvenSense)
    • L3G4200D 3-axis accelerometer (STMicroelectronics)
    • MPL3115A2 Xtrinsic Smart Pressure Sensor (Freescale)
    • MPR121 12-bit capacitive touch sensor (Freescale)
    • MPU-6050 6-axis accelerometer/gyroscope (InvenSense)
    • MPU-9150 9-axis accelerometer/gyroscope/magnetometer (InvenSense)
    • PanelPilot multi-screen digital meter (Lascar Electronics)
    • SSD1308 128x64 OLED/PLED driver (Solomon Systech)
    • TCA6424A 24-bit I/O expander (Texas Instruments)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







  1. I am using arduino leonardo to serially print the raw data from the mpu6050 example given alongwith its library.But after around 10 seconds, it stops sending data....please help
  2. 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
  3. Hello everyone. I'm quite new to Arduino and i2c so please bear with me even if my questions may have an obvious answer from your point of view. Looking at the example of 6 axis MPU 6050 I'm trying to wrap my head around some programming decision that was made, specifically: 1) Why do we run while loop while (!mpuInterrupt && fifoCount < packetSize) { inside the main Arduino loop() instead of just simply running single interrupt flag and fifoCount check each iteration of the loop(), is that to catch new data package as absolutely soon as possible? 2) Why do we use interrupt at all, can't we just check getFIFOCount() and if > packetSize - retrieve data. I've modified the example to do just that and it seems that data is still fine, nothing borked e.t.c. I might be missing the whole point of using interrupts here, please clarify this for me if possible. Thanks in advance!
  4. #ifdef OUTPUT_READABLE_WORLDACCEL #ifdef OUTPUT_READABLE_WORLDACCEL // display initial world-frame acceleration, adjusted to remove gravity // and rotated based on known orientation from quaternion mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q); Serial.print("aworld\t"); Serial.print(aaWorld.x); Serial.print("\t"); Serial.print(aaWorld.y); Serial.print("\t"); Serial.println(aaWorld.z); #endif I want to ask that what is the unit of above aaWorld values ? I understand that if i need to get the acceleration without gravity i need to use these values , but the values that we get from these are in m/s^2? or do i need to do something acc_in_ms2=(aaWorld.x*9.8)/16384.0 ? or something else. my offset are as follows mpu.setXGyroOffset(220); mpu.setYGyroOffset(76); mpu.setZGyroOffset(6); mpu.setZAccelOffset(1262); and my output is as follows without doing any changes in code provided after 10-15 sec (the sensor is horizontal) aworld 0 28 60 aworld -1 29 40 aworld 5 29 33 aworld 6 24 20 aworld 2 23 22 aworld -4 13 26 aworld -6 11 28 aworld -10 11 30 aworld -15 5 38 aworld -7 -1 36 aworld 7 -4 37 aworld 7 0 33 aworld 4 5 29 aworld 0 2 30 aworld -3 -7 35 seems coreect all the values converging to zeros.. but when i move the sensor in one direction , i get totally unexpected values.. aworld -415 -306 304 aworld -505 -277 318 aworld -577 -270 399 aworld -587 -207 265 aworld -572 -166 63 aworld -589 -200 -28 aworld -631 -258 -7 aworld -638 -292 30 aworld -637 -334 29 aworld -647 -404 -23 aworld -640 -483 -75 aworld -611 -542 -72 aworld -633 -503 -24 aworld -723 -344 17 aworld -816 -125 36 aworld -908 72 1 aworld -988 241 -45 aworld -1015 378 -68 I am moving the sesor only to and fro in one direction but i am getting these values Why so? please help if you have any information /knowledge about this... I want acceleration mithout gravity affect in m/s^2
  5. Question above. Also, is it possible to read the angular rate (only gyro) at a higher frequency when dmp is enabled?
  6. im creating my own Controller and quadcopter and i always run into a the question of "how do you filter your gyro and Acc and use them together to get a Angle" . My question is, do i need to filter the Acc and Gyro or is the OUTPUT_READABLE_YAWPITCHROLL just a filter that Uses both acc and gyro to produce the Angles? what i want to do is use both Acc and Gyro to create an angle that i will use for a PID controller to balance the quad but if the OUTPUT_READABLE_YAWPITCHROLL already does that, than that would be unnecessary.
  7. Hello Sir, I am using this git hub code https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino and I want to find displacement from accelerometer. How can I Implement it? I know only If we have to find Displacement from accelerometer then we have to integrate it.But If we Directly integrate It then error will increase, so we have to use filter But which filtter I have to use? And which accelerometer data I have to integrate It raw data or gravity-free data. Please, anyone, help me how to find displacement from the accelerometer
  8. Hello, I am trying to use both an MPU6050 IMU and an I2CXL-MaxSonar-EZ ultrasonic range sensor on a single Arduino board in order to send data to ROS. I am attempting to make a MaxSonar driver using I2Cdevlib as it the MPU code is far more difficult to change. The problem I am running into is that the datasheet (http://www.maxbotix.com/documents/I2CXL-MaxSonar-EZ_Datasheet.pdf) doesn't have a full register map. I have the device ID and data I need to send to the sonar to tell it to take a range measurement, but it doesn't give the register address to send the data to. Has anyone else tried doing this? Am I missing something somewhere? Any help is appreciated. Thanks
  9. import smbus import time # Get I2C bus bus = smbus.SMBus(1) # MPU-6000 address, 0x68(104) # Select gyroscope configuration register, 0x1B(27) # 0x18(24) Full scale range = 2000 dps bus.write_byte_data(0x68, 0x1B, 0x18) # MPU-6000 address, 0x68(104) # Select accelerometer configuration register, 0x1C(28) # 0x18(24) Full scale range = +/-16g bus.write_byte_data(0x68, 0x1C, 0x18) # MPU-6000 address, 0x68(104) # Select power management register1, 0x6B(107) # 0x01(01) PLL with xGyro reference bus.write_byte_data(0x68, 0x6B, 0x01) I wish to convert the measurement range from +-16g of the accelerometer to +-2g and 2000dps of the gyroscope to 250dps. Any Gurus can help me on this? This is the register map for MPU 6050 https://www.invensense.com/wp-content/u ... r-Map1.pdf
  10. Dear Jeff, Could you please help to complete the "dmpGetTemperature()" function in MPU6050_6Axis_MotionApps20 ? I unable to find any resource to complete this function. https://github.com/jrowberg/i2cdevlib/blob/900b8f959e9fa5c3126e0301f8a61d45a4ea99cc/Arduino/MPU6050/MPU6050_6Axis_MotionApps20.h#L680 An other thing I need to know in the DMP configuration, Do I need to change some configuration when I consider vertical axes as Y, instead of Z axes ?
  11. Hi All, I have 5 different MPU6050 on one mechanic. I'm using Jeff's DMP6 code and I am especially interested in pitch and roll values from "OUTPUT_READABLE_YAWPITCHROLL". I already calibrated All 5 MPU with "MPU6050_calibration.ino" All sensors gives me "0 degree" when they placed in horizontal position, with package letters facing up. Also I'm getting "90 degree"(almost) they placed vertical. When i place sensors in forexample 45 degree all of them shows different angles between 43-47, this error follows me in different angles. i have no error on vertical and horizontal planes but there is a non lineer error occurs between 0-90 degree and its not same for all. supply voltage and ambient temperature is same for all and i read sensors from 5 different comport. I suspect for calibration process and try a lot of time to calibrate each other but nothing changed. DMP6 code works perfect, there is no freeze or connection problem but this difference makes me crazy :)
  12. To detect vibration I'm sampling the MPU6050 various times and averaging it with previous samples and the algo works very well, it's the following: Force = sqrt((currentX - lastX) * (currentX - lastX) + (currentY - lastY) * (currentY - lastY) + (currentZ - lastZ) * (currentZ - lastZ) ); However, the problem is the result is always a positive number, and since I've been studying accelerometers I've noticed they often give negative values too. So I'd like to be able to get these negative values. In the accelerometers initial state x, y can be negative depending on the axis, and y is never negative. I know x, y & z values can be changed by applying the DMP/quaternions/etc. Do I need to apply something like ypr or euler to get the proper G force? How do I get the full negative & positive values of G? Thank you for your time
  13. Hi friends, I have managed to read from two mpu6050 on DMP. Both sensors are fitted on a piece of board and are perfectly levelled. My problem is that when I tilt the sensors such that I increase/decrease Roll, the Yaw is changed, even when the sensors are not rotated on the z axis. Is it normal that rolling affects yawing? Furthermore, the change in Yaw for both sensors is not the same, and there will be a difference in yaw of 8 deg between the two sensors for a 45deg rolling. Thanks in advance, Hatt
  14. Hi, I have a question about the sampling rate and the digital low pass filter configuration values for the mpu6050. I know from the datasheet that the output rate for the acceleration is 1kHz. I use the clock source from the X Gyro for reference, as default on the mpu6050.h lib from jeff rowberg. Does the DLPF_CFG = 0 (260Hz ) affect my acceleration sampling rate or the acceleration output rate? If so, does the output rate goes from 1kHz down to 260Hz? Thanks in advance
  15. Hello friends! I will use the MPU 6050 to analyse the human gait, but i don't understand the source code the MPU 6050 (Arduino Mega) that is attached because is very complex, anyone has some source code to send me or comment the sorce code. Thanks. This project is very important because it will help people with disability in the legs. Thanks. Teste 1.txt
  16. I have problem with MPU6050. Approximately every 1 - 2 minutes I get the NACK on the I2C bus from the sensor. This situation arises entirely by chance. I receive NACK during read "Current FIFO buffer size" register, but after reading this register again, the device responds normally. Do not know what could be the reason?
  17. Hi, I'm new to the MPU6050 but getting some good results using 8051 micro interfaced to GY-521 breakout board to MPU6050. One puzzling thing is that while the Invensense register map for the MPU6050 states: REGISTERS 59 TO 64 – ACCELEROMETER MEASUREMENTS REGISTERS 67 TO 72 – GYROSCOPE MEASUREMENTS After a 200 mSec delay I measure the offsets, save them and subtract the offsets from the X,Y, and Z values of the acceleration and gyro angles. The results show values near zero after subtracting the offsets. So far, so good. But...I get the Gyro and Acceleration reversed. When I rotate the GY-521 90 degrees and then keep the board stable at the 90 degree position, the Acceleration values stay at a high value but the Gyro angle goes back to zero. When I rotate the board back to the resting position both the acceleration and gyro values got back to near zero. The gyro values only change when the board is actually being moved and go back to zero when the board is stationary, irregardless of the position/angle of the board. Here is the code: while(1) { ReadBytesIIC(59,14); //Read 14 register bytes starting at MPU6050 register 59. //Array[0]=register 59, Array[1]=register 60, etc. AccX=256*(int)Array[0]+(int)Array[1]+AccXOffset; AccY=256*(int)Array[2]+(int)Array[3]+AccYOffset; AccZ=256*(int)Array[4]+(int)Array[5]+AccZOffset; GyroX=256*(int)Array[8]+(int)Array[9]+GyroXOffset; GyroY=256*(int)Array[10]+(int)Array[11]+GyroYOffset; GyroZ=256*(int)Array[12]+(int)Array[13]+GyroZOffset; printf("\nAX,Y,Z, GX,Y,Z=%5d %5d %5d %5d %5d %5d",AccX,AccY,AccZ,GyroX,GyroY,GyroZ); DlyMs(50); } Can anyone explain to me why this might be happening? Thank you in advance. Bert
  18. Hello guys I have been trying to get yaw values from gyro MPU6050 for my application. The application is basically to control a robot's movement with respect gyro readings. Recently I started facing some issues relating calibration of the gyro. In my code I am mapping all the values of the whole range of yaw (-180 to 180) to pwm range (0 to 200). So ideally the sensor should get calibrated every time at value 100. The situation I am facing is that it gets calibrated at 100 just 3 times out of 10. What may be the possible issue? I am attaching the code for reference. Thank you GYRO.txt
  19. Hello, I am a college student working to build a UAV. I selected the MPU6050 as my IMU because it seems to have a pretty substantial community around it. Time to test that! Does anyone know how to invert the orientation of the IMU sensor in order to change its frame from a quadcopter to a UAV? I have attached photos below. I have tried flipping the physical sensor and playing with the offsets but that has not yielded anything useful. I have designed a complicated quaternion attitude controller dependent on the AC orientation and it would be a real pain to have to redo all of my work because of a IMU coding issue. I have the MPU6050 connected to a raspberry pi, which runs the controller, and am using an Arduino Due to control the motors/servos. Any help with this would be greatly appreciated!
  20. Dear all, Just want to how I can change the acceleration level from 2g to 4g on the Jeff's MPU6050 code for raw data. I assume I need to change AFS_SEL = 0 to AFS_SEL = 1. But how could I do it? I didnt find anything I need to change in MPU6050.h file. Do I need to do something on MPU6050.h file? Thanks all. Ji
  21. I'm working on a project that requiers high precision gyro Z axis on the atmega328 chip, in the mpu6050 lib it is explained that when you set dlpf mode to 0, the low pass filter is disabled and sample rate is set to 8kHz. That's what the invensense docs says as well, but then what is the purpose of the option to set DLPF to 0 and sample at 8000Hz while the bandwidth is only 256kHz? For some reason the output on 256kHz is very stable as if it was going through the low pass filter. I know I could sample directly at 1kHz but this is wasting way too much my system recources, so sampling every 3.9ms at 256Hz is ok for me. Any help is appreciated.
  22. Hi all, perhaps someone can help me to find a solution for my problem. I got the original teapod demo working together with the arduino code MPU6050_DMP6.ino. The plane on the processing sketch does exactly what I want to get out; the absolute position of the object in respect to the ground position (or point of view). All what i want is to get the angles for each axis of the object (yaw, pitch and roll) in realtime, just like i sit in the plane an look on an artificial horizon. All my attempts to convert quaternion to euer or YPR ended in solutions, where pitch an roll interact. So for example if i first roll about 30 degrees and then change the pitch angle from 0 to 70 degrees, the roll angle changes but there is no roll on the MPU6050. Does anybody have an idea how to solve this problem ? Thanks and regards Stefan
  23. Hi, I'm using MPU6050 for a wearable application and the IC responds well at times but gives out 0 acceleration at times even though Device-ID is read correct always. It is also found that, once I heat the IC with a hot air gun, it works again. In the datasheet provided by the link below, it is said under section 11.4 Assembly Precautions that the exposed pad must not be soldered, but I have it soldered it in my target board and it is also mentioned that thermo-mechanical stress will affect the IC . I also have a buzzer in my board, will it be as reason too? Regards, Joe https://www.google.co.in/search?q=MPU-6000+and+MPU-6050+Product+Specification+Revision+3.4&rlz=1C1CHWL_enIN764IN764&oq=MPU-6000+and+MPU-6050+Product+Specification+Revision+3.4&aqs=chrome..69i57.325j0j4&sourceid=chrome&ie=UTF-8
  24. Hi there, I am attempting to use an SSD1306 and a MPU6050 together. I am using the U8G2 and I2CDevlib libraries but the devices seem to be mixing each other up. The devices each work seperatly but not together and have different addresses. Does anyone know why this is happening?
  25. mpu6050GetDeviceID() hangs. Any idea why this happens? I'm building for stm32f405 attached to mpu6050 by i2c using nosys c stl w/c99. I have verified that the stm32f405 can run a program and that this program works with the arm-atollic-eabi-gcc compiler, but not with the arm-none-eabi-gcc compiler.
  • Create New...