MPU-6050 Module 3 Axis Gyroscope + Accelerometer (018-MPU-6050)

This is a placeholder topic for “MPU-6050 Module 3 Axis Gyroscope + Accelerometer” comments.

A 3-axis gyroscope and 3-axis accelerometer housed on a development board ready for prototyping.

Read more

1 Like

I think the first line of the MicroPython example should be
from imu import MPU6050

2 Likes

Hey @Jan282683, welcome to the forums!

Looks like that example code is a little outdated, I have passed this onto our team and this should be updated on the website soon. In the meantime feel free to use this update code instead

from imu import MPU6050
from time import sleep
from machine import Pin, I2C

import math

i2c = I2C(0, sda=Pin(8), scl=Pin(9), freq=400000)
imu = MPU6050(i2c)

while True:
    ax=round(imu.accel.x,2)
    ay=round(imu.accel.y,2)
    az=round(imu.accel.z,2)
    gx=round(imu.gyro.x)
    gy=round(imu.gyro.y)
    gz=round(imu.gyro.z)
    tem=round(imu.temperature,2)
        
    pitch = math.atan2(ax,az)
    roll = math.atan2(ay,az)
    
    print("Pitch",pitch,"/t","Roll",roll)
    
    # Uncomment line below to show acceleration
#     print("ax",ax,"\t","ay",ay,"\t","az",az)
    
    # Uncomment line below to show acceleration
#     print("gx",gx,"\t","gy",gy,"\t","gz",gz)

    sleep(0.2)

Thanks for bring that to our attention!

1 Like

I am after more of the pins that come with MPU-6050 however cannot find the name/specs. Can you let me know what product these are? Thanks!

2 Likes

Hi Annabelle
Core call them “Male pin header 2.54mm”. Put that into the search bar in the Core Shop section.
They can come in various lengths but a common approach is to purchase 40 pin strips and cut/break off the length required.
Other vendors I think call them the same thing and are commonly available.
Cheers Bob

2 Likes

Hey there, @Annabelle315947,

Jumping off what Bob has said, I’m unsure if you’re after the straight or right angled varieties, so please find both linked two below. Cheers.