Thumbnail

MPU6050 Accelerometer Gyro Temperature

Reads MPU6050 gyro, accelerometer and temperature via I2C, initializes and returns data on-demand to EZ-Script variables using ControlCommand RunOnce

Compatible with: Compatible with Microsoft Windows 10 or 11 Windows

How to add the MPU6050 Accelerometer Gyro Temperature robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the I2C category tab.
  5. Press the MPU6050 Accelerometer Gyro Temperature icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the MPU6050 Accelerometer Gyro Temperature robot skill.


How to use the MPU6050 Accelerometer Gyro Temperature robot skill

Before You Start (Beginner Checklist)

  1. Hardware connected: Plug the MPU6050 EZ-Bit into the EZ-B’s I2C port.
    Important: I2C devices require the correct wiring. If the sensor is not connected properly (or not connected at all), the EZ-B v4 can lock up when a read is attempted.
  2. Add the skill to your ARC project: Add the MPU6050 control/skill to the ARC workspace.
  3. Have a way to run a script: Add an EZ-Script control where you will place the example code below.

Key Concept: INIT First, Then Read On Demand

This skill does not continuously read the sensor automatically. You must:

  • Run Init once to initialize the MPU6050.
  • Run RunOnce each time you want fresh sensor values.

Where the Sensor Data Goes (EZ-Script Variables)

Each time you read the MPU6050, this skill updates a set of EZ-Script Variables. The exact variable names can vary by version/configuration, so the easiest way to see them is:

  1. Click the Config button on the MPU6050 control.
  2. Look for the list of variables that the skill updates.
  3. Use the Variable Watcher to watch those values change live.

Example: Read the MPU6050 Every 100ms (10 Times/Second)

The script below initializes the sensor once, then loops forever. Every loop it:

  • Requests a new reading from the MPU6050 using RunOnce
  • Waits 100 milliseconds
  • Repeats
ControlCommand("MPU6050", Init)

:loop

ControlCommand("MPU6050", RunOnce)

Sleep(100)

Goto(loop)

Troubleshooting

  • EZ-B v4 locks up when running the script: This usually means the MPU6050 is not connected correctly, not powered, or not on I2C. Disconnect power, check the I2C connection, then try again.
  • Variables are not changing: Make sure you ran Init first, and that the loop is calling RunOnce. Also confirm you’re watching the correct variables in the Variable Watcher.
  • Data looks “noisy” or jumpy: That is common with IMU sensors. Consider averaging values in your script or reading at a steadier rate.

Example Project (Video Mention)

A working example is shown in the video using the JD project with the MPU sensor. You can find it in the EZ-Cloud as: JD With MPU6050 Accelerometer.

How It Works (Learn More)

Want to understand IMU sensors (accelerometer + gyro) in more detail? This is an excellent beginner-friendly article: https://www.starlino.com/imu_guide.html

Video


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

Author Avatar
PRO
Canada
#17  

Oh! My bad, sometimes I make assumptions about people who are DIYers. You could easily place resistors in parallel with the 2.2kohm resistors to drop the resistance and strengthen the pullup. No soldering required! They can even be through hole for that matter.

You simply place a 470ohm resistor between SDA and 3.3V pins and you will be putting it parallel with the 2.2kohm. Do the same for the SCL side.

#18  

Well I think I did this ok.   Jeremie question for you is there anyway to get another ezb4 case?  Not the power base.

User-inserted image

Author Avatar
PRO
Canada
#19  

So if you’d like to 3D print one I believe the STL file is available for the top and bottom plastic pieces for the EZ-Bv4. Otherwise, you could send a message to ez-robot customer service to see how much it would be to send you some plastics.

#21  

Too bad you don't need the power base. I have like 5 sitting here empty I could just give you. A number of years ago I needed a new case for the EZB board set. I sent a request like Jeremie suggests and was able to get one right away. Hopefully they still have them available for you. Good luck!

#22   — Edited

Jeremie,   Thanks but I could not find them on the EZ Robot website.  Please don't take this the wrong way but that site needs a lot of work has lots of bad links and also old data.  Kind of looks like the your web master needs to be replaced LOL.

Author Avatar
PRO
Canada
#23  

@smiller29 I’d have to have a look on the website myself but you’ll also find the STLs on Thingiverse (EZ-Robot).

If you’re looking for the injection molded plastics themselves they aren’t listed on the website, you’ll have to contact customer service directly through the website.

The EZ-Robot website was migrated over the last couple years and does still need some maintenance and corrections. In due time it will see improvements.

#24  

Jeremie, I meant the .stl files. I could not find them on the site.