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 This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC and press the Project -> Add Control button from the menu.
  6. Choose the I2c category tab.
  7. Press the MPU6050 Tilt Angle Sensor icon to add the control to your project.

Manual

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

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.
PRO
USA
#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
PRO
USA
#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.
PRO
USA
#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.
PRO
USA
#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.
PRO
USA
#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.
PRO
USA
#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