Gyroscope and Accelerometer Combination

Hey everyone. I'm BRAND new at Ardunio (and forums in general, so I apologize if this isn't in the right place) and I have a stupid question for you.

I'm looking to build a motion detector that will eventually do some biomechanical motion analysis. It starts, obviously, with tinkering with the Uno and a Gyroscope/accelerometer chip. With the research that I've been doing, I've seen a huge variation in price with these chips, and I'm just not understanding why. The device would need to detect the three typical movements, yaw pitch and roll, and I would want it to work with pretty high precision and speed.

Here are two that I've been looking at
http://www.gearbest.com/development-boards/pp_22492.html?currency=USD&gclid=CIndo8bm9MACFWoR7AodGyIAig

I already understand the DOF and how all of that works (so the 9 DOF is better in that sense), but what I wanted to see if it was still possible to use the less expensive one - or any of the cheap ones you can find with a quick google search - for what I was looking to do, or if its missing something that the more expensive ones have.

Thanks for your help everyone!

It is a good question !

Start here: http://forum.arduino.cc/index.php/topic,58048.0.html
The first post is the 'guide'. At the end you see a link for the MPU-6050 + HMC5883L (magnetometer).

The other good option is to use the i2cdevlib.

There are still outdated expensive acceleration and gyro sensor for sale. But the MPU-6050 is probably better than all of them. You can buy it on Ebay for 3 or 5 dollars.

The MPU-9150 is the same sensor as the MPU-6050, but with a magnetometer added into the chip. It should not cost more than 10 or 12 dollars. At this moment there are more libraries for the MPU-6050 + HMC5883L than there are for the MPU-9150.

So far this is all about chips with I2C, which is slow. Perhaps upto 1000 samples a second is possible, but 100 samples per second is normal.

Please tell us how accurate and how fast you want it to be ?
Do you want to use more than just one sensor ? How many ?

Thanks man!

I want to be able to start playing, and being that I'm on a huge budget, that's awesome to hear.

The project would be for biomechancial analysis. From other research that I've done it is necessary to use at least a 240 fps camera if you're doing this kind of work with any useful data to be produced. I would assume that we can translate that to 240 samples per second in this case? (I don't know how "fast" that is in this field..)

As for accuracy, I would want it to calculate to at least the whole degree (90degrees), but getting it to work to the tenth (90.5) would be even better.

And yes, eventually I'd want to use more than one sensor. It seems that I'd need at least 2 or 3 to get any good data on a single joint of the body. That said, I eventually want it to be a whole-body kind of device, so I would want possible up to 15 or so. After I figured out this part, I was going to go the the feasibility section for those questions.

There can be only two MPU-6050 chips on a I2C bus. With more you have to do some tricks or use extra hardware. And with 15 of them, it will be too slow.

The SPI bus is faster. I think there is a MPU-???? version with SPI.
But you can not use long wires, either with I2C or SPI. Perhaps 2 meters for the total length of the wires.

You could use an Arduino + sensor for every sensor. Search for 'Arduino Pro Mini', they are really small.
The Arduino would only sent the resulting data to a central unit via serial or RS-485. That makes the whole project more flexible and scalable. RS-485 can go up to 100 meters with a twisted pair wire. And you can use any sensor, so even the cheap MPU-6050 with its slower I2C bus.

To start, use a MPU-6050 and Arduino Uno and get some feeling with how the data is with the motion, and learn about the filtering.

For your project, perhaps SPI sensors is better when you want to connect many sensor to a single Arduino. Do you need an magnetomer for every sensor ? That is only needed when you need an absolute orientation (direction, angle, compass). I doubt if you need that. The sensors don't know their location anyway, not even the distance to each other.
About 240 samples with 15 sensor is probably too much for a single Arduino Uno. Perhaps you might have to upgrade to an Arduino Due, but I suggest to continue with the Uno and see when you reach its limits.

What are the g-forces that are involved ?
The normal acceleration senors can not measure a large impact.
There are special sensor for impact measurement up to 100g or 200g.

For the whole-body thing, I see tiny sensors (just the sensor, no arduino) with wires attached to someone. A unit or back-pack has a few Arduinos to interface with the sensors (one Arduino per two I2C sensor or more sensors with SPI) and a central Arduino.

The only thing I have not thought about is the amount of data. What data do you want ? Do you want to sent it to the computer, or store it on a SD ard ?

I'm not sure what the SPI is. I'll have to look that stuff up to figure it out. For now, I'd like to play, so I think the MPU-6050 + the Uno is the best idea. My initial inclination was to work eventually with sensors and the Arduino Pro Mini. It seemed a but cumbersome to me but for the first version I think it should work okay.

The interfacing is going to be the challenge. With so many pieces working, It's tough to figure out how to get them to work together. Eventually, I would love to have wireless interfacing, but that is a far-off goal.

For the data, I want the data to display live on a screen. For now, I would assume it's going to be best to get it onto a computer (Bluetooth, maybe?) and show a virtual skeleton moving in the same was as the person with the nodes on. To save and play back at a later date, I was thinking maybe a CSV file (of the calculated joint angles and/or x,y,z plot positions) with a simple conversion algorithm into whatever 3d space I was displaying it into. That way, i can just tap into my hard drive to work with it. All theoretical at this point, but something to work on.

Arduino started to blink a few leds and read an analog sensor. You want something professional. That might be possible, because now there is the Arduino Due and the Teensy 3.1 board and a few new boards are in development.

SPI is a bus, just like I2C or USB. A few wires with a digital signal.

The MPU-6000 is with SPI bus.

The acceleration and gyro sensors do not have a precise location in 3D space, as a GPS sensor does. They measure the angle and motion (and rotation), and change in motion (and rotation).

The advanced example with i2cdevlib shows a lot of data, that is the DMP6 example.
Waiter, there are too many quaternions in my teapot !
http://www.i2cdevlib.com/
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino

Sorry, I didn't describe that well. I wouldn't be able to plot specifically, but I would hope to get the data and relative movement, both from the beginning position, and from one another.

And I'm not sure if I understood, do you think that the Uno or the Mini would suffice for the project? For now, I still think its a great idea to work with them to get started either way.

And thank you for those links! I'm going to check those out on my lunch break.

PS. to answer one of the previous questions, I don't think it's necessary to measure G forces. I might have to do surface EMG or force plates for research, but I don't see G forces being incorporated in the near future.

G-force is the same as acceleration. The MPU-6050 is up to 16g. That is enough for walking but not for boxing.

The i2cdevlib uses both the acceleration and gyro data and combines that for all kind of results. The advanced example with DMP uses all the sensors.

About 15 sensors and a Arduino board might not work. The first problem is the wires. That is why I think that one Arduino with I2C and two MPU-6050 can be duplicated a number of times, with a single central unit (also Arduino) to pass on the data to memory or computer.

Just get that Arduino Uno and MPU-6050 running :stuck_out_tongue:
Do you have a treadmill ? Perhaps you can try to attach the sensor to your foot and read the data in the computer. That would be a very good start.
You learn about I2C and wires and communication along the way.

Awesome man. Thanks again for all of your help. I'm going to order the Uno and a couple of MPU 6050's right now.

Again, man. Thank you very much. I appreciate it!

2.31 dollars at the moment: mpu-6050 for sale | eBay
Sparkfun sells it for 39.95 dollars: http://www.sparkfun.com/products/11028

They both use the same sensor chip from the same manufacturer, but the Ebay version might have less good soldering and less good capacitors. If you have (very) bad luck, about 1 in 10 from Ebay will not work.

10 from Sparkfun = 359.60 + shipping costs
11 from Ebay (asume 1 faulty) = 25.41 dollars (inclusive shipping).
You save at least 334.19 dollars. I can buy a laptop for that money !