SIR I CAN'T THANK YOU ENOUGH. I have been trying to fix gyro issues (values increasing over time/inaccurate values) and trying different libraries for literally 7 hours and the libraries are unnecessarily complicated. Your video is very clear, straight to the point and extremely helpful lots of MPU 6050 videos are either unclear or give an unsatisfying result. Thank you so much!!!
@XTronical3 жыл бұрын
Glad it was so helpful.
@daudhtm52033 жыл бұрын
it's not the other libraries fault, its just the gyro and acce. you have to put on a filter for them to be acurate
@georgeandrawos37483 жыл бұрын
@@daudhtm5203 I agree but it sure would have been nice for the other libraries, tutorials, and videos to make that tip obvious and not implicit instead of wasting everyone's time.
@daudhtm52033 жыл бұрын
@@georgeandrawos3748 i tried out this library but it seems like the values are still increasing without even moving the gyro.
@XTronical3 жыл бұрын
That's the earth's rotation.
@albrody88613 жыл бұрын
Wow. This has been the best source of information I have found so far for getting useful data from an MPU6050. I think it is the use of the MPU6050_light library. Thanks!
@walidchtioui79303 жыл бұрын
A remark on yaw angle values : Even if you initially calibrate yaw orientation, yaw values will increase nonetheless. I assume this is because of the integral approximation that is occurring behind the scenes. As a matter of fact, the gyroscope doesn't measure angles instead it measures angular motion, that is in rad/sec. To go from that to having angles you need to integrate thus having to use some sort of integral approximation. The reason why you don't see this happening with pitch and roll values is because the gyroscope's pitch and roll angle values get the privilege of being 'corrected' by the accelerometer's sensor data. The yaw values, on the other hand, don't have this privilege. Edit : typos
@ahmetpehlivan3698 Жыл бұрын
I was looking for yaw measurement with good calibration and finally i found it !! thank you so much.
@HexOperator7 ай бұрын
Absolute banger of a video mate. I was going on an absolute tirade trying to calculate the yaw values, but the library works beautifully.
@minebuddies8804 Жыл бұрын
Thank you so much! I have looked all over the internet for an example for this module, and it worked very good for me! Big Thanks to you :)
@drhubs7049 Жыл бұрын
Bro, this was so helpful. I figured out how to pull values without this but having a library like this that actually works is a huge time saver
@TYGAMatt4 жыл бұрын
Great timing. I've just started using an MPU6050 in my motorcycle data logger project to measure lean angle, acceleration and braking force. I'm using an ESP32 with the MPU6050_tockn library. You can set the calibration in the code once it's known. It's a great little module. I've ordered an MPU9250 so looking forward to having a bash with that when it turns up. Keep up the good work old boy!!
@XTronical4 жыл бұрын
Great stuff, I'll have a look at that library. Can't remember now if I checked it or not! Thanks for the comments.
@TYGAMatt4 жыл бұрын
@@XTronical well, my MPU9250 just turned up, so hopefully can give it a test in the next day or two
@TYGAMatt4 жыл бұрын
Hmmmm. Not having a huge amount of joy with the MPU9250. The bolderflight library spits out oodles of data. Way more than I have the time to get my head around. Tried a couple of other libraries but no real joy. Seemed to be getting rather inaccurate roll, pitch and yaw. Will stick with the MPU6050 for now as it does what I need and I was just being greedy wanting a 9 axis ;)
@prateekmahajan19294 жыл бұрын
i2cdev library has example sketches for getting the angles and an example for getting the accelerations.
@prateekmahajan19294 жыл бұрын
You gotta do some changes to make it work with esp32, I usually use an esp8266 in which I just mention Wire.begin(sda_pin, scl_pin); other changes are needed when handling interrupt
@brianharper97984 жыл бұрын
An amazing little thing for the price, and to think it's actually got microscopic mechanical parts inside. I did build a balancing robot a while ago but was also thinking of one inside a small cube with possibly Bluetooth to control things on the PC by choosing a side and then rotating, so a side chooses an item and rotating gives a value. But never got any further than the initial idea!
@XTronical4 жыл бұрын
Are they mechanical, I've never investigated. Your project sounds interesting!
@brianharper97984 жыл бұрын
Yes, as far as I know they have a mems gyroscope. I vaguely remember looking it up when I built the balancing robot.
@extremeroom7u72 жыл бұрын
came back here again cause this tutorial is extremely great
@fareed19838 ай бұрын
Thanks for this. I have been struggling to get this to work from quite a long time.
@prateekmahajan19294 жыл бұрын
Basically all the 3 angles calculated using gyroscope drift, but then a complimentary filter is used to combine values from angles calculated using gyroscope and accelerometer, since the accelerometer can only be used to measure roll and pitch values hence the complementary filter can only be added to roll and pitch but not yaw. So yaw drifts.
@TreudtLP8 ай бұрын
Thanks a lot, die normal MPU6050 Library wasnt working, but now i can finally start
@Rizwaan1223 жыл бұрын
cheers mate, i only needed the yaw angle so im glad you went into extra detail on that. Life saver!
@Talha807773 жыл бұрын
did it work without any problem?
@peut4 жыл бұрын
:-) Obviously the yaw increase when not calibrated is sensing the earth rotation :-)
@XTronical4 жыл бұрын
Ahh, really, thanks.
@vivansheth19023 жыл бұрын
😂😂😂😂 is it funny or is it real ?
@peut3 жыл бұрын
@@vivansheth1902 No, I don't think it is real,but it is a fun idea
@johnaustin937 Жыл бұрын
Really helpful Especially the library❤ Thanks
@g4ur4v883 жыл бұрын
Wow nice... Finally I got what I was searching for long time. Can you please share wiring diagram, photo of the board and list of items required
@ahmetpehlivan3698 Жыл бұрын
Vcc->5V gnd->gnd SCL->SCL(pin is depends on which arduino you have) SDA->SDA (pin is depends on which arduino you have)
@nithinsai22503 жыл бұрын
Thanks buddy for sharing this valuable info
@XTronical3 жыл бұрын
Glad it helped.
@extremeroom7u73 жыл бұрын
You just made my day
@wolfmicioyt73883 жыл бұрын
I need to use this for a full motion flight simulator, but I want to make sure it fits the job. Basically, I've been trying to use the accelerator to get the angles. However, as the platform moved, it was reading incorrect values thus making everything shake. My questions are: - is this library capable of getting just the angle (ignoring the platform motion)? - if I initialise the system at any angle, would it still be able to get the actual value (getting the value from the accelerometer, for instance) or will it start at 0;0;0 deg? - How often do I need to re-calibrate the system? Thank you for your kind help and attention
@hindouba59227 ай бұрын
I need to measure the angle of the basketball shot. Can I use it, and what angle is considered correct?
@DaMu24 Жыл бұрын
4:18 So the exact library used will be dated, especially as Adafruit and other repositories update their libraries, but it's important to note that, if the access to the MPU6050 is uncertain with an installed library, try another one from the manager. Especially important for future use.
@virajkharade4213 Жыл бұрын
Using a magnentometer, we can measure yaw values.....? My doubt is that I am using the MPU9250 and I have already made the code, however, the values of the gyroscope are drifting and counting up point by point. As I have already calibrated the Gyrocope, what else can I do ....? If possible, please reply to me.....
@sudattsdeadchannel349511 ай бұрын
hi. i need help for my school project. i have a load cell with hx711 amplifier . i want to show load and mpu readings symultaneiously on oled screen. both codes run fine when ran single. when i try to merge them then the code stops after 1st loop. i want help with proper code for this. plz help me , im not smart enough for this
@carlosalexandremartins70722 жыл бұрын
I wonder if the MAP function works with these parameters and if yes what are the maximum and minimum values to add in the works with that function.
@ramunasreimontas Жыл бұрын
Hello, I wired Arduino and MPU6050 and uploaded project to microcontroller. But I have one problem. If gyroscope not moving (is in stable position) Z axis angle continuously decreasing. Approximately 0.5 deg/minute. How I could solve this problem? Any advise I appreciate. Thanks
@AbdulRahman-jz3px2 жыл бұрын
Hi, I'm a beginner. I want to ask, what acceleration is meant by MPU6050, can it measure angular acceleration?
@connorpetersen4763 Жыл бұрын
at 6:19, how did you get the live data from the board to be shown on screen?
@XTronical Жыл бұрын
It's in the code isn't it? Check link in description.
@connorpetersen4763 Жыл бұрын
@@XTronical I figured it out. Everything was working properly, I didn't realize you have to push the serial monitor button. Thank you, awesome video.
@axonbro7072 жыл бұрын
I'm able to get this to work when the MPU6050 lays flat, however my robot stands up at 90 degrees initially. I can't get accurate readings when the calibration starts with the MPU vertical. idk why, any help?
@XTronical2 жыл бұрын
Sorry, not sure.
@marekcermak38432 жыл бұрын
How does the example code know which pins are you using, for SCL and SDA input? Should I always use A4 and A5, or I dont have to specify pins and just use the mpu.getAngleX,Y,Z() function? And should I connect it also to A5 and if I use Arduino Mega?
@XTronical2 жыл бұрын
Use whatever I do in the video. They are fixed on the Arduino unlike the esp32.
@marekcermak38432 жыл бұрын
@@XTronical So Ard. Mega has special SCL and SDA input - shorturl.at/einHQ, so I should just hope the libary can work without me specifying the pins. You also did not specify them, or did you? Thanks for answering man!
@XTronical2 жыл бұрын
Just use whichever pins are used for the mega and the library will sort rest out. As when you specify the board your using the library has access to certain "defines" which it can use to set itself up correctly.
@XTronical2 жыл бұрын
Your welcome
@pujiwido50433 жыл бұрын
mpu.calcOffsets(); not working when i want to recalibrate with button Can you help me?
@jamesnegapatan20822 жыл бұрын
thank you and this is very helpful!, I understand it quickly, thankyou.
@bhillster4 ай бұрын
Thanks for sharing this.
@plop59982 жыл бұрын
hello, when opening the serial monitor it is completely blank. Is there a reason for this?
@XTronical2 жыл бұрын
Check your baud rate etc. Check with other seriel demo program.
@andy_texguittar Жыл бұрын
bro how can i do the same with an adafruit oled display 0.96 ssd1331?
@rakshithahm51312 жыл бұрын
Hyy it's really useful. But values are changing continuously without delay. Is there any way to display the values slowly??
@XTronical2 жыл бұрын
You could average them over several samples and display the average. This would provide some stability to the results.
@priminersouthamerica79653 жыл бұрын
That was just great!. The simplest way I have found so far. Thanks !!. I have a question: The YAW value is not very accurate... it changes all the time. Is there anything to do with it? Or is it just the 6050 hardware which is not good enough? Any ideas or suggestions? Thank you again!
@XTronical3 жыл бұрын
Thanks. It's changing because of the earth turning. This is 15 deg per hour. So to keep the yaw relative to your position on earth you would have to allow for this.
@priminersouthamerica79653 жыл бұрын
@@XTronical Wow! That's cool!. Do you have any inputs to give me about how to allow that function to keep it relative to my position?. Thank you again!
@XTronical3 жыл бұрын
Unfortunately I never investigated further. I should imagine someone has done the solution, perhaps I will revisit this one day.
@shun01able2 жыл бұрын
@@XTronical Would a filter like Kalman filter make the value much more consistent? I am planning to use an accelerometer and a gyroscope to track the back posture of an individual and i think i would require a constant or at least a less noisy values
@XTronical2 жыл бұрын
Not sure, sorry.
@robjordan634 жыл бұрын
Happy to oblige with a patronising comment ;-)
@XTronical4 жыл бұрын
Thank you 😊
@frenkkotarigan2 жыл бұрын
Hallo sir I want to make an active suspension for an rc car base on gyro and accelerometer But i am beginer on arduino Could you help me? 🙏
@XTronical2 жыл бұрын
Sorry, I don't have enough time to help with individual projects
@frenkkotarigan2 жыл бұрын
@@XTronical it's ok 🙏
@pawes74763 жыл бұрын
That was very helpful! Is it possible to measure the position value (coordinates) with the MPU6050? By integrating the acceleration values or something else? What would you advise to use to get these values for a mobile robot. I would be very grateful for help ;)
@XTronical3 жыл бұрын
Yes, I'm quite sure it's possible with the libraries that are available but I've never looked at it. Accuracy may be an issue though, if you want repeatable positions down to millimetre precision then I'm not sure it would be good enough, although I may be wrong. But I can't help more I'm afraid as I've not looked into this.
@pawes74763 жыл бұрын
@@XTronical ok, so I keep searching the internet, thanks!
@marufmorshed37932 жыл бұрын
so did you find any sources where we can measure position value(coordinates) with the MPU6050
@varl20043 жыл бұрын
thank you for this video, finally I could read data from my sensor but I need some help, I'm using this sensor with Arduino nano, but I can't make it work with Opentrack software, could you do a tutorial for achieving it?, thanks again!
@XTronical3 жыл бұрын
I'll make a note to check it out but won't be for a while I'm afraid. Currently working on other stuff.
@varl20043 жыл бұрын
@@XTronical just if you can, but it would be very useful because there is not a clear tutorial about how to do it, thank you in advance and greetings from Chile ☺️
@robinwood58334 жыл бұрын
Really great video, easy to understand, I am trying to write code for if statement to get led to light up when X val = 50 degrees have tried all I know but failing, could you please help? Thank you and merry Xmas from Australia
@XTronical4 жыл бұрын
I'll code an example this weekend
@robinwood58334 жыл бұрын
Thank you very exciting
@samuelstuff45572 жыл бұрын
Does the yaw increase because of gravity affecting it?
@XTronical2 жыл бұрын
It's the earth spinning
@samuelstuff45572 жыл бұрын
@@XTronical but wouldn’t that give it 360 degrees every 24 hours not a matter of minutes? Or is that not how it works
@thelazycat_2 жыл бұрын
I only see Z slowly increasing, the X and Y stays on 0, any idea?
@lorenzothepasta28203 жыл бұрын
Lol!! This video is funny and informative. Good job!!!!
@taqiuddinwahab59123 жыл бұрын
thank you. this is so helpful
@vantuilpinheiro84333 жыл бұрын
Hi. XTronical. I'm getting abnormal readings. My Pitch is crazy. In the 0º position it gets 40-45º. I didn't get it. After a complete pitch movement of 90º, it shows 145º. Great video, by the way!
@XTronical3 жыл бұрын
Thanks, sorry I'm not sure what the problem is without recreating it
@nithinsai22503 жыл бұрын
i think u didnt place it on a flat surface while calibrating
@inannasrls72193 жыл бұрын
The solution i needed! Thanks a bunch!
@glitch96953 жыл бұрын
Do we not need pull up resistors for Data and Clock lines?
@XTronical3 жыл бұрын
No.
@Ziqastory4 жыл бұрын
hi, ty for the great video. i tried using the coding without oled. It works well on both roll and yaw. Buy my pitch (yaxis) can only reach max of 89 degree only. Can you or anyone help me with this issue?
@XTronical3 жыл бұрын
Sorry, Christmas got in the way of this I will try to look at it soon
@Ziqastory3 жыл бұрын
@@XTronical its okay . i also tried the coding from your project page of getting all data for angle (x,y,z) and its acceleration (g unit) of each axis. Is there any relation between tilt angle and the acceleration? Because when i change angle of x axis to positive value (90 deg etc), only the Y acceleration changes while X accel remain almost constant. Is that normal? i want to study about it but until now i still found no literature regarding the matter. Hope u can help and give a bit explanation.
@Infoiswealth95113 жыл бұрын
yaw is changing with respect to roll and pitch right ???is it correct
@XTronical3 жыл бұрын
Yes, it's because the Earth is rotating.
@hamedtaran210211 ай бұрын
@@XTronicalNo, this cannot be true, because if you change the position of the x and z axis together, you will still see that the z axis increases over time! I could not solve this problem for several days. In addition, this problem does not exist in newer gyroscope ICs, so the rotation of the earth cannot be the reason
@修改名称-z2c7 ай бұрын
it can not turn over 90 degree
@GGGatzy3 жыл бұрын
does it have forward and backward data?
@XTronical3 жыл бұрын
I've not used this but it has accelerometers so basic movement can be derived from them. Not sure of accuracy.
@craftbrewer54013 жыл бұрын
One thing I can’t figure out, is how to get/calculate heave - vertical motion. I want to use it in a boat to display pitch, roll and heave ( wave height) Anybody have an idea?
@XTronical3 жыл бұрын
You'd need to use the accelerometer results, but I've never looked into this. But that's where I'd start. A certain acceleration over a given time should give you a approx distance travelled. There maybe something in the library that does this.
@pravinchavhan88903 жыл бұрын
@@XTronical hi , how can i detect 360 degree rotation of y-axis to complete a circle please help me with this
@SpiritVector3 жыл бұрын
Can I use this in a drone?
@XTronical3 жыл бұрын
Yes. Should be OK.
@Oxygen_56 Жыл бұрын
Stupid -- The yaw change (rotation of the xy plane around the z axis) is not a drift or an error that needs to be zeroed. I put my MPU6050 on the kitchen table and collected the axis output for six and a half hours. Pitch and roll values were stable throughout the entire period. However, the yaw values are constantly changing at an extremely linear rate of 0.25 degrees per minute. That's 15 degrees an hour. The planet you are on is rotating at such a speed. It's not a coincidence.
@XTronical Жыл бұрын
I had a Tik-Toker say that these units could not detect planet drift, yet there it is
@KartihkCg802 жыл бұрын
Australian 👍🏼
@FaL4FlАй бұрын
My brother in christ, You saved me from hell. Now I will be able to build my own iron dome! Seriously you helped a lot with my project mate! Thank you
@FPChris Жыл бұрын
Man. This damn module ALWAYS Yaw drifting. >_
@XTronical Жыл бұрын
Planets moving underneath it, it detects this movement. 15 deg an hour