Shop OBEX P1 Docs P2 Docs Learn Events
Is it possible to build an IMU without a MCP3208? — Parallax Forums

Is it possible to build an IMU without a MCP3208?

tonocastillotonocastillo Posts: 12
edited 2012-04-24 09:27 in Propeller 1
Hello,

Is it possible to build an IMU without a MCP3208?
I have a 3 axis digital accelerometer (H48C) and a 3 axis digital gyro (L3G4200D).

For what I have read, an ADC is needed when you have an analog accelerometer. Is this correct?

With the above devices... do I need an ADC?



Thank you.

Comments

  • RaymanRayman Posts: 14,838
    edited 2012-04-23 10:40
    I don't see why you need an ADC chip with digital sensors...

    I'm also working on a 6-axis IMU using a digital accelerometer (my 3AD module) and a 3-axis gyro that vanmunch (Dave) sells.
  • tonocastillotonocastillo Posts: 12
    edited 2012-04-23 11:02
    are you coding from scratch or taking ideas from somewhere?
  • RaymanRayman Posts: 14,838
    edited 2012-04-23 11:12
    Jason Dorie (sp?) has posted code for a quad-copter that would work for me, I think, with just some small changes.
    Still, I think I'll take a whack at starting from scratch. I may peek if I get stuck...

    One trick is getting the data from the sensors at a very high speed. You need an assembly driver to do this because spin isn't fast enough.

    That may be the easy part.
    After you get the data, you have to magically turn into position and heading. This is the part I don't know how to do yet...
  • Mark_TMark_T Posts: 1,981
    edited 2012-04-23 13:54
    Hello,

    Is it possible to build an IMU without a MCP3208?
    Yes, absolutely, many sensors are I2C or SPI.
    I have a 3 axis digital accelerometer (H48C) and a 3 axis digital gyro (L3G4200D).

    For what I have read, an ADC is needed when you have an analog accelerometer. Is this correct?
    Yup, the clue is in the word "analog".

    With the above devices... do I need an ADC?



    Thank you.

    The H48C is analog out so you need 3 channels of ADC for it. The L3G4200D is digital out though. There are ways to do ADC directly with the propeller chip BTW.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-23 15:05
    There are ways to do ADC with the Prop, but they require surface mounting, and careful component selection to get good accuracy. An MCP3208 will likely get you better accuracy than an RCTime filter. Perhaps not, but my guess is that it'll be much less susceptible to its environment, trace capacitance, and so on.

    There are a number of good digital 3-axis accelerometers out there. The same routines that read the L3G4200D could read them with very few changes - it's all I2C, so you just need to provide the right address bits, and make sure you get the hi/lo bytes in the right order.

    The QuadX thread has code posted that will read the L3G4200D, and a bunch of other devices as well.


    And, Rayman - A gyro / accel combo won't get you position or heading. They'll let you figure out where "down" with a reasonable degree of accuracy, but that's about it. If you want to know where you are you'll need a GPS, and heading requires a compass (magnetometer).
  • RaymanRayman Posts: 14,838
    edited 2012-04-23 15:53
    Jason, what I want to do is dead reckoning using accel and gyro. So, position and heading are relative to initial position.
    I'm hoping that will be good enough for me..
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-23 17:42
    Heading shouldn't be too bad - it'll be off, but whatever you have will be usable and won't drift too badly. My own QuadX code uses this approach for angular stability - All it does is integrate the gyro readings continuously and tries to hold them to whatever you've set them to. Since it's all relative anyway it works quite well, and the drift is pretty slow.

    Position I haven't tried. In theory it's possible, but the math is more complex. You'll need to generate an estimate of your orientation, then take the accelerometer data and rotate it by that orientation before accumulating it to your running totals. If the accelerometer remained level and held true north as your quad was flying around, you wouldn't need to do this, but it doesn't. :)

    Now, you *could* just assume that you only care about this behavior when the quad is reasonably level and stationary - IE when you only want to hold still in a hover you enable the positional estimate code. Then you'd only have to rotate the acceleration vector by your heading estimate, and you might even be able to get away without doing that. It'd be worth trying for sure.
  • tonocastillotonocastillo Posts: 12
    edited 2012-04-23 19:06
    I would like to build a camera stabilization for my quad.
    Do you think I need to build an IMU for this?
    If so, I better start buying the ADC... :)
    Or these 2 component I already have should do it?
    This is just to have an idea on where to start, I'm a bit new with propeller :)
  • PublisonPublison Posts: 12,366
    edited 2012-04-24 08:41
    Mark_T wrote: »

    The H48C is analog out so you need 3 channels of ADC for it. The L3G4200D is digital out though. There are ways to do ADC directly with the propeller chip BTW.

    The H48C is digital out. It has an on board MCP3204 ADC, so no conversion is necessary.

    Jim
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-24 09:27
    I would like to build a camera stabilization for my quad. Do you think I need to build an IMU for this?

    Most likely, yes. I have camera leveling working on my own DCM-based quad, and it's all based on the values from the IMU. Since the quad can determine its angle relative to ground, you have all the information you need to perform camera leveling - all you need to do is send servo outputs to counter the movement of the quad. It works very well.
Sign In or Register to comment.