Shop OBEX P1 Docs P2 Docs Learn Events
Simple up/down inclinometer, any ideas? — Parallax Forums

Simple up/down inclinometer, any ideas?

Peter JakackiPeter Jakacki Posts: 10,193
edited 2010-05-31 12:40 in Propeller 1
One of my current Propeller (what else!) projects requires detecting whether a vehicle is going up or down an incline (immediately) and I thought I would throw this out on the forum for ideas. There are several possibilities but it should be simple and reliable, I don't need to know how much of an incline, just up or down or none. Accelerometers aren't really suitable unless it is reset to a known state but I could be mistaken here. One of my mechanical ideas is to have a simple ball bearing in a V shaped tube with a shallow angle. When the vehicle is level the ball sits in the groove of the V but moving up or down an incline it would move to either end and stay put. The ball could be detected with simple optos or even "RF absorption" sensing by pulsing a pcb contact in proximity with the ends and measuring the rise time through a resistor. This can be manufactured very easily as a simple unit.

There are various specialized ($$+$) and also hard-to-get devices out there but I want to keep it simple. Any ideas?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
«1

Comments

  • BradCBradC Posts: 2,601
    edited 2010-05-30 09:27
    Peter Jakacki said...
    When the vehicle is level the ball sits in the groove of the V but moving up or down an incline it would move to either end and stay put.

    That was my first idea, and I used to have a car alarm I built that used a similar principle, but acceleration and deceleration will move the ball regardless of the incline of the vehicle.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Are you suggesting coconuts migrate?"
  • Andrey DemenevAndrey Demenev Posts: 377
    edited 2010-05-30 09:47
    It would depend on ball mass and what minimum detectable inclination is desired
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-30 11:40
    To make it easier I can say that it is a large slow moving vehicle, so this method should work. The V tube could also be pivoted in such a way to lend some mechanical hysteresis but I'd rather keep it simple. Even so, the simple fixed V can be debounced easily enough if you accept the fact that you can't really go from down to up or vice-versa without hovering around level for some small amount of time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • BradCBradC Posts: 2,601
    edited 2010-05-30 11:56
    I'd use a pendulum on a rotary encoder, or if you want really cheap... a pot.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Are you suggesting coconuts migrate?"
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-30 12:36
    Well a pendulum would work of course but it does not lend itself to being manufactured simply because of the whole swinging nature of it although I won't discount anything completely. So that gets back to refining my definition of what I need which I think needs to be more like a component than a mechanism. The ball in a tube can be quite compact and not prone to any mechanical interference or damage so something like that would be good.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • LarryGLarryG Posts: 50
    edited 2010-05-30 13:24
    Hi Peter.

    I think this is what you are looking for http://www.adafruit.com/index.php?main_page=product_info&cPath=35&products_id=173

    Cost about $2 USD.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-30 13:43
    I suppose I could use two of these tilts sensors in an inverted V on a horizontal PCB or simply arranged on a vertical pcb in a similar format. These tilt sensors are cheap so arranging two of them on a pcb and mounting that at right angles to my vertical pcb which is mounted in the dash should work well. I remember coming across various tilt sensors before but for some reason they were either bulky or expensive. By combining a this with an accelerometer chip I can always have the best of both worlds as the tilt sensors provide that initial absolute reference. As these switches are ball type rather than the old glass mercury bulbs they are intrinsically safe and won't cause a problem with certifications.

    Thanks for the link Larry, as this is a "component" that doesn't need any extra work other than the pcb and they are readily available I think I will definitely try this one out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • TimmooreTimmoore Posts: 1,031
    edited 2010-05-30 17:00
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2010-05-30 17:25
    I have a home built car computer that has a pressure sensor (mpx6115 or similar) feeding a 12bit adc. It can very easily sense 5-10 foot elevation change while driving.
  • RaymanRayman Posts: 14,887
    edited 2010-05-30 17:31
    I don't see why an accelerometer wouldn't work for you...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • hover1hover1 Posts: 1,929
    edited 2010-05-30 18:09
    I think the first one would be·unuseable since the data sheet only show 90 degree increments, (car pointing towards the sky or pointing towards the ground.

    The second on kicks in at +/- 30 degrees, still that's pretty steep incline.

    I would imagine Peter is looking for something like +/- 5 degrees.

    Jim
    Timmoore said...
    http://www.junun.org/MarkIII/Info.jsp?item=78 this one is easy to use, you can mount it as normal on a pcb
    or this one http://store.fungizmos.com/index.php?main_page=product_info&cPath=66&products_id=215
  • hover1hover1 Posts: 1,929
    edited 2010-05-30 18:11
    I guess it would depend if you need to measure incline if the car was standing still.

    Jim
    Erik Friesen said...
    I have a home built car computer that has a pressure sensor (mpx6115 or similar) feeding a 12bit adc. It can very easily sense 5-10 foot elevation change while driving.
  • hover1hover1 Posts: 1,929
    edited 2010-05-30 18:24
    I think Brad summed it up "acceleration and deceleration will move the ball regardless of the incline of the vehicle"

    My first though was a pendulum also, but a little costly to construct.

    Maybe a gyro? That would be set to zero when the vehicle is first started and would not have to be reset during it's run.

    Jim


    Rayman said...
    I don't see why an accelerometer wouldn't work for you...

  • RaymanRayman Posts: 14,887
    edited 2010-05-30 19:57
    Look, an accelerometer works great as a tilt sensor... That's how the iPhone does it...

    Maybe some people aren't aware, but 3-axis accelerometers always tell you which way is down when sitting still.

    If you drop your iPhone off a roof, that's when it doesn't know which way is down....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • hover1hover1 Posts: 1,929
    edited 2010-05-30 21:20
    @Ray,

    So would you have to monitor the Z axis to know that you are actually going up/down? If Z does not change than you are just going forward/backwords/left/right on on plane? Not up on an angle?

    "If you drop your iPhone off a roof, that's when it doesn't know which way is down...."

    But it knows it's on the way down. That what the "Free Fall" output pin is all about on some a 3-axis accelerometers. Shuts down and locks the hard drives. Used on may Laptops.

    Jim
  • RaymanRayman Posts: 14,887
    edited 2010-05-30 21:39
    It depends on how you mount it, but assuming the tilt is on the Z axis, then you just monitor X and Y to determine the angle...

    For example, in a certain orientation and with a non-moving accelerometer, X will read +1 G and Y will read 0 G when vertical. At 90 degrees, X will read 0 G and Y will read +1 G...

    So, the square root of the sum of the squares of X, Y, and Z will always read 1 G when it's not moving. That's because it directly reads earth's gravity field...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-30 22:02
    Thanks for the feedback guys, my head's still a little fuzzy from a cold but I want to nail down this last feature. Rayman, are you saying that an accelerometer can indicate the incline even from a cold start? There can be no "reset switch" to indicate that it's level although that is essentially what the tilt switch would do. It is also true that I would want to detect a shallower angle than 30' and some tilt switches I saw said 15' but after looking at the datasheets I am not so sure they would be all that good. I probably need some hard figures as to the degree of incline but at the moment I am working on around 5 to 15.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • RaymanRayman Posts: 14,887
    edited 2010-05-30 22:18
    yes, 3-axis accelerometer tells vertical even from cold start...

    Basically, it's just made from 3 paddles that bend by gravity (or actual acceleration).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-30 22:30
    Ray, I have some MMA7660 chips but haven't had time to play with them. I was worried about being on a little bit of an incline and not being able to trust the readings from it on a cold start. I know that definitely if it was upside down or vertical it would tell me, but a small incline? Do you think? (I know, I know, I should try it myself).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • RaymanRayman Posts: 14,887
    edited 2010-05-30 23:13
    Well, I have to say that each chip has it's own slight offset... So, if it's less than say 10 degrees you're interested in, you need to do a per chip calibration....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-05-30 23:57
    Peter Jakacki said...
    ...One of my mechanical ideas is to have a simple ball bearing in a V shaped tube with a shallow angle. When the vehicle is level the ball sits in the groove of the V but moving up or down an incline it would move to either end and stay put....

    This might be okay for smooth surfaces but if your track is a bit bumpy, you might need to think about what the ball does during vibration. One possible solution (no pun intended), might be to have your V-shaped track immersed in a fluid that might help dampen vibration. Of course, you could punt the ball altogether and just go with a fluid, too, and have optical sensors give a signal when the fluid level (meniscus) passes across their lines of sight.

    That's 0.002 cents worth, so remember: if you use that idea, you owe me, man.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-31 00:09
    Ok, I am mounting a penny onto a lathe to measure and shave off 0.002 cents worth just in case....

    I don't think I'd be worried about vibration too much as a bit of sensible and smart debouncing would say whether the signal was "on the level". If at least I keep this part of the design on a plug-in module then I can experiment with various solutions easily without redoing the whole pcb. Maybe I just need a sensor that says it's level to reset the calibration on the accelerometer assuming that this figure will remain relatively stable between operations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • wjsteelewjsteele Posts: 697
    edited 2010-05-31 01:00
    I agree with Rayman, there is no reason why a 3 axis accelerometer won't work in this situation... If all you need to do is determine some arbitrary angle, then the accelerometer can do that quite easily. The problem comes in if you try to rely on that angle being constant... with an accelerometer, you're going to get a lot of "jitter" from the local movements occuring, so you will need to filter the data (over time) and assume that the maximum load will always be the Earths gravitational pull. From that, you can calculate the approximate angle to within a few degress of accuracy.

    BTW, don't always assume 1g = earth either, because the local gravitational field strength will vary depending on your position, so just use the max and you'll be fine, especially if you're not moving very fast. (Remember, a fast movement with an acceleration greater than 9.8ms2 will confuse it, like Ray's example of dropping it.)

    Bill
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-31 01:14
    Ok, I'm going to be blond for a moment and act dumb but doesn't an accelerometer measuring changes in g-forces rather than static g-forces. The chip may give you a latched output that says the phone is now upside down but it's only worked that out from the fact that it has experienced a change from being upright. I could just experiment but hey, this is the world's best forum and many of you will have already had experience with this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • wjsteelewjsteele Posts: 697
    edited 2010-05-31 01:23
    Peter,

    Yes, but it will always show an acceleration force due to the natural gravitational tug of Earth. If you were in space, far far away from any other objects, then you will get to a point where they will read zero g's. (Or in a free fall condition, but that is really only theroetical.)

    So, yes... and no. wink.gif (Gravity is an acceleration force... 9.8ms^2, which is why it detects it.)

    Bill
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-31 01:32
    Good, thanks Bill, that confirms what I thought too but whether it would be enough of a force that it could be discernible on a cold start at a shallow incline I'm not certain. Either way though I will use a simple tilt sensor with my accelerometer chip which I had planned to use from the beginning anyway.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • jazzedjazzed Posts: 11,803
    edited 2010-05-31 01:57
    The only problem with using an accelerometer would be when they are in the presence of vibration. There are painful filtering techniques for that problem though [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-31 02:16
    jazz, maybe if I have a sunshine detector I could use that to detect the road "rising" smile.gifsmile.gifsmile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • jazzedjazzed Posts: 11,803
    edited 2010-05-31 03:57
    Peter Jakacki said...
    jazz, maybe if I have a sunshine detector I could use that to detect the road "rising" smile.gifsmile.gifsmile.gif
    Peter, that is actually a form of a blessing although some of the phrasing is a little different from the Irish tradition.

    May the road rise to meet you,
    May the wind be always at your back.
    May the sun shine warm upon your face,
    The rains fall soft upon your fields.
    And until we meet again,....
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    May the road rise to meet you; may the sun shine on your back.
    May you create something useful, even if it's just a hack.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2010-05-31 04:21
    The ball rolling in a tube seems kind of clumsy somehow.
    Mercury in a tube seems better but also seems TOXIC.
    Slightly saline water in a tube might work, and be non-toxic.
    If I had to rig from scratch my inclination(lol) would be to
    utilize some optical phenomena like hang something reflective
    in a small container that when inclined would swing over an LED
    that is both pulsing and sensing light, two of these in the container
    would tell you the direction of the incline forward/backward
    and 4 or perhaps 3 could tell you of tilt in any direction.
Sign In or Register to comment.