Notifications
Clear all

The Mysterious MPU 6050 Breakout Board ???

61 Posts
10 Users
8 Likes
668.9 K Views
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

You guys are hurting my brain. I looked in one of my parts containers and I found 10 of these boards.  Or at least the GY-521 boards if that's the same thing.  I remember playing with one some time ago just as an experiment.  I just hooked the board up to an UNO and watched the numbers change on the serial monitor as I moved the board around.   Bill has a nice video on this card where he makes a digital level out of one.

I just re-watched that video and I'm thinking of making the digital level project just to get my feet wet with it.  It might be wise to set up the digital level program using some servos to hold the level and see if you can build a quick self-leveling level.  That would be some quick experienced gained that might help push you in the right direction. ? 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Recycled Roadkill
(@recycled-roadkill)
Member
Joined: 5 years ago
Posts: 75
Topic starter  

@duce-robot The MPU6050 is inexpensive, especially directly from China but it's something like 10 bucks for 5 of them on amazon. There's something similiar from adafruit out there, but it's about 40 bucks. 9dof where the 6050 is 3dof. Paul McWartor is beginning a tutorial using the adafruit one. Search him on youtube and you'll get a better idea what you're getting into.

GY-521 is the same as MPU6050.

This post was modified 5 years ago by Recycled Roadkill

This message was approved by Recycled.Roadkill. May it find you in good health and humor.


   
ReplyQuote
Mandy
(@amanda)
Member
Joined: 5 years ago
Posts: 74
 

@Recycled Roadkill

Well there's your problem, it's ye' quaternions in'it. <slow intake of breath> It's going to be expensive.

You don't need quaternions.  I'm going off for a rant about "build your own robot" kits after this post.

The solution is much more simple than this.  You have a sensor that can tell when the robot is falling over so you just need to move the motors when the sensor says.

First, try this code on your robot:

#include <Wire.h>

void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
Wire.beginTransmission(0x68);
Wire.write(0x6B);
Wire.write(0x00);
Wire.endTransmission();
}

void loop() {
// put your main code here, to run repeatedly:
Wire.beginTransmission(0x68);
Wire.write(0x43);
Wire.endTransmission();
Wire.requestFrom(0x68, 14, true);
while(Wire.available() < 14);
acc_x = Wire.read()<<8|Wire.read();
acc_y = Wire.read()<<8|Wire.read();
acc_z = Wire.read()<<8|Wire.read();
temp = Wire.read()<<8|Wire.read();
gyro_x = Wire.read()<<8|Wire.read();
gyro_y = Wire.read()<<8|Wire.read();
gyro_z = Wire.read()<<8|Wire.read();

// only display the gyro.
Serial.print(gyro_x);
Serial.print(",");
Serial.print(gyro_y);
Serial.print(",");
Serial.println(gyro_z);
}

You don't need to understand the code at this point, we're just checking the 6050 is working.  I'll break the code down later if I need to.

I suggest you graph the output to start with so you can see what is going on.

Run this code with the robot laying down and check the results.  Then stand the robot up and hold it there, these are the results you need to have to get the robot balanced.

Now tilt the robot forward a little , if you get this reading then the robot needs to drive forward a little and vice versa.

If the above code works then we are cooking.  If nothing else, you've proved the 6050 is working so that's not the problem.

Now I'm off for my rant. ? 

This post was modified 5 years ago by Mandy

The 600 series had rubber skin. We spotted them easy, but these are new. They look human... sweat, bad breath, everything. Very hard to spot.


   
ReplyQuote
Duce robot
(@duce-robot)
Member
Joined: 5 years ago
Posts: 678
 

@amanda

My bot is a little to big to lay down but I'm still going to do this I guess the 6050 will be used for motion ? Its all new to me my first robot didn't have any of this but I want to make sure I have the infrastructure in place thanks for the code I'll get some video of duce robot on here soon any help is greatly appreciated .?


   
ReplyQuote
Mandy
(@amanda)
Member
Joined: 5 years ago
Posts: 74
 
Posted by: @duce-robot

@amanda

My bot is a little to big to lay down but I'm still going to do this I guess the 6050 will be used for motion ?

The 6050 is used to detect the motion.  Gravity and the motor controller causes the motion.  I'm highlighting that point just for clarity.

I'd love to see some video, as at the moment I'm making a lot of assumptions about your robot based on what you have posted. ?

This post was modified 5 years ago by Mandy

The 600 series had rubber skin. We spotted them easy, but these are new. They look human... sweat, bad breath, everything. Very hard to spot.


   
ReplyQuote
(@twobits)
Member
Joined: 5 years ago
Posts: 113
 

@duce-robot

Have you taken a look at the following video?

I won't directly help you solve your issue, but it might make the terms mandy is using sound less greek.


   
ReplyQuote
hstaam
(@hstaam)
Mr.
Joined: 5 years ago
Posts: 61
 

Nice one. Thanks for sharing this. It certainly makes things a bit clearer.

hj

hj


   
ReplyQuote
Duce robot
(@duce-robot)
Member
Joined: 5 years ago
Posts: 678
 

@amanda

Uploaded it to YouTube as it was to big for the forum. Under duce robot build its getting close still needs a little more work.


   
ReplyQuote
Mandy
(@amanda)
Member
Joined: 5 years ago
Posts: 74
 

Elegoo Tumbller Robot?????

What @recycled-roadkill describes:

What @Duce-robot has:

? ? ? 

 

 

 

 

 

This post was modified 5 years ago by Mandy

The 600 series had rubber skin. We spotted them easy, but these are new. They look human... sweat, bad breath, everything. Very hard to spot.


   
ReplyQuote
Recycled Roadkill
(@recycled-roadkill)
Member
Joined: 5 years ago
Posts: 75
Topic starter  

for Mandy and any  one else following this.

Here's a youtube vid Elegoo for assemble and toward the end actual operation at 11:30.

If you like some video of my own tumbller, I'll be happy to figure out how to provide that.

Thanks again for your help

Thanks to everyone contributing what help they can.

I wanted to check this forum yesterday but my head literally hurt from all this and I had to get away for a bit.

Lots of weird stuff happens when you get old. I'd enjoy being old much better if it weren't for that.

They call it the "Golden Years." BS. More like tin years because everything rusts at twice the rate and disappears into nothing soon after. 🙂

This post was modified 5 years ago 2 times by Recycled Roadkill

This message was approved by Recycled.Roadkill. May it find you in good health and humor.


   
Squish reacted
ReplyQuote
Recycled Roadkill
(@recycled-roadkill)
Member
Joined: 5 years ago
Posts: 75
Topic starter  

@amanda

Yep, that's the one.

Please see my most recent post.

The wiring cannot be screwed up. That leaves only the programming and Elegoo's production. It's laughable. Yes, I'm laughing.

I wanted to review this on Amazon but even Amazon can't get it right. Their reviews on the Tumbller point only at Elegoo's Smart Robot 3.0.

This message was approved by Recycled.Roadkill. May it find you in good health and humor.


   
ReplyQuote
Recycled Roadkill
(@recycled-roadkill)
Member
Joined: 5 years ago
Posts: 75
Topic starter  
Posted by: @amanda

First, try this code on your robot:

Hi Again, I've received these error messages from the code you posted (called Mandys 6050 code) At this time I know only how to declare "int" and "float," hey, getting better all the time, eh?

Arduino: 1.8.9 (Windows 10), Board: "Arduino Nano, ATmega328P"

Build options changed, rebuilding all
C:\Users\Chiller2000\Documents\Arduino\Mandys_6050_code\Mandys_6050_code.ino: In function 'void loop()':

Mandys_6050_code:20:1: error: 'acc_x' was not declared in this scope

acc_x = Wire.read()<<8|Wire.read();

^

Mandys_6050_code:21:1: error: 'acc_y' was not declared in this scope

acc_y = Wire.read()<<8|Wire.read();

^

Mandys_6050_code:22:1: error: 'acc_z' was not declared in this scope

acc_z = Wire.read()<<8|Wire.read();

^

Mandys_6050_code:23:1: error: 'temp' was not declared in this scope

temp = Wire.read()<<8|Wire.read();

^

Mandys_6050_code:24:1: error: 'gyro_x' was not declared in this scope

gyro_x = Wire.read()<<8|Wire.read();

^

Mandys_6050_code:25:1: error: 'gyro_y' was not declared in this scope

gyro_y = Wire.read()<<8|Wire.read();

^

Mandys_6050_code:26:1: error: 'gyro_z' was not declared in this scope

gyro_z = Wire.read()<<8|Wire.read();

^

exit status 1
'acc_x' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This message was approved by Recycled.Roadkill. May it find you in good health and humor.


   
ReplyQuote
Recycled Roadkill
(@recycled-roadkill)
Member
Joined: 5 years ago
Posts: 75
Topic starter  

I believe I'm caught up with others posts regarding this topic at this time. If not, please let me know so I can respond to your kindness.

Thanks

This message was approved by Recycled.Roadkill. May it find you in good health and humor.


   
ReplyQuote
Mandy
(@amanda)
Member
Joined: 5 years ago
Posts: 74
 

Silly me, I didn't declare the variables. Try this:

#include <Wire.h>

void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
Wire.beginTransmission(0x68);
Wire.write(0x6B);
Wire.write(0x00);
Wire.endTransmission();
}

void loop() {
// put your main code here, to run repeatedly:
Wire.beginTransmission(0x68);
Wire.write(0x43);
Wire.endTransmission();
Wire.requestFrom(0x68, 14, true);
while(Wire.available() < 14);
int acc_x = Wire.read()<<8|Wire.read();
int acc_y = Wire.read()<<8|Wire.read();
int acc_z = Wire.read()<<8|Wire.read();
int temp = Wire.read()<<8|Wire.read();
int gyro_x = Wire.read()<<8|Wire.read();
int gyro_y = Wire.read()<<8|Wire.read();
int gyro_z = Wire.read()<<8|Wire.read();

// only display the gyro.
Serial.print(gyro_x);
Serial.print(",");
Serial.print(gyro_y);
Serial.print(",");
Serial.println(gyro_z);
}

Now I'm off to shut my ears in the oven door.

The 600 series had rubber skin. We spotted them easy, but these are new. They look human... sweat, bad breath, everything. Very hard to spot.


   
ReplyQuote
Recycled Roadkill
(@recycled-roadkill)
Member
Joined: 5 years ago
Posts: 75
Topic starter  
Posted by: @amanda

Silly me, I didn't declare the variables. Try this:

And you used "int." I really should have made the attempt to declare those before I whined at you. Many thanks, I'll be trying this very soon.

This message was approved by Recycled.Roadkill. May it find you in good health and humor.


   
ReplyQuote
Page 2 / 5