Measure Angles Easily with MPU6050 and ESP32: Part 1 - Library Walkthrough

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 มิ.ย. 2024
  • Learn how to use the i2cdevlib to find the orientation of your device with the MPU6050. This is a great library that uses sensor fusion from the accelerometer and gyro with some filtering techniques to give you accurate angle values in static and dynamic applications, perfect for drones and robotics. Best of all, you can get started in a matter of minutes following this tutorial.
    TIMESTAMPS
    00:00 Intro
    00:10 Background
    02:00 Physical Setup
    03:13 VSCode Project Setup
    05:44 Library Setup
    07:10 Example Code Walkthrough
    Link to Blog Post:
    shillehtek.com/blogs/news/mea...
    ESP32 Where to Buy
    www.amazon.com/HiLetgo-ESP-WR...
    MPU6050 Where to Buy
    www.amazon.com/dp/B0BMY15TC4?...
    PlatformIO Website
    docs.platformio.org/en/latest...
    Repo i2cdevlib
    github.com/jrowberg/i2cdevlib...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 19

  • @mmshilleh
    @mmshilleh  9 หลายเดือนก่อน +2

    If this helped you please consider supporting the channel at www.buymeacoffee.com/mmshilleh or if you want to book a chat with me.
    Please remember to sub to the channel if you have not, would be highly appreciated! Thanks!

  • @jacksonischillin
    @jacksonischillin หลายเดือนก่อน +1

    great video, was struggling hard with arduino and this really got me to where i needed to be.

    • @mmshilleh
      @mmshilleh  หลายเดือนก่อน +1

      That's amazing to hear, hope I earned your subscription!

  • @pppooppoo7763
    @pppooppoo7763 11 วันที่ผ่านมา +1

    Does the MPU6050 with this library measure angles in its own reference frame or the global reference frame?

    • @mmshilleh
      @mmshilleh  9 วันที่ผ่านมา

      Its own reference it should be

  • @math8149
    @math8149 5 วันที่ผ่านมา +1

    your videos are really great sir......, But in my case, I'm working on a project where i wanted to measure the lean angle of motorbikes while turning or doing any other angle changes. In here, i'm stuggling with the reference point. I mean if I upload the code and start the system, it shows XYZ - Roll pitch yaw angles are nearly zero. When I "START" the device they are zero, which means in any direction, if I start the device, it takes it as a reference point. I think you got my point. Is there any way (by using complex maths or different sensors or whatever) that i can set the sea water level(or global flat reference) as my starting point/reference point even if I start the system in any direction or any angle.... HOPE you would reply me sir

    • @mmshilleh
      @mmshilleh  4 วันที่ผ่านมา

      Hard to say, seems too complex to discuss over YT comments to be frank with you

  • @ltetzner1
    @ltetzner1 3 หลายเดือนก่อน +1

    I have a esp32 marked "WiFi ESP-WROM-32". I was just using it with a OLED display running i2C script. It was working fine. I added the MPU6050, and connected to the Same SDA/SCL lines. And of course the 3V and Gnd. When I run this code I too get "
    Initializing I2C devices...
    Testing device connections...
    MPU6050 connection failed
    The comments section says that the MPU6050 interrupt pin must be connected, but I did not see that in your connection image. When I press a character no values are shown, because connection to mpu6050 failed (I'm sure). I have used the MPU6050 in the Arduino environment with different code, and it was working. Any other ideas on what could be going wrong here?

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

      Thank you for sharing your experience. It sounds like you've encountered a common challenge when adding multiple I2C devices. Here are a few considerations that might help resolve the issue with your ESP32 and MPU6050 setup:
      I2C Addresses: Ensure both the OLED display and the MPU6050 have unique I2C addresses. You can run an I2C scan to verify this.
      Power Supply: Adding more devices can increase the power demand. Ensure your ESP32's power supply is sufficient and stable.
      Pull-up Resistors: Check if your setup requires external pull-up resistors on the SDA and SCL lines. Some boards have them built-in, but others might need them added externally.
      Interrupt Pin: While the MPU6050's interrupt pin is not always necessary for basic operations, it's crucial for certain features. If my connection image didn't show it, I apologize for the oversight. Connecting the interrupt pin to an available GPIO on your ESP32 and configuring it in your code might resolve the connection issue.
      Software Libraries and Code: Verify that the libraries you're using are compatible with both the ESP32 and the MPU6050, and that your code is correctly initialized for both devices on the same I2C bus.
      If you've tried these steps and are still facing issues, consider reaching out for more personalized advice. For detailed troubleshooting, you might find a consultation or a deeper engagement through my channel's membership very helpful. This could provide more specific guidance tailored to your setup.

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

      Hello,
      Esp32 has two physical independent i2c interfaces. Please give it a try !

  • @King-yp8vj
    @King-yp8vj 8 หลายเดือนก่อน +1

    Hello, how come my serial output says MPU6050 connection failed

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

      Are you sure your wiring is correct? Have you used your MPU before?

  • @RGPinger
    @RGPinger 5 หลายเดือนก่อน +1

    use float values in uint_16 variables

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

      Yeah probably should !

  • @harinimanivannan8641
    @harinimanivannan8641 29 วันที่ผ่านมา +1

    How much time will the new project takes to get downloaded ?

    • @mmshilleh
      @mmshilleh  28 วันที่ผ่านมา

      Not sure what you mean!

  • @aghoribgmi4355
    @aghoribgmi4355 3 หลายเดือนก่อน +1

    When you leave the sensor flat, the yaw value keeps on increasing. In your case also I saw it kept on increasing. How can it be accurate??

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

      I think the yaw is subject to a lot of drift with the MPU6050 because
      1-) We did not calibrate perfectly
      2-) Yaw is better measured utilizing sensor fusion with a magnetometer not available on this version of the MPU. You would need a 9250 for that and probably some other equations!

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

      @@mmshilleh I have tried that sensor also. Magnetometer in general comes with many limitations (especially in my use case)