Shop Learn
Memsic 2125 Accelerometer question... — Parallax Forums

Memsic 2125 Accelerometer question...

This question is purely for academic exercise...

If you took two accelerometers mounted on the same plane with one of them oriented 180 deg about the Z axis. What would you be left with after mathematically cancelling out acceleration between them? Would you have usable inclination results impervious to motion? Years ago I proved that you could derive angular rate looking at the difference between the two sensors that were in the same orientation, but at the time I didn't think to flip one around 180 Deg from the other.

Comments

  • Clock LoopClock Loop Posts: 2,033
    edited 2021-04-07 03:33

    I have just the platform to test.

    Here is one on a breadboard mounted in my G scale caboose.

    I was actually wondering if I can determine if the caboose turns left or right using a single memsic, and i should be able to the way I have it laid in the image.
    But I didn't think about inclination, which would help me with my hills, see I cannot have steep rail, i don't have super heavy engines with multiple drive trucks.
    And sometimes its hard to see a deviation in the incline, other than the engine will slow, and sometimes stop if I have too many cars.

    Great now I need to order another 2125.

    You can see what I do with a single memsic to determine if the caboose is moving, I then take that info and feed it via a wx module to the engine,
    and if no movement is found, the engine stops.
    Its the caboose.spin file in the zip at this post, and i think it even uses your example code!

    https://forums.parallax.com/discussion/comment/1521627/#Comment_1521627

    The caboose getting inclination data for the engine is a bit late, but doing this in the engine.. now that is an idea...
    I can see the incline in the FB line on the parallax dual motor controller output fed into an activity board A2D.
    You can see it works pretty well, but that is a fairly poor way to determine incline, since wind, track condition and other factors can cause amperage increase/decrease.
    But knowing the incline at the moment the engine hits it, could possibly help with speed regulation at speeds less than max pwm.

    I can wire up another one in the caboose, but doing what you said in code ... i am not even sure where to start.
    I just know that I had to average the memsic readings to get a more stable result, even at rest it buzzes.
    apparently g scale rails are not smooth, at all, nor flat, then the tie gap between the rails adds even more fun.

    The inclination could be plotted live like I did with the parallax dual motor drive's FB output.
    This image is a live plot of the motor draw when the train is going down a hill.

    The inclination would show here also, and could be an additional variable for a PID.
    So far I only have the motor draw FB, I don't even have axle rotation sensor, I need to get a hall sensor.

  • Keep me posted and I'll do the same ... I have a few sensors to play with in the mail that should be here in a day or so, as well as a $$$ IMU to play with that I can compare results against.

    As far as the code, apply the difference between the RAW pulse width of the 2125's before actually deriving any acceleration data. <-- I'll have to look at this, it has been several years. But I plan on measuring the pulse width of each sensor with a high speed counter (could be propeller, maybe not) it is important however that the accelerometers are measured at the same time and NOT one right after the other.

  • Just a quick update ...

    I think we are going with the IMU module because of it's ease to communicate with and the time frame we have with our client to complete the project. I could finagle a couple of other accelerometers together and derive an inclination function (I think) but the IMU does it already and is impervious to any acceleration while still providing a true tilt angle to 1/10th of a degree.

Sign In or Register to comment.