Notifications
Clear all

The Mysterious MPU 6050 Breakout Board ???

61 Posts
10 Users
8 Likes
667.5 K Views
Mandy
(@amanda)
Member
Joined: 5 years ago
Posts: 74
 
Posted by: @recycled-roadkill
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.

Of course it wasn't a mistake I was just testing you, yes that was it, I did it deliberately to see if you would spot it, no, no, not sloppy coding at all.  ? 

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.


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

Alrighty, the Nano like the sketch and here's the serial monitor output:

15:44:03.120 -> 0,0,0
15:44:03.120 -> 0,0,0
15:44:03.167 -> 0,0,0
15:44:03.167 -> 0,0,0
15:44:03.167 -> 0,0,0
15:44:03.167 -> 0,0,0
15:44:03.167 -> 0,0,0
15:44:03.167 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.214 -> 0,0,0
15:44:03.260 -> 0,0,0
15:44:03.260 -> 0,0,0
15:44:03.260 -> 0,0,0
15:44:03.260 -> 0,0,0
15:44:03.260 -> 0,0,0
15:44:03.260 -> 0,0,0
15:44:03.300 -> 0,0,0
15:44:03.300 -> 0,0,0
15:44:03.300 -> 0,0,0
15:44:03.300 -> 0,0,0
15:44:03.300 -> 0,0,0
15:44:03.300 -> 0,0,0

What's happening here?

Robot was moved in every direction although no change in display.

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

Another bug I'm afraid

Line 16 should read :

Wire.write(0x3B);

Sorry but I've only got the one 6050 and it is plugged into Eric so I'm having to convert from Pi runes

 

 

 

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  

@amanda

There are 3 boards with this. The Nano, 6050 and a TB5612FNG. I have many of each so swapping won't be a problem if requested. Copying the new sketch now.

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  

@ Mandy

Here's the new serial output:

16:11:46.369 ->
16:11:46.369 -> I2C Scanner
16:11:46.369 -> Scanning...
16:11:46.369 -> I2C device found at address 0x68 !
16:11:46.369 -> done
16:11:46.369 ->
16:11:46.369 -> Scanning...
16:11:46.369 -> I2C device found at address 0x68 !
16:11:46.369 -> done
16:11:46.369 ->
16:11:46.369 -> Sc
16:11:46.369 -> ⸮⸮P

Last line repeats itself on same line.

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

I just spotted my mistake so corrected my previous post

Line 16 should read : Wire.write(0x3B);

 

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  

@amada

K, got it.

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  

@amanda

replaced line 16:

Wire.write(0x3B); //byte error, address;

Error resulted:

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

C:\Users\Chiller2000\Documents\Arduino\Mandys_6050_3.ino\Mandys_6050_3.ino.ino: In function 'void loop()':

Mandys_6050_3.ino:22:5: error: 'address' was not declared in this scope

for(address = 1; address < 127; address++ )

^

Mandys_6050_3.ino:28:1: error: 'error' was not declared in this scope

error = Wire.endTransmission();

^

exit status 1
'address' 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
Mandy
(@amanda)
Member
Joined: 5 years ago
Posts: 74
 

@recycled-roadkill

Sorry but that was a correction to the original program so it should now read:

#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(0x3B);
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);
}

Sorry, I've never had to show someone how to do this before so I may not be very good at this.  You're the first person.

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

@recycled-roadkill

Sorry but that was a correction to the original program so it should now read:

 

Sorry, I've never had to show someone how to do this before so I may not be very good at this.  You're the first person.

Aww, no apologies necessary. I'm hoping you're enjoying this as I am. You're honing your sketching skills and I'm learning something too.

I'm also hoping you'll allow me to repay with with something printed 3d. Successful or not, still much appreciated.

I'm off to try the new code.

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
 
Posted by: @recycled-roadkill

I'm also hoping you'll allow me to repay with with something printed 3d. Successful or not, still much appreciated.

I may take you up on that. ? 

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  

@amanda

16:49:31.696 -> -307,349,20
16:49:31.696 -> -301,360,21
16:49:31.696 -> -307,340,20
16:49:31.730 -> -306,354,37
16:49:31.730 -> -304,369,30
16:49:31.730 -> -279,383,35
16:49:31.765 -> -293,337,25
16:49:31.765 -> -316,368,43
16:49:31.812 -> -293,341,25
16:49:31.812 -> -294,352,25
16:49:31.812 -> -282,368,24
16:49:31.812 -> -291,348,27
16:49:31.859 -> -300,344,44
16:49:31.859 -> -301,344,35
16:49:31.859 -> -297,339,20

Dang, this looks pretty good.

Rotated his axis's, Result:

16:50:58.597 -> -949,-355,-993
16:50:58.597 -> -1522,-1668,-2156
16:50:58.644 -> -1816,-2503,-2733
16:50:58.644 -> -1654,-2373,-2115
16:50:58.691 -> -1044,-1331,-920
16:50:58.691 -> -349,227,251
16:50:58.691 -> 196,1337,1137
16:50:58.738 -> 702,2025,1872
16:50:58.738 -> 1040,2097,2165
16:50:58.738 -> 926,1661,1806
16:50:58.785 -> 249,868,1043
16:50:58.785 -> -346,-61,38
16:50:58.785 -> -820,-826,-943
16:50:58.832 -> -1247,-1323,-1857
16:50:58.832 -> -1412,-1431,-2105
16:50:58.879 -> -1285,-1154,-1491
16:50:58.879 -> -983,-456,-226
16:50:58.879 -> -553,215,883

You've got it... Now what?

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
Posted by: @recycled-roadkill

I'm also hoping you'll allow me to repay with with something printed 3d. Successful or not, still much appreciated.

I may take you up on that. ? 

I very much hope that you will. 🙂 

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

YAY!  Send it to a graph (serial plotter) and you should be able to tell when the robot is moving.

To get the full information just add

Serial.print(acc_x);
Serial.print(",");
Serial.print(acc_y);
Serial.print(",");
Serial.print(acc_z);
Serial.print(",");

at line 27, in the space and you will get all the information displayed on the graph.

 

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

at line 27, in the space and you will get all the information displayed on the graph.

Well, I just learned how to set up a graph, (on my own at that)

Wow, how cool. Moving the bot does affect the various planes.

Any idea how I put all this new information to make the dang thing work?

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


   
Squish reacted
ReplyQuote
Page 3 / 5