Thumbnail

MPU6050 Tilt Angle Sensor

The MPU-6050 sensor contains a MEMS accelerometer and a MEMS gyro in a single chip. It is very accurate, as it contains a 16-bits analog to digital conversion hardware for each channel. Therefor it captures the x, y, and z channel at the same time. The sensor uses the I2C-bus to interface with the Arduino. This plugin uses the MPU6050 sensor to measure the angular position of X, Y & Z-axis.

How to add the MPU6050 Tilt Angle Sensor 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 Tilt Angle Sensor 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 Tilt Angle Sensor robot skill.

How to use the MPU6050 Tilt Angle Sensor robot skill

You need to flash the firmware to the Arduino. With this firmware you can use both the DHT11 and the MPU6050 sensors at the same time. EZ-Genuino_DTH11_MPU6050_Uno.zip For the DTH11 wiring help go Here. For the MPU connect like pic. The variables $AngleX, $AngleY and $AngleZ are created. Have Fun! User-inserted image


ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

PRO
Synthiam
#1  

Oh man this is a gooder. I like playing with accelerometers. Thanks!

Portugal
#2  

Thanks DJ! Hope the community finds it useful.

#3  

Hello.

Do you mind giving an example using a script to auto move the X, Y, Z controling the servos to keep the robot up-right.  I hope I'm asking the right question.

Thanks in advance, merne

#4  

@proteusy,

I not sure bit I think this needs more work.  the script does not assign a port number that I can tell, also does it use USB on the to communicate on the Arduino.  It would also be nice if you could use the Tx and Rx on the Arduino to connect to the EZB4 1/2 digetal port freeing up a USB port.

I also had issues applying the Arduino firmware regarding the DHT11. I had to use the double // makes to apply the firmware.  I tested the MUP-6050 and I'm not sure it was working.

Please let me know what you think.  Thank you for your time making this skill.  I do not have the knowledge making a skill or writing scripts for Arduino.

Let me know if I left anything out.

Thank you proteusy! Cheers, merne

Portugal
#5   — Edited

Hi merne,

Quote:

I not sure bit I think this needs more work. the script does not assign a port number that I can tell, also does it use USB on the to communicate on the Arduino.
What port number are you referring to? It assumes it is EZB#0 at 57600 baud.

Quote:

It would also be nice if you could use the Tx and Rx on the Arduino to connect to the EZB4 1/2 digetal port freeing up a USB port.
Sorry but I do not use the EZB. I use an sbc connected to arduinos.

Quote:

I also had issues applying the Arduino firmware regarding the DHT11. I had to use the double // makes to apply the firmware. I tested the MUP-6050 and I'm not sure it was working.
The firmware loads fine. Where did you put the comment slashes to apply the firmware? Did you get any values in the x, y and z variables?

Quote:

Thank you for your time making this skill. I do not have the knowledge making a skill or writing scripts for Arduino.
Thank you merne, it is a skill I use in my robot and I am happy to share with the community. All I have done is modify a created skill (Wheel encoder) by DJ to suit my needs.

#6  

Hi proteusy,

I currently have the Arduino USB connected to my PC's USB port to test the 6050.

I opened the firmware "EZ-Genuino_DTH11_MPU6050" Then pressed the button on the Arduino and then pressed the upload button on the Arfuino IDE.

That's when it stopped at the... "rduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Uno" C:\Users\Limitedtime\Downloads\lbaltr1a(1)\EZ-Genuino_DTH11_MPU6050\EZ-Genuino_DTH11_MPU6050.ino:6:17: fatal error: DHT.h: No such file or directory #include "DHT.h" ^ compilation terminated. exit status 1 Error compiling for board Arduino/Genuino Uno. "

So I put the comment slashes anytime I got the error.  Like I said I am very new at this Arduino stuff.  Should I have loaded the ARC firmware on the Arduino Uno first?  I did not get any XYZ info in your MPU6050 Tilt Angle box.

If you have the time and would not mind hand walking me through how tp load your firmware that would be great. I thought this 6050 was for auto correcting X, Y, Z position to help keep the robot upright.

Also, I can not figure out how to use this new text format to add quotes, ect.  I like the old ez robot format better, but I'm not the guy in charge. :p

Portugal
#7  

You must download the DHT library in Arduino IDE.

Portugal
#8   — Edited

In arduino ide program goto: Tools-Manage libraries and search for dht sensor library and install.

To make a robot balanced is not an easy task. You must use PID algorithm.

#9  

Hi Again,

I did load the ACE firmware on my Uno and tried to install your fireware, I'm now getting this error....

"Arduino: 1.8.15 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)" EZ-Genuino_DTH11_MPU6050:6:10: fatal error: SendOnlySoftwareSerial.h: No such file or directory #include ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. exit status 1 SendOnlySoftwareSerial.h: No such file or directory "

Thank you a lot for your help! merne

Portugal
#10  

What is ACE firmware?

Quote:

"Arduino: 1.8.15 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
It seems that you selected arduino mega, use uno.

#11  

Sorry about saying ACE, it should have said ARC.

I uninstalled all firmware on my Uno and uploaded your firmware and it worked, after changing it to Arduino Uno first.

How are you using your Arduino Uno on you SBC, are you connecting it using the USB on your sbc?  Also are using the ARC Arduino firmware?

Thanks again for you help!

Cheers

Portugal
#12  

Merne, the firmware for the mpu is ARC Arduino firmware. I just added the mpu code.  I use USB to connect my SBC to Arduino.

#13  

Hi proteusy,

Everything is working now.  The only thing I need now are wheel encoders for the MPU to work.  Thanks for all your help!!!

sincerely merne

#14   — Edited

I have been trying to get skill to work and have had no luck.  I am using an UNO but the firmware just does not seem to work I am getting no activity in ARC after connecting to the board in the skill window.  It should be noted I am not using the DTH11 sensor.   I don't know if anyone can help with this.

User-inserted image

User-inserted image

PRO
Canada
#15  

Hello @smiller29,

I believe that you might run into trouble with connecting an MPU-6050 sensor directly to an Arduino as it is a 3.3V I2C sensor and the Arduino UNO operates at 5V I2C levels.

I would recommend using it with an EZ-Bv4. Of course, I would, right? xD

I could recommend trying using a logic-level translator, making your cables shorter, and changing the pullup resistors but really we created the EZ-Bv4 so you wouldn't have to mess around so much, and makes things easier for the end user to connect sensors to their robots.

I2C is a finicky beast sometimes.

#16  

Hi Jeremie,   Just FYI I have hooked it up with 3.3V provided and the 5V on the UNO.  I have validated the hardware works with just Arduino code without using the skill firmware and ARC.

#17  

Can anyone confirm this skill still works for me?  I can't get the MPU to provide feedback.  I am not not using the DHT sensor.

PRO
Synthiam
#18  

if you're not using the correct sensor then it won't work.

#19   — Edited

This is what I am using a MPU 6050.  I thought this was the required device. I am not using the other device this service supports temp/humidity DHT

User-inserted image

#20  

DJ thoughts on why the skill does not work anymore?

PRO
Synthiam
#21  

I didn’t make this skill. You’d have to hear from the author.

PRO
Synthiam
#22  

Looking at the Arduino code, I can only assume the sensor isn’t connected because the robot skill should be easy enough to consume the data. I don’t have a sensor like that to test with. Do you get any errors or messages in the ARC log or robot skill window?

#23   — Edited

DJ,  I am getting no errors anywhere it just does not seem to work.   I have tested all this hardware together using an example script for the MPU6050 and UNO and it works perfect.

Just as a FYI I have decided to use EZB4's and an IOTiny in this project. I am going to try the other skill that is for the EZB's and see if I can make that one work.  I may have more question on it when I can hook everything up and try it.

#24  

Quote:

I have decided to use EZB4's and an IOTiny in this project
Top of the line. Buy the best and you will never be disappointed. Nice choice.