Jump to content
I2Cdevlib Forums

Search the Community

Showing results for tags 'calibration'.

More search options

  • 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







Found 6 results

  1. 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. Hey everyone! Thought I'd share my version of an auto-offset calibration sketch; it converges all offsets in about 20s or so. Just upload and watch the serial (at 38400bps)! A note on how it works/converges: - the code takes an initial guess for each offset (supplied at the top of the sketch), takes a certain number of readings from the MPU-6050 (the # of readings it takes is defined by countMax), and averages those number of readings. If that average is less than the value errorCheck, it assumes that axis has converged - if the average isn't less than errorCheck, it will subtract a certain amount from the initial guess - if the errorCheck you set is too small, or the initial guess is smaller than what the solution is, it wont converge - in this case either choose a larger value for errorCheck or a larger initial guess I've given some initial guesses / settings which should help you get to where you need to be; just watch the serial - it'll tell you what the average reading from the MPU-6050 was for each guess, you'll want that average to be as close to 0 as possible for each axis. Enjoy! MPU6050_calibration.zip
  3. aniket_prasad

    MPU6050 calibration

    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
  4. I'm trying to calibrate my MPU6050, i tried to follow the guide here: http://www.i2cdevlib.com/forums/topic/91-how-to-decide-gyro-and-accelerometer-offsett/ But the values my sensor gives me were all around: a/g: 3980 1512 3892 -6 70 -9 a/g: 4056 1452 3884 28 51 -19 a/g: 4088 1304 3712 17 49 -14 a/g: 4068 1340 3820 7 66 14 a/g: 4044 1332 3628 40 104 -16 a/g: 4072 1336 3896 2 47 16 a/g: 4088 1332 3760 19 62 -14 a/g: 4004 1448 3728 16 48 -4 a/g: 3980 1444 3740 18 29 -1 a/g: 4112 1432 3828 7 56 14 a/g: 4092 1376 3736 8 55 -4 a/g: 3936 1528 3560 -26 122 -13 When i tried to add this values to my offset, the offset simple gets BIGGER. I tried than using the sketch calibration by Luis RĂ³denas (i put on pastebin here) It says at the end: Sensor readings with offsets: 7 -4 16382 0 0 0 Your offsets: -426 -165 1525 -3 -14 0 Data is printed as: acelX acelY acelZ giroX giroY giroZ Check that your sensor readings are close to 0 0 16384 0 0 0 If calibration was succesful write down your offsets so you can set them in your projects using something similar to mpu.setXAccelOffset(youroffset) When i add these values to my sensor it gets: a/g: -44 60 16252 -19 -6 -10 a/g: 68 12 16444 14 -14 6 a/g: -132 -44 16340 -3 4 -2 a/g: -68 80 16248 18 10 12 a/g: -28 108 16068 -18 -7 2 a/g: 16 -80 16368 -26 14 -15 a/g: 32 76 16324 -16 4 4 a/g: -8 60 16092 -5 2 7 a/g: 32 -40 16288 2 11 1 a/g: -16 44 16384 14 -14 -3 a/g: -92 32 16608 3 -18 -7 a/g: -80 -88 16384 20 1 -9 The wide range betwen positive and negative numbers here make me worries about my sensor has any problems. Yes it's wired corect. I'm using the raw values to get these values, no i cant use DMP because it uses interuption and my interuption port are being used by my encoders. So i'm being that stupid that can see the problems or theres something here?
  5. Hi all, This is my first post here. I am helping out a friend with a project where he needs to read acc & gyro data from two independent surfaces. For this I am using two GY521s, at their available addresses of x68 and x69. I have the hardware working and after tweaking Jeff's example to get raw data to accommodate both sensors I am getting data. I also used the DMP6 example and got the three axis reading for the teapot demo. Not satisfied I started to do a little research which turned into massive confusion :-). I am not sure if the raw data that I am getting is what he needs. He is working on software that will receive the data through an Arduino and send it over to the host PC running the application. The app needs to receive the six gyro and accelerometer data items, along with an indicator of time passed. The app will create a graph of the surface's movement. My research yielded information about calibration and offsets. I am currently reading and trying to understand the raw data that I am getting and trying to determine whether I need the offsets or not. I found the following thread on this site: http://www.i2cdevlib.com/forums/topic/4-understanding-raw-values-of-accelerometer-and-gyrometer/ BTW: The link to the MPU 6050 datasheet is broken. I will continue to research and read the thread referenced above and the datasheet; however, I wanted to ask here, hoping that perhaps someone can help me get my head around this versatile sensor. My questions: What does the raw data indicate? Why does it vary so much even though the GY521 is not moving? What does the calibration do? Why is it important? The calibration process yields offsets, what do these values mean? Any helpful recommendations or clarifications are welcomed. I will follow up with this thread with whatever information I find. Thank you all for your time and assistance. Sgarv
  6. We have some Arduino MEGA 2560-based boards with an on-board MPU-6050 at the default I2C address 0x68. i2cdevlib is extremely helpful (thank you Jeff!), except we can't seem to generate offsets that zero the sensor outputs. I've been using luisrodenas' Arduino sketch, which he posted in this forum recently, to calculate MPU6050 offsets. I modified the output to print the mean (2000 samples in this case) of the sensor outputs and the revised offsets calculated based on those mean values each time through the loop. The full data is attached and I've included a sample from gyro_z below. As you can see, the offsets change to try to move the mean values to zero. The sensors outputs seem to resist this adjustment, then at some offset threshold, the sensor values jump way past zero. This cycle then repeats. Only the gyro_y value responds as expected. Does anyone have any ideas what could be causing this? I've verified this on several PCBs, so it doesn't seem to be a bad MPU. I saw similar results setting offsets manually, so I don't think the issue is in the calibration sketch. Thanks, Mike MPU6050 connection successful Reading sensors for first time... Calculating offsets... Configuration: buffersize=2000 acel_deadzone=16 giro_deadzone=2 mean_gz gz_offset 492 140 931 -170 -93 -139 -89 -110 -88 -81 -89 -52 -88 -23 -89 6 934 -305 -1112 65 934 -246 -89 -217 -89 -188 -89 -159 -89 -130 -88 -101 -89 -72 -89 -43 -89 -14 -89 15 934 -296 -1113 75 output.txt