Ep. 57 Arduino Accelerometer & Gyroscope Tutorial MPU-6050 6DOF Module

Sdílet
Vložit
  • čas přidán 29. 08. 2024
  • If you're curious about some of my ventures since the start of the channel, I've recently launched a newsletter with my thoughts on technology, business, entrepreneurship and more. You can check it out for free and subscribe if you're interested on my personal website:
    www.vladromano...
    Thank you for your contributions to my projects. With your help, I am able to showcase, teach and inspire people all over the world.
    Patreon: / ee_enthusiast
    Software:
    github.com/VRo...
    In this video, I will be walking you through the full implementation of an accelerometer and a gyroscope with the use of an Arduino and an MPU-6050 Breakout board. The tutorial is much more in depth than what I usually do and fully explains every single register and bit I am using to get the final data.
    Hardware Required (See detailed list on EEEnthusiast.com):
    - Arduino Uno
    - MPU-6050
    - Breadboard
    - Jumper cables
    Get in touch:
    Facebook: / eeenthusiast
    Twitter: / ee_enthusiast
    Website: eeenthusiast.com
    GitHub: github.com/VRo...
    Personal website: vladromanov.com
    Relevant Search Terms:
    Arduino Uno
    Arduino Accelerometer
    Arduino Gyroscope
    MPU-6050
    6 Degrees of freedom
    Robot
    Quadcopter implementation
    Motion control circuit
    Balancing arduino

Komentáře • 636

  • @TrentSterling
    @TrentSterling Před 7 lety +94

    First tutorial I've found for this module that actually explains what's going on.
    And the first one with working code too!

  • @fowti1470
    @fowti1470 Před rokem +4

    This is what all tutorials should be! Kudos for actually explaining how the code works, and why it looks like that. Now I'm significantly less intimidated by this sensor

  • @PhilipHeuberger
    @PhilipHeuberger Před 8 lety +168

    superb video tutorial. by far the best for the 6050 I've seen here. I've watch a lot in anticipation of getting a pair for my project. The full explanation on registers and setting them correctly was well worth the 30 mins. Thank you!

    • @EEEnthusiast
      @EEEnthusiast  Před 8 lety +13

      Thank you sir!

    • @hanneskaufmann5743
      @hanneskaufmann5743 Před 7 lety +2

      Thank you sir!!!!!!!!!!

    • @kil98q
      @kil98q Před 7 lety +5

      The same Thank you ! you saved me alot of time

    • @pravinchavhan8890
      @pravinchavhan8890 Před 3 lety +1

      @@EEEnthusiast
      hello friend , i want to know how can i calulate number of 360 degree rotations completed by MPU6050 using arduino . it would be nice if u help me

    • @davidjjeffrey3929
      @davidjjeffrey3929 Před 2 lety +1

      Agreed. This is still the best real world explanation for this MRU and its registers. Whole lot more of the same on your channel. Amazing. Thank you.

  • @stemmunity
    @stemmunity Před 2 lety +1

    A little over 5 years since this video was produced. First time viewer. Excellent tutorial. Thank you!

  • @BOSS2245Y
    @BOSS2245Y Před rokem +1

    BEST EXPLANATION ❤❤😊😊😊
    I searched a lot but can't find a video that makes me understand .
    Until now make more videos like this ❤❤❤❤

  • @vasudevkesharwani1933
    @vasudevkesharwani1933 Před 3 lety +1

    this is the first time i see the real tutorial for this mpu6050 , this is the best tutorial i have ever seen . tq very much sir

  • @karthikvigneshwar8742
    @karthikvigneshwar8742 Před 4 lety +4

    This is by far the best tutorial for MPU 6050 I've seen so far. It's very helpful to learn it this way going all the way to the littlest of details. Thanks a lot!!

  • @utkarshverma1
    @utkarshverma1 Před 6 lety +1

    Great, in-depth and clear demonstration. The way you skipped using MPU6050 libraries really helped me understand more. Can't thank you enough!

  • @anthonyj777
    @anthonyj777 Před 8 lety +6

    Excellent video; low level commands with direct reference to the data sheet.
    People get more out of this thing when they dig to this level.
    Well done.

  • @rajatsharma-pv8jd
    @rajatsharma-pv8jd Před 5 lety +2

    No one else has explained the code along with the data sheet so well! Cleared a lot of my doubts and got to learn new things as well. Thank you for such a content!! Keep posting :)

  • @naskorcinemaytps...7469
    @naskorcinemaytps...7469 Před 7 lety +7

    Thanks a lot !
    A friend and I are building a drone for a school project, and all the other programs for the MPU-6050 were impossible to understand with our lack of experience in Arduino... You made it completely clear, so we owe you much ^^

  • @ahsanbaig8569
    @ahsanbaig8569 Před 4 lety

    Fantastically explained!
    No one (except you) bothers to explain the basics.
    Thanks a lot.

  • @marianarodriguez-oc8qz

    Hi, I am colombian, I love your video, It helpe me a lot. I am doing my grade work, It is a sign language translator glove, I am using a similar sensor MPU9250 and your video was very helpful. I understood many things that were driving me crazy . THANK YOU :D!!

  • @user-rx2tg8xd3c
    @user-rx2tg8xd3c Před 5 lety +2

    This is the best video ever. I really like how you go down in to each registers to explain stuff. it is really difficult to find other people doing the same demonstration. What leaners need is not how to write digital write and digital read. They need to understand how it works.

  • @JJSmalls
    @JJSmalls Před 4 lety

    Took me several days to find a video that goes over a datasheet approach to how to use this sensor. THANK YOU!

  • @kriminull8461
    @kriminull8461 Před 10 měsíci

    this video is a godsend, thank you. note to beginners (like me) who have little experience with arduino: make sure you solder the pins to the mpu6050 first, because the code won’t work otherwise
    i initially thought u could just use the components unsoldered but that isnt the case
    all the best :)

  • @wessidemd
    @wessidemd Před 6 lety

    I don't know how I would ever get anywhere with this sensor without this tutorial. Thanks so much!

  • @do7awi
    @do7awi Před 4 lety +1

    This is the best tutorial i've found on this topic. You answered all my question in less than 30 minutes.
    thank you!

  • @sebastienstrady9560
    @sebastienstrady9560 Před 3 lety +1

    Just perfect!! I was trying to understand the meaning of the results for the accelerations x,y,z and it's perfeclty explained here. Thanks a lot.

  • @vbrwqjw49
    @vbrwqjw49 Před 4 lety

    Best video coverage of the MPU6050. In-depth explanation of the code and how the device works. A well-earned like.

  • @RandomMusingsOfLowMelanin
    @RandomMusingsOfLowMelanin Před 7 lety +42

    The Wire.read() on the left hand side is executed first
    giving us 8 bits of information. For example purposes, make that
    yyyyyyyy. The

    • @richardclark4383
      @richardclark4383 Před 5 lety +8

      I realize you left this comment 2 years ago, but i just wanted to say thank you so much! It was driving me crazy trying to figure out what that line meant. Wish this comment was pinned to the top!

    • @kaousheik9985
      @kaousheik9985 Před 5 lety

      Nice one. But why there is a need to read twice

    • @victorpetch8579
      @victorpetch8579 Před 4 lety +3

      @@kaousheik9985 That's because you read the first 8 bits first and then the last 8 bits. You combine them with an OR (|), which in binary its essencialy adding them both, and you get the 16 bit number. Note that the first read has to be shifted to the left, so if you have 11110000, after you shift you'll have 1111000xxxxxxxx. Then if you add using OR: 11110000yyyyyyyy. That's the 16 bit number that the MPU gives you by giving 2 bytes in a row.

    • @filipcoja
      @filipcoja Před 3 lety

      Big thanks.

  • @DUSHYANTPANCHAL
    @DUSHYANTPANCHAL Před 6 lety +6

    The best tutorial actually explaining the code properly I found finally. Though 29 minutes but worth every second. Thank you sir.

    • @EEEnthusiast
      @EEEnthusiast  Před 6 lety +1

      Appreciate the feedback! Is there anything else you'd like to see me cover? Any other projects you're working on?

    • @DUSHYANTPANCHAL
      @DUSHYANTPANCHAL Před 6 lety

      EEEnthusiast
      1) Could you make a video on how to use esp8266(without shield) with arduino for serial communication with smartphone over espWifi. Can be used to make wifi based smartphone controlled car just like many tutorials on hc05 bluetooth controlled.
      2) Secondly can I get in touch with you please. I am a student and want some proper tech support from people like you.

    • @DUSHYANTPANCHAL
      @DUSHYANTPANCHAL Před 6 lety

      Could you make a video on how to read a pwm signal such as a throttle signal from fsi6 using pin change interrupts on an arduino.

    • @ajinkyakhaladkar4823
      @ajinkyakhaladkar4823 Před 5 lety

      @@EEEnthusiast sir how to find position of the object using this data

    • @elirockenbeck6922
      @elirockenbeck6922 Před 5 lety

      @@ajinkyakhaladkar4823 algebra and trigonometry

  • @abcddd580
    @abcddd580 Před 6 lety +1

    I watched this video a few months ago while trying to build my quadcoptor from scratch, and to be honest i was intimidated by all the registers and everything as it seemed like complicated stuff. I am rewatching this now, and it is such a great video, and you explain everything so well. Thanks!

  • @bonfacemuthuri9840
    @bonfacemuthuri9840 Před 2 lety

    I have worked through the best of my best tutors, but I have never come to a detailed tutorial as this, I have learnt both the mpu and the wire library both of which were difficult for me on the same video thanks so much❤.
    Looking forward to watching more of your videos.

  • @1111quinn
    @1111quinn Před 7 lety

    Thank you for making this video about how to program the module itself and not just its applications!

  • @christianmendez4529
    @christianmendez4529 Před rokem

    the most usefull & most generous video on the MPU6050 i´ve found. thank you very much!

  • @dipen12
    @dipen12 Před 6 lety

    Finally understood how to interpret the raw Gyroscope and Accelerometer readings. Thank you for this tutorial. Good luck!

  • @brianberg3419
    @brianberg3419 Před 6 lety +3

    Wow, this video saved me so many hours of figuring the datasheet out. Thank you so much for explaining in such a simple, and yet advanced enough method to implement more advanced project.
    Again, thank you.
    Keep up the good work.

  • @ibzih
    @ibzih Před 3 lety

    Thank you so much for this tutorial! It was the first one I watched about 6050 MPU and then went down the rabbit hole to find more information about this sensor. But now watching this video again at last, I am surprised how easy and effective your explanation was about the registers and accessing them, etc. Thanks again!

  • @anupriye5109
    @anupriye5109 Před 6 lety +1

    Best mpu6050 tutorial on youtube.
    Great job.

  • @Potato_Suit
    @Potato_Suit Před 6 lety +1

    REALLY THANK YOU GUY, I WAS LOOKING THIS TO FINISH MY TCC PROJECT, AND YOU HELP ME REALLY HARD. THANK YOU MAN!!!

  • @HelLwoLF1993
    @HelLwoLF1993 Před 7 lety

    was working on my school project and this comes in really handy when i was trying to understand about mpu6050. thank you so much!!!!

  • @12Jerbs
    @12Jerbs Před 7 lety

    I have a slightly different MPU-6050 than what I've found online (an extra pin and split: 5 on one side, 4 on the other). Following all of the information and libraries I found, nothing worked. Yours is the only one that worked. Whatever you setup in your libraries is what got it working.

  • @hrishi104
    @hrishi104 Před 7 lety

    Best MPU 6050 tutorial anywhere on the earth. You helped me a lot with this video. Keep pouring your knowledge on us. Thanks a ton. looking for more tutorials from you.

  • @charlesbiggs7735
    @charlesbiggs7735 Před 7 lety

    Thanks a million for this video!!! It's good to actually LEARN this I2C stuff. I set the MPU address to 0x69 (RTC used 0x68). Allegedly, my MPU is a 9250. I checked the datasheet and the gyro/accel addresses were the same. Thanks again.

  • @vterminaterr
    @vterminaterr Před 6 lety

    Best MPU related video I have seen till data period

  • @0nGaBrIeL
    @0nGaBrIeL Před 6 lety +1

    I haven't seen a so well explained video in a long time! Congratulations!

  • @Rickiepimpim
    @Rickiepimpim Před 5 lety +6

    Great tutorial. This has helped me to kick start my 3-D displacement measurement project.
    Thanks a lot!

    • @Mustafa-mm4wz
      @Mustafa-mm4wz Před 4 lety

      can i connect with you because the object is the same like your project?

    • @YAHOOOOOO5
      @YAHOOOOOO5 Před 4 lety

      What happens if you change 3B to 3D?

    • @bhupiistersingh4097
      @bhupiistersingh4097 Před 4 lety

      @@Mustafa-mm4wz @Joseph I have the same project. Can you both share the findings ? i am trying to find displacement with help of MPU6050 accelerometer.

    • @bhupiistersingh4097
      @bhupiistersingh4097 Před 4 lety

      I have the same project. Can you share the findings ? i am trying to find displacement with help of MPU6050 accelerometer.

  • @BooktownBoy
    @BooktownBoy Před 4 lety

    Ok, it was quite an easy fix...just run a setup read of gyro data, store it in a new temp variable, then ammend the processdata function to subtract that value before dividing by 131. Thanks again for this video..thumbsup.

  • @siavashnoorb9604
    @siavashnoorb9604 Před 6 lety +3

    Purely superb tutorial! After a long time surfing the web, I finally found this amazing one. Great Job!

  • @unalfaruk
    @unalfaruk Před 5 lety

    The best tutorial I've ever seen. Thank you! However, if your raw data is wrong, your calculation will be wrong, so you should set the offset values of MPU6050. This information may be help other audience.

  • @LegoBeto
    @LegoBeto Před 7 lety +3

    man what a great tutorial! so informative just to get things off the ground. keep up the good work.

  • @eugeniosanguesasubiron5433

    Уважаемый Владимир, с удовольствием просмотрел Ваше видео. Изучаю вариант применения датчика MPU-6050 для коррекции угловых отклонений для радиоуправляемых моделей кораблей. Спасибо!

  • @parthsuyal5879
    @parthsuyal5879 Před 2 lety

    Thank you very much for making things simple, finally able to understand the code and take readings from MPU6050. Seemingly Impossible task now possible.

  • @jctupazvi
    @jctupazvi Před 6 lety

    Bro, this is a very great tutorial! The most important aspects of the applications had been covered including the theory behind the heart of the device. Going line by line on the sketch allows the viewers to immediately identify how they can specifically use the device in a particular application. Superb!!!

  • @theralhaljordan7337
    @theralhaljordan7337 Před 4 lety

    I love that you're just using the Wire library and explaining it stepbystep to us n00bs and not just directing us to a library. can you do a video on the DS1302 RTC or the PCF8574T lcd module?

  • @kaushikprakashrobotics

    This was such a great tutorial. I understand a lot more about the mpu6050 thanks to you now. Can't wait to use it in my robot! Thank you again!

  • @amarjitmoirangcha4521

    thank you a lot you are explaining actual working of it. I really appreciate you for doing it without using other library.

  • @corydiehl764
    @corydiehl764 Před 4 lety

    Thanks dude, this helped me get the sensor working on my nRF9160 DK, and now I understand a bit better how I2C actually works. Not just a silly person using a library anymore :)

  • @michaelcostello6991
    @michaelcostello6991 Před 4 lety +1

    Thank you very much. This was really enlightening. I could understand everything as a novice.

  • @rachnaaggarwal6738
    @rachnaaggarwal6738 Před 4 lety

    Very informative . I was struggling to understand gyroscope and accelerometer readings but now i will be able to manipulate them.

  • @yashsoni2542
    @yashsoni2542 Před 4 lety

    gone through so many video but yours is most accurate and easiest to understand
    thank u .

  • @raulzevallos3399
    @raulzevallos3399 Před 6 lety

    best video of all about 6050, I recommend to use Serial Plotter to see variations easily
    Thanks

  • @Alex220467
    @Alex220467 Před 4 lety +4

    Juste 2 mots:
    - Excellent!
    - Merci :-)

  • @idkwhatonamethiseriously

    The best explanation I ever encountered🤩

  • @maxmillan9378
    @maxmillan9378 Před 6 lety

    So I used your code in order to find the position of a rotating arm (pendulum). A few things you need to change if you want to do that. 1) set all of the variables to floats 2) you need to calibrate the sensor, there should be a +/- in the rotx,y,z equation 3) change the delay time to something smaller to get more accurate results. Otherwise amazing vid.

    • @asifnassar1427
      @asifnassar1427 Před 6 lety

      How did you find the position? I mean, we are getting angular velocity from gyroscope and linear acceleration from accelerometer, right? How did you calculate position from this?

  • @amamonem7183
    @amamonem7183 Před 3 lety

    Best Video about MPU I have ever seen

  • @qcmtechnologiesjsc.
    @qcmtechnologiesjsc. Před 7 lety +2

    Thank so much for the video, it is very easy to me to understand about the MPU - 6050 shortly.

  • @h4tt3n
    @h4tt3n Před 4 lety

    Thank you for this, very thorough. One note, rather than dividing with 16384, you can just do a binary right shift 14 places, since 2^14 = 16384.

  • @surajmate8047
    @surajmate8047 Před 4 lety

    very very thanks because of you i learn how to read datasheet you are the best

  • @sandeepkapare
    @sandeepkapare Před 4 lety

    CZcams unfortunately doesn't allow thumbs up more than once. Excellent video. Please keep going.

  • @lokeshkumar-ec1lf
    @lokeshkumar-ec1lf Před 6 lety

    Best Tutorial ever for MPU6050

  • @takenocrap1892
    @takenocrap1892 Před rokem

    Great Video and thank you so much Vladmir for the clarity and superb explanation.Good job and well done

  • @Aiduss
    @Aiduss Před 5 lety

    Best tutorial i have seen for MPU units

  • @moyeed95
    @moyeed95 Před 7 lety

    outsatanding....best explanation of any thing i have seen ever on youtube.....and thank you very much....it helped a lot

  • @jamesmoon5632
    @jamesmoon5632 Před rokem

    Thanks for explaining and not downloading an example. I want to learn how to implement these projects into my own. So again thanks and subscribed

  • @mahhzlabs92
    @mahhzlabs92 Před 7 lety

    great video tutorial.a lot of learning about MUPU 6050,,
    i watch a lot of video about MPU 6050 but this one is really adorable..

  • @valeriolombardi9744
    @valeriolombardi9744 Před 3 lety

    best tutorial for mpu6050, clear and the code is kept simple , thank you !

  • @muhammadnaqashkhan8276

    Very Nice and best video in all, Thank You sir.
    We have planned to do Sensor fusion including MPU-6050 with GPS on robot using Filter techniques..., I Honorably publish further proceeding in our work.
    Now I have to work in calibration of MPU-6050, For this thanks to you again. :)

  • @peterzetterberg484
    @peterzetterberg484 Před 5 lety

    best explanation ever. To do this on register level givs more
    understanding what to do, then using some already done
    library. Thank you :)

  • @nomadic-insomniac
    @nomadic-insomniac Před 7 lety

    Amazing Tutorial !!
    Its nice to see you explain which registers are to be addressed for the setup and retrieval of data.
    Cant wait to implement this myself =D
    Thank's A lot !!
    Live long and prosper _/\_
    .

  • @sezercetin13
    @sezercetin13 Před 3 lety

    You are a perfect person. Can't be explained better

  • @eric_hallstrom
    @eric_hallstrom Před 8 lety

    This is excellent, lots of coins fell in place for me after watching this video! Id like to see how we can combine the accelerometer -and gyroscope data to measure angels or other interesting motion things! once again, excellent tutorial keep it up!!!

  • @punter123ful
    @punter123ful Před 6 lety

    You are the best out there bro really loved your video never got such in-depth knowledge before this

  • @aarkln
    @aarkln Před 7 lety

    Good explanation, which is needed for a guy from Mechanical Engg like me. :)

  • @francescocampagna4652
    @francescocampagna4652 Před 6 lety

    Thank you very much for your Video, all youtube videos should be done like your, brief and clear. Well done!!

  • @andrewwhite1793
    @andrewwhite1793 Před 4 lety

    This IS the professional method to control the silicon. Controlling a chip through someone else's imperfect drivers is limiting and can be harder that directly reading and writing to registers..

  • @mohandass.j1376
    @mohandass.j1376 Před 6 lety

    Awesome explanation man... There is no word to pride you...

  • @marosakr778
    @marosakr778 Před 4 lety

    My greeting and thanks for this very informative and helpful Video , just a very tiny and small comment ( to convert the output values ´from accelerometer into g by the mentioned Example , it has to be (2*20000 /16384 = 2.44 g ). Also the new data sheet doesn't have all of those details unfortunately., and the LSB is now g not mg . That means you have to check the LSB sensetivity in the data sheet:
    Really a great Work.

  • @emanuelsiu1232
    @emanuelsiu1232 Před rokem

    SO Good, thank you for explaining these details!

  • @MuhammadUsman-wb9kf
    @MuhammadUsman-wb9kf Před 5 lety

    well done bro. It really help us in our quardcopter controlling and balancing using MPU6050..

  • @Willpowerstudios
    @Willpowerstudios Před 6 lety

    I got it working. Thank you so much for explaining the process with such great detail !

  • @QHRebel76
    @QHRebel76 Před 7 lety

    You are great!! I have been looking for a video this detailed. Thank you for everything I hope you produce many more tutorials.

  • @andreu_jaja96
    @andreu_jaja96 Před 6 lety

    this video has literaly saved my project. Thank you so much

  • @pano6035
    @pano6035 Před 4 lety

    Thank you the best tutorial on CZcams

  • @zmn88sw
    @zmn88sw Před 7 lety

    Excellent explanation about MPU6050 !

  • @dimitricugini2467
    @dimitricugini2467 Před 6 lety

    Fantastic video! Been searching for a tutorial just like this!

  • @princeibrahim1
    @princeibrahim1 Před 7 lety

    That was the most descriptive and complete explanation which made it easier for me to understand. A big thumbs up buddy... :)
    BTW can you explain self balancing using this MPU6050 ???

  • @August301989
    @August301989 Před 5 lety

    this is the best tutorial Ive seen so far in youtube regarding MPU6050! oh man cant thank enough. some youtubers are lazy to explain line by line. Just one thing may I know what does accelx = wire.read()

  • @mareksbrt
    @mareksbrt Před 7 lety

    Really big thanks, followed your tutorial, but used MPU9250... Quite similar, just on MPU9250 it has also sleep mode for accel and gyro. :)

  • @timonasjuonys6536
    @timonasjuonys6536 Před rokem

    perfect, just what i was looking at, thanks

  • @abd-elrahmanmohamed9839

    Thanks a lot ! Really the best tutorial about about MPU6050 .

    • @EEEnthusiast
      @EEEnthusiast  Před 6 lety +1

      Thank you sir. Appreciate the kind feedback

  • @rahultripathy831
    @rahultripathy831 Před 5 lety

    Awesome 😍 video. Man.. Now, I am your fan. Just the stuff I needed. Brilliantly explained. Keep it up. Let me know if there's anything I can do for you ever.

  • @rubikon7648
    @rubikon7648 Před 2 lety

    Very nice and complete explanation, thank you very much

  • @RodrigoCruz-iz3kb
    @RodrigoCruz-iz3kb Před 5 lety

    Thanks a lot for the lesson! You just helped me solving an issue in my university's project!

  • @alhdlakhfdqw
    @alhdlakhfdqw Před 8 lety +1

    great video man! loved it and very nicely put together! TQ :) keep it up man

  • @lungumd
    @lungumd Před 3 lety

    dividing raw gyro data by 131, you actually get deg/s. So if you want to get the actual position in degrees you'll need to multiply that by time component

  • @jakesoft
    @jakesoft Před 7 lety

    Thanks for this video. It helped fill in the blanks for my project.

  • @praveshnarayan7850
    @praveshnarayan7850 Před 4 lety

    Thanks man, I loved your explanatory skills and content.

  • @adR9990
    @adR9990 Před 6 lety

    Amazing demonstration and tutorial, has helped me learn a lot for my project.