MPU6050 with Arduino - GY-521

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 มิ.ย. 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 6 หลายเดือนก่อน +6

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

  • @martinlentz-nielsen6361
    @martinlentz-nielsen6361 2 ปีที่แล้ว +3

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

    • @diyengineers
      @diyengineers  2 ปีที่แล้ว +1

      Thank you for watching!

  • @HaseebAdnan0
    @HaseebAdnan0 3 หลายเดือนก่อน +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

  • @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?

  • @qzorn4440
    @qzorn4440 5 หลายเดือนก่อน

    Most interesting. 😎 Thanks.

  • @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!

  • @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

  • @shivpat6522
    @shivpat6522 3 หลายเดือนก่อน +9

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

  • @michealsakr3830
    @michealsakr3830 ปีที่แล้ว

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

  • @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?

  • @shadowhunter8803
    @shadowhunter8803 ปีที่แล้ว

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

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

  • @user-cz6vu7pe3x
    @user-cz6vu7pe3x 2 หลายเดือนก่อน

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

  • @Venaber
    @Venaber 11 หลายเดือนก่อน

    so much thanks

  • @thelazycat_
    @thelazycat_ 2 ปีที่แล้ว

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

  • @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 7 หลายเดือนก่อน

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

  • @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 3 หลายเดือนก่อน

    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

  • @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

  • @PranayKumar-ns1uw
    @PranayKumar-ns1uw ปีที่แล้ว

    How can I use this 6dof Stewart platform

  • @IgorSantarek
    @IgorSantarek 10 หลายเดือนก่อน

    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.

  • @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.

  • @bruhmetsaiharnet6595
    @bruhmetsaiharnet6595 ปีที่แล้ว

    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.

  • @FlightHeroRC1
    @FlightHeroRC1 10 หลายเดือนก่อน

    how do i turn this into an artificial horizon

  • @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 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.

  • @eshanverma1496
    @eshanverma1496 ปีที่แล้ว

    Can it go forward and backward?

  • @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 11 หลายเดือนก่อน

      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 11 หลายเดือนก่อน

      th-cam.com/video/kyX9cRxJNdo/w-d-xo.html

    • @danielem2362
      @danielem2362 4 หลายเดือนก่อน

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

  • @PixelCodes
    @PixelCodes ปีที่แล้ว

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

  • @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 😂

  • @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

  • @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

  • @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).

  • @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.

  • @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

  • @EmpyreanLightASMR
    @EmpyreanLightASMR 11 หลายเดือนก่อน

    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.

  • @mircevojvoda6478
    @mircevojvoda6478 หลายเดือนก่อน

    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