Jump to content
I2Cdevlib Forums

2x Wireless MPU6050 Synchronized - Raw Data


Recommended Posts

Hello Everyone!!

 

I would first like to thank Jeff for your great work with the MPU6050 Code (and even reverse-engineering the DMP!!)

 

I am starting out a new project where I would like to use two Arduino+MPU6050 units and transfer the data back to my computer for processing. I am not planning on using the DMP, as my end result is just to obtain two synchronized files on my computer with the total linear accelerations (including gravity) and gyroscopic measurements (without offsets). The faster the measurements the better. I am hoping a sampling rate of 200Hz, and the modules would run for about 20-30 minutes, time which the modules should be synchronized.

 

I am planning on making two "modules", each comprising an Arduino Uno + MPU6050. I have made this decision due to the increased possibilities of what I can do with two independent sensor modules. I am planning on adding bluetooth later on, and porting this to an AVR Chip (ATMega328 perhaps?) for more efficient use of space.

 

I have read through all the code easy raw code(excluding DMP), and I have understood most of it. For those who need help understanding some steps, this other link also helped me A LOT.

http://www.botched.co.uk/pic-tutorials/mpu6050-setup-data-aquisition/

 

 

My first question is regarding the offsets and the "setXGyroOffset, setXAccelOffset.." functions. I have already read the post on how to calibrate it: http://www.i2cdevlib.com/forums/topic/91-how-to-decide-gyro-and-accelerometer-offsett/

How do these functions (setXGyroOffset, setXAccelOffset, etc..) work in the MPU6050_raw.ino program?

If I set the offset to a specific value, would the resultant acceleration already account for the offset?

 

For e.g. Let´s say that for the first run I set all the offsets=0. And assuming that my X acceleration measures a constant value of 243 (I understand that in real life this varies due to noise, but it's a bit easier to explain this way).

If for the next run I modify the program and set the XAccelOffset to 243. Assuming no noise, should my next printed value be 243 (because the offset wasn't accounted for) or would it be 0 (because it was accounted for)?

If it is accounted for, how is this accounted for in the getmotion6 function? I could not find the use of the offsets functions (getXAccelOffset, etc..) in any of the getmotion6 functions, and I am unsure how the program would use the value I passed through setXAccelOffset to account for this in the printed value.

If it is not accounted for, can I just do this manually? i.e. instead of printing the raw data modify it to: acceleration = raw data - offset

 

How fast do you think I would be able to read the raw data?

Is 200Hz possible?

 

My second question was about synchronizing both "modules".

EDIT: I will be planning on using an SD card data logger shield (from adafruit), which *should* allow me to log raw data every 5 ms or so.

Each of these shields has an RTC (DS1307 or so) which would allow me to keep track of time. Now the main problem would be synchronizing both RTCs.

I am thinking about two options:

1. Use a shared reset button to set both RTCs to the same time (Since i don't care about perfect accuracy with real world time)

2. Use serial communication between both of them and an adaptation of the SNTP (simple network time protocol) algorithm to find the offset and sync them both.

 

Do you think these solutions are viable?

Any help would be great!

 

This has been killing me for the past few days. Thank you!!!

-A student

Link to comment
Share on other sites

  • 2 weeks later...

Wow, so many things to try to answer...

 

 

 

The faster the measurements the better. I am hoping a sampling rate of 200Hz

Bottleneck is your microcontroller, the SD writing and wireless transmission.  MPU can go much faster.

 

 

 

I am planning on making two "modules"

Do you know you can wire two MPUs at the same I2C bus if each one has a different address? (0x68 and 0x69)  And I remember there was somebody in this forum who achieved more MPUs at the same bus using some controller.

 

 

 

If I set the offset to a specific value, would the resultant acceleration already account for the offset?

Yes. I don't really know if offset is applied by sensor or by software, but it is applied. I made a skecth to get this oofsets easily. http://www.i2cdevlib.com/forums/topic/96-arduino-sketch-to-automatically-calculate-mpu6050-offsets/

 

 

 

Assuming no noise, should my next printed value be 243 (because the offset wasn't accounted for) or would it be 0 (because it was accounted for)?

Offset is accounted, but it is not so straigth-forward, check topic linked before.

 

 

 

My second question was about synchronizing both "modules".

What precission do you need? 1 second is ok? In that case I would configure both RTC at the same time only once and they should keep time fine for some days maybe? If it is only 30 minutes...  maybe you don't even need a RTC and with internal timers since reset you are fine.  Maybe you don't even need to time it if both Arduinos are started at the same time, and run their sketches at the same frecuency, and send data as fast as they read it, and receiver reads data very fast and organices it.

 

 

Btw, what is it for?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...