Shop OBEX P1 Docs P2 Docs Learn Events
Accelerometer Rotation — Parallax Forums

Accelerometer Rotation

CumQuaTCumQuaT Posts: 156
edited 2010-11-21 23:27 in Propeller 1
Hi all,

I understand that a Gyroscope or Compass module would be more suited to this, but humour me on this one...

Has anyone had any success using something like the H48C Tri-Axis accelerometer to measure yaw rotation and find a heading compared to an initial value? If so, any idea on the maths behind that?

Just curious...

Comments

  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-18 19:24
    To clarify, I'm trying to build an air-mouse of sorts, and I have a couple of tri-axis accelerometers, but no gyros. Just want to know if it's at all possible without making a new order. International shipping to Australia is expensive as hell!
  • wjsteelewjsteele Posts: 697
    edited 2010-11-18 19:28
    The accelerometer object (in the Obex) does this already.

    As for shipping, you might want to consider asking a company for samples of the sensors you want... they usually will ship for free.

    Bill
  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-18 19:56
    Hi,

    I've already had a play with the OBEX objects for it, and I can't get it to recognize rotation at all. Pitching and rolling, quite well, but not yaw rotation.

    I even contacted the generous Beau Schwabe who gave me his older version of the object that draws the 3D cube, and it didn't like Yaw rotation at all...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-11-18 20:25
    There is not a static way to detect yaw with accelerometers, since gravity doesn't work in that direction. It may be possible to detect it dynamically with two accelerometers at opposite ends of an arm that rotates about the Z-axis. You would have to integrate the centripetal accelerations to determine an angular displacement, though, and your success will depend on the resolution of the sensors and the lack of drift in the differential readings between the two.

    -Phil
  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-18 20:28
    That's not a bad idea, but it's sounding more and more like a gyroscope and a 2-axis accelerometer would be the way to go to simulate an accurate 3D mouse. Would you agree?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-11-18 20:32
    CumQuaT,

    You can measure the pitch & roll from accelerometer because earth's gravity will always show a 1 G component on the downward direction, but for yaw you need alternative arrangement.

    The H48C will not provide any information when rotated on Z axis, however if the Z axis of the H48C is offset by a distance from the actual center of rotation then it will provide acceleration. <- Edit Basically what Phil is describing above with two Accelerometers, but simplified down to only one accelerometer.

    The best solution though is to use a Compass or Gyro to determine yaw.
  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-18 20:42
    Some great food for thought there. In the rig that I'm setting up, the air mouse will always be at arms length, which means the point of rotation will be at the shoulder, allowing me to pick up that movement... Should be fun to play around with!

    Thanks for the help (again) Beau!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-11-18 20:44
    Beau is correct about using one accelerometer, assuming you know where the center of rotation is and assuming (given a 2-axis unit) there's no roll involved. With two accelerometers, roll and any uncertainties about the center cancel in the yaw computation, since it uses a differential measurement. But I'm with Beau and keeping things simple with an accelerometer and a gyro.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-11-18 20:52
    I do have another version of the Memsic2125 driver that provides tHx as well as Tx. With that you can derive a better ratio metric value if the clock happens to be slightly skewed from one accelerometer verses another accelerometer.

    The current version only provides tHx and assumes that the clock is always 100Hz.

    I will clean up the new version and post it to the OBEX soon.
  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-18 20:52
    Yeah, thanks for all the help.

    I know what MY weekend project is!
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-11-18 20:55
    CumQuat: I have a few ITG-3200 3axis gyros and I'm in Oz. PM me if interested.
  • zoopydogsitzoopydogsit Posts: 174
    edited 2010-11-18 21:15
    Hey CumQuat,

    I don't know where in Oz you are, but I have a spare sparkfun 5D0F (bought a couple of them through dings and dents last year) that I'd be happy to send to you. Though be aware as it's a "ding and dent" then it's likely to miss one of it's functions (from memory the accellerometer doesn't do Z properly). http://www.sparkfun.com/products/9268

    I bought them to do some interesting stuff with robotics (rather than using collision switches I was going to read the change in accelleration, look at ground gradient changes with the gyro, look into spacial recognition from looking at the sensor set simultaenously (great use of the prop)). I've got some potential product spin-offs that I wanted to research.

    So I'd be interested in your code if your willing to share.

    IM me if you are interested.
  • max72max72 Posts: 1,155
    edited 2010-11-19 05:32
    Consider also the WII objects. A 3 axis Gyro, 3.3V, I2C, available in any games store, for 10-20$

    Massimo
  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-19 07:05
    I thought that the nunchuck only has a 3 axis accelerometer, not a gyro?
  • max72max72 Posts: 1,155
    edited 2010-11-19 07:21
    There is also the motion plus. It is a Gyro.
    http://en.wikipedia.org/wiki/Wii_MotionPlus
    The object works with both, individually or together. In fact the I2C address is the same, so if you use both the object shuts down one, reads from the other and vice versa.
    Here Nunchuck and Motion Plus cost more or less the same.
    If you already have the accelerometer a motion plus would be a good and cheap companion.
    Massimo
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-11-19 13:34
    max72: Good suggestion. However the Wii Motion Plus is only a 2axis gyro. Not sure if this matters.

    Surely there must be a Wii that has both accelerometer and gyro (both 3 axis)? It's nearly always cheaper to hack a high volume product but then you have to interface it and use the footprint of it.
  • max72max72 Posts: 1,155
    edited 2010-11-19 13:59
    I think wikipedia missed one accelerometer..
    I'm pretty confident is has a 2 axis and a 1 axis accelerometer.
    If you have a tri-winged screwdriver or you want to force open the toy you get an extremely small board, so maybe a little bit of hot glue would be enough..
    Obviously this is not a mass production solution, but for an hack or a hobby project getting 6 DOF from your games store is not so bad..

    Massimo
  • CumQuaTCumQuaT Posts: 156
    edited 2010-11-19 22:50
    Yeah, I've noticed a very large number of community hacks involving the Nunchuk. I didn't even think of the MotionPlus. Hopefully a tuning fork gyro will do rotation nicely.

    Good find!
  • cessnapilotcessnapilot Posts: 182
    edited 2010-11-21 03:27
    Hi CumQuaT

    A low drift 100 Hz 6DOF IMU made from 4 H48C accelerometers is working well for more than 6 months. It gives an accurate ECEF output of its position on Earth (X, Y, Z :[m]) and of its attitude (yaw, pitch, roll :[deg]). Although it uses 2 FPUs, it is basically a Propeller based project. Every SPIN/PASM/FPU software to reproduce it was posted on OBEX. Namely

    "uM-FPU v3.1 SPI driver demo" http://obex.parallax.com/objects/286/
    "General MEMS Sensor Model" http://obex.parallax.com/objects/464/
    "H48C synchronized driver" http://obex.parallax.com/objects/430/
    "INS Math WGS84 Earth" http://obex.parallax.com/objects/335/

    The device has automatic temperature calibration on the field to get high accuracy. The method is included in the General MEMS Sensor Model firmware. When you couple such IMU thing with magnetic data using

    "HM55B Dual Compass Driver" http://obex.parallax.com/objects/448/
    "FPU Extended KF" http://obex.parallax.com/objects/320/
    "World Magnetic Model 2010" not yet published on OBEX

    then you can have a precise navigation aid for your car, boat or plane. Such devices will be commonplace within the next 3-4 years.

    Or, you can fuse the ECEF data with GPS receiver outputs, using for example

    "GPS Float Demo" http://obex.parallax.com/objects/405/

    to have a stable, IMU filtered uninterrupted NMEA receiver. To collect data for the calibration and debugging, you can use the high speed and bulletproof object with full FAT32 support

    "UART Datalogger" http://obex.parallax.com/objects/542/

    with a separate Propeller.

    I cannot attach a latest and detailed pdf doc of most of the project to this post because of the size restriction, but I can email it if you are interested.

    Cheers

    Istvan
  • SapiehaSapieha Posts: 2,964
    edited 2010-11-21 04:48
    Hi cessnapilot.

    Maybe if You ZIP them that can be possible.

    ZIP's can be 7.5MB

    Hi CumQuaT

    A low drift 100 Hz 6DOF IMU made from 4 H48C accelerometers is working well for more than 6 months. It gives an accurate ECEF output of its position on Earth (X, Y, Z :[m]) and of its attitude (yaw, pitch, roll :[deg]). Although it uses 2 FPUs, it is basically a Propeller based project. Every SPIN/PASM/FPU software to reproduce it was posted on OBEX. Namely

    "uM-FPU v3.1 SPI driver demo" http://obex.parallax.com/objects/286/
    "General MEMS Sensor Model" http://obex.parallax.com/objects/464/
    "H48C synchronized driver" http://obex.parallax.com/objects/430/
    "INS Math WGS84 Earth" http://obex.parallax.com/objects/335/

    The device has automatic temperature calibration on the field to get high accuracy. The method is included in the General MEMS Sensor Model firmware. When you couple such IMU thing with magnetic data using

    "HM55B Dual Compass Driver" http://obex.parallax.com/objects/448/
    "FPU Extended KF" http://obex.parallax.com/objects/320/
    "World Magnetic Model 2010" not yet published on OBEX

    then you can have a precise navigation aid for your car, boat or plane. Such devices will be commonplace within the next 3-4 years.

    Or, you can fuse the ECEF data with GPS receiver outputs, using for example

    "GPS Float Demo" http://obex.parallax.com/objects/405/

    to have a stable, IMU filtered uninterrupted NMEA receiver. To collect data for the calibration and debugging, you can use the high speed and bulletproof object with full FAT32 support

    "UART Datalogger" http://obex.parallax.com/objects/542/

    with a separate Propeller.

    I cannot attach a latest and detailed pdf doc of most of the project to this post because of the size restriction, but I can email it if you are interested.

    Cheers

    Istvan
  • cessnapilotcessnapilot Posts: 182
    edited 2010-11-21 23:27
    Thanks Sapieha,

    I should read the instructions next time. I remembered a 64K limit...

    The mentioned pdf doc is attached.

    Cheers,

    Istvan
Sign In or Register to comment.