MPU6050 with Arduino - GY-521

Поделиться
HTML-код
  • Опубликовано: 30 июл 2024
  • This vide will cover how to use the MPU6050 accelerometer and gyroscope module (GY-521) with Arduino. We’ll focus on basics, module pins, how to connect to Arduino, programming in Arduino IDE, and testing. We will also show how to use the sensor along with Processing IDE to visualize the readings from the accelerometer / gyroscope.
    Related Blog Post: www.diyengineers.com/2021/05/...
    Items used in this video (affiliate links):
    *As an Amazon Associate I earn from qualifying purchases.
    Arduino UNO:
    amzn.to/3U7xAoT
    MPU-6050 Accelerometer/Gyroscope (GY-521):
    amzn.to/3U6oMiZ
    Chapters:
    0:00 Intro
    0:38 MPU6050 Sensor Basics
    2:02 Connecting to Arduino
    2:33 Programming & Testing in Arduino
    6:10 Integrating MPU6050 with Processing IDE
  • НаукаНаука

Комментарии • 75

  • @himadreemctavish5092
    @himadreemctavish5092 8 месяцев назад +7

    This was so far the most straight forward and best tutorial on mpu6050. Thanks man.

  • @HaseebAdnan0
    @HaseebAdnan0 5 месяцев назад +1

    So Paul McWhorter's channel should be your go to for getting started with arduino, and then this channel is good to do more advanced projects

  • @martinlentz-nielsen6361
    @martinlentz-nielsen6361 2 года назад +3

    Thank you, thank you, thank you for the video!!! ❤️❤️❤️

  • @friendlybear5924
    @friendlybear5924 Год назад

    Hey there! I really like your video and followed your steps. The visualization in P5 works great. However, only for a couple seconds. After that the rotation drifts off until there is no more data coming from the arduino. Is there a way to ensure a constant data stream?

  • @avivbello
    @avivbello Год назад +2

    Hi, thank you for the great video!
    Say, if I follow your tutorial step by step exactly, and the Arduino won't connect with the sensor, serial outputs: "MPU6050 connection failed",
    How would you suggest to find the connection problem?
    Thank you again!

  • @qzorn4440
    @qzorn4440 7 месяцев назад

    Most interesting. 😎 Thanks.

  • @shivpat6522
    @shivpat6522 5 месяцев назад +9

    toxiclibs doesnt exist in my processing ide for some reason. may I get assistance for that?

  • @user-cz6vu7pe3x
    @user-cz6vu7pe3x 4 месяца назад

    I have the 4.3 version and ToxicLib is not available in the library. How can I get past this problem?

  • @michealsakr3830
    @michealsakr3830 Год назад

    what is the unit of the real acceleration shown in the video?
    is it g or 2*g?

  • @thelazycat_
    @thelazycat_ 2 года назад

    I don't have a processing and teapot folder, know why?

  • @frenkkotarigan
    @frenkkotarigan Год назад

    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? 🙏

  • @shadowhunter8803
    @shadowhunter8803 Год назад +1

    If i install nodemcu here, can the 3d model work wirelessly as well?

  • @lucasrba
    @lucasrba 2 года назад

    Why acceleration is showing this values of the video?
    It should not show something near to (0, 9.81, 0), considering an almost orthogonal orientation?

  • @thisisgood44
    @thisisgood44 5 месяцев назад

    sir can you help me? my mpu6050 gives accelerometer z which is the yaw to be a constant even when i rotate, i dont understand why, but some comments suggest to buy an imu with magenotometer, but the gyro z that i read is still updating when i turn the imu sensor
    edit : i used adafruit library but after trying the electronic cats library i think it works

  • @PranayKumar-ns1uw
    @PranayKumar-ns1uw 2 года назад

    How can I use this 6dof Stewart platform

  • @jstro-hobbytech
    @jstro-hobbytech Год назад

    I'm like a tick. Sorry.
    Did you have to write all the filters and such to keep the gyro from drifting?

  • @zejunlooi4270
    @zejunlooi4270 2 года назад +1

    Thanks for the detailed explanation about MPU6050. Do I need a plane shown in the vid for 3D visualization? Would appreciate your advice

    • @diyengineers
      @diyengineers  2 года назад

      I think you can actually use other models for the visualization.

  • @justinc2633
    @justinc2633 Год назад

    you should test the accuracy of this, by moving it a whole bunch and calculating where it should be then measuring any discrepancy

  • @FlightHeroRC1
    @FlightHeroRC1 Год назад

    how do i turn this into an artificial horizon

  • @bruhmetsaiharnet6595
    @bruhmetsaiharnet6595 2 года назад

    superb"specified folder/zip file does not contain a valid library"problem installing i2cdev.library,no problem encountered installing zip libraries before but with this one i had problem.any idea why?Thanks in advance.

  • @IgorSantarek
    @IgorSantarek Год назад

    It works for few seconds and then the whole arduino frezees. I did connect AD0 pin to ground, the SCL and SDA are connected to VCC by resistors each 10kOhm, the INT pin connected to pin 2 on my Arduino Mega 2560 board. I can see the plane rotating and then everything freezes and only restarting arduino fixes this. :|
    I have been trying to fix it for few hours now and nothing works. Only when I use libraries that does not use DMP, the arudino doesn't freeze and everything works smoothly but I don't have any precision and the results get inaccurate pretty quickly.

  • @eshanverma1496
    @eshanverma1496 Год назад

    Can it go forward and backward?

  • @PixelCodes
    @PixelCodes Год назад

    It won't download on the arduino uno. Help!

  • @AbdulRahman-jz3px
    @AbdulRahman-jz3px Год назад

    Hi, thanks for the excellent explanation. i want to ask, is it linear acceleration or angular acceleration which can be measured by MPU6050? can it be used to measure angular acceleration?

    • @ianyu4281
      @ianyu4281 9 месяцев назад

      It can measure both since it has an accelerometer and a gyroscope hence then name 6 axies of freedom

  • @Venaber
    @Venaber Год назад

    so much thanks

  • @joegreener4092
    @joegreener4092 2 года назад

    Nice video, how would you change the code so the range is +-8g for real acceleration
    ?

    • @mibrahim4245
      @mibrahim4245 2 года назад

      You should find the address of the corresponding register from the datasheet

  • @ahmednader4377
    @ahmednader4377 2 года назад +1

    Is it possible to use mpu6050 to calculate the displacement of a moving robot , Thanks in advance !

    • @diyengineers
      @diyengineers  2 года назад

      Hi! It will be very difficult to do so accurately because doing so would require performing an double integration of acceleration over time. The issue is that the error in measurement would be greatly amplified during such integration, which would lead to gross error in total displacement. Net, great in theory, but not so much in practice.

  • @RandomloserDK
    @RandomloserDK Год назад

    Is it normal for the main loop to end after ~10 sec?
    I can't tell if there's a way to extend it.

    • @michealsakr3830
      @michealsakr3830 Год назад

      remove the interrupt wire and stop it manually

  • @carlacavazzuti2785
    @carlacavazzuti2785 2 года назад

    Hi, amazing project! But my processing doesn't work...while data are available on serial monitor.
    Could you help me?

    • @haroldfinz5031
      @haroldfinz5031 2 года назад

      2 things I did before I got Processing to work: I closed arduino's serial monitor, because I was getting a "port busy" error; (2) I printed the values of "Serial.list()" and I saw that the port that matched what Arduino was using was at index [2], not [0]. btw I'm using a Mac.

  • @bh641
    @bh641 2 года назад +2

    My program stops working after around 20 seconds, is there anyway I can fix this? Appreciate it!

    • @oguve278
      @oguve278 2 года назад

      I realized to prevent this, just disconnect and stop using the Interrupt pin...

  • @kalamabidin922
    @kalamabidin922 Год назад +3

    in processing ide, i tried to add toxic lib. but it is not showing the library name, can u tell what to do now, followed all your instructions/steps

    • @usaamahebrahim2161
      @usaamahebrahim2161 Год назад

      Had the same issue, I'm not exactly sure how to add it manually as well. Please let me know if you find a solution, thanks

    • @usaamahebrahim2161
      @usaamahebrahim2161 Год назад

      ruclips.net/video/kyX9cRxJNdo/видео.html

    • @danielem2362
      @danielem2362 5 месяцев назад

      Had the same issue, ...can anyone help?

  • @astrogaming2336
    @astrogaming2336 Год назад

    For the serial port, it is deciding to spew out random characters, and not actual numbers. Idk why its doing this, but could someone help?

    • @ismaildz5795
      @ismaildz5795 Год назад +1

      Switch the serial monitor window to 115200 baud

  • @PreciousOpal
    @PreciousOpal 2 года назад

    I want to jump off the highest bridge, hell...just help me and ill jump off the quadcopter i make, im mad af, i cant get multiwii to aknolege my arduino board, sensors work i seen the cereal port work, then i kept getting issues with the processingide software download dont have the ide in the unzipped files....then now the cereal port shows axis gyro but after like 2 seconds stoops reporting sensor like it stoped, i unplug it plug it back and its work again but stops after a few seconds....i cant get the processing app downloaded, any guidance would help, right now i feel like tossing all these modules for arduino and getting a full on flight controller and saying to hell with arduino

    • @PreciousOpal
      @PreciousOpal 2 года назад

      i was wanting to build a flight board with ports to make it completly modular with gyro not with flight controller, making the gyro replacement easy as unplug jst

  • @shuttyskenzin9237
    @shuttyskenzin9237 2 года назад

    hi, i have a code error for the mpu6050 code. C:\Users\admin\OneDrive\Documents\Arduino\libraries\MPU6050\src\MPU6050.cpp:254:6: note: implicit this pointer type mismatch
    void MPU6050::setFullScaleGyroRange(uint8_t range) {

    • @eggxecution
      @eggxecution 2 года назад +1

      After downloading the library from the video, I saw that there are other libraries that are required to run the code maybe it is a factor. I read the line:
      // 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

    • @diyengineers
      @diyengineers  2 года назад

      Make sure you have all the required libraries! Thanks for watching.

  • @shuttyskenzin9237
    @shuttyskenzin9237 2 года назад +1

    Hi, could anyone copy paste the mputeapot code for the process ide because i cant find it so if anyone can see it then please copy paste it in here thank you.

    • @diyengineers
      @diyengineers  2 года назад

      Hi! Thank you for watching this video and for calling out that the link wasn't available. The link to the Processing IDE download can be found on the blog post related to this video. The only issue is that I originally placed the link to the wrong post on the video description, but I have now corrected this.
      Thanks for watching. Please let me know if you have other questions.

    • @shuttyskenzin9237
      @shuttyskenzin9237 2 года назад

      @@diyengineers Oh I just realized that i do have the process ide link but what i am looking for is the teapot code thing which will show the 3d visualization screen. so i need to code not the ide. I already have the ide. Thanks

    • @diyengineers
      @diyengineers  2 года назад

      Hi! See below (these instructions are on my blog as well):
      Once you have deployed the code above in your Arduino, go back to Processing IDE and go to File, then Open. Go to the folder where the MPU6050 Arduino library was installed. Once you get to the folder, open the Processing file with the name “MPU Teapot”.
      To find this file, go to the folder where all Arduino main files are located, then follow this path: Documents\Arduino\libraries\MPU6050\examples\MPU6050_DMP6\Processing\MPUTeapot.
      If you have trouble finding the location of the main Arduino folder, within Arduino, click on File, then click on Preferences. Go to this folder and follow this path within Processing IDE (after clicking File -> Open).

  • @IttesafHossain27
    @IttesafHossain27 Год назад +2

    Can anyone tell me the difference between MPU6050 and GY-521?

    • @Meddlmoe
      @Meddlmoe Год назад

      MPU6050 is the chip on the GY-521 break out board

  • @michaelzajac5284
    @michaelzajac5284 3 года назад

    I was seriously considering about wireless to sensor pin inside the aircraft or rocket.

    • @diyengineers
      @diyengineers  3 года назад +1

      Thanks for watching! You would just want to make sure you pick a micro controller that's appropriate considering the space constraints and then figure out how to address the wireless communication for your application.

    • @michaelzajac5284
      @michaelzajac5284 3 года назад +1

      @@diyengineers
      I obviously the SpaceX Land was test in same circuit.

    • @diyengineers
      @diyengineers  3 года назад

      LOL 😂

  • @EmpyreanLightASMR
    @EmpyreanLightASMR Год назад

    Your code is so full of errors, when I compile from a brand new version of that code, it's just a fountain of errors. I'm new so I have no idea what to do.

  • @AlexIdk.
    @AlexIdk. 2 года назад +3

    The link to download Processing IDE: processing.org/download

    • @diyengineers
      @diyengineers  2 года назад

      Thanks for watching and sharing!

    • @AlexIdk.
      @AlexIdk. 2 года назад

      ​@@diyengineers Hello, do you have an idea why the 3D model does not point to the position of the module instead it points in a different direction?

    • @AlexIdk.
      @AlexIdk. 2 года назад

      Nevermind i found out why, it was oriented diffrently but now after a while it moves random but it might be because of noise

  • @mircevojvoda6478
    @mircevojvoda6478 3 месяца назад

    toxiclibs are nonexistent in processing, as I see that library is deprecated.

  • @yori1
    @yori1 2 года назад +1

    my serial monitor is printing things like "⸮

    • @tangguh9796
      @tangguh9796 2 года назад +1

      change your baud rate to 115200

    • @oguve278
      @oguve278 2 года назад

      @@tangguh9796 Thanks

    • @tangguh9796
      @tangguh9796 2 года назад

      @@oguve278 do you have problem with 3D simulation ?

    • @oguve278
      @oguve278 2 года назад

      tangguh oh no no, your comment to change the baud rate solved my problem 👍

    • @tangguh9796
      @tangguh9796 2 года назад

      @@oguve278 I'm just asking, cause my simulation doesn't move at all
      but in the serial monitor work perfectly