Shop OBEX P1 Docs P2 Docs Learn Events
Tilt Sensors — Parallax Forums

Tilt Sensors

TrezitorulTrezitorul Posts: 68
edited 2009-04-10 06:04 in Accessories
I am building an inverted pendulum device. I am wondering if there is something cheaper than the traditional accelerometer, Gyro, kalman filter combination. Since these cost about $60 together.
«1

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-02-28 21:51
    If the pendulum is designed to work in one dimension only, you could attach a potentiometer to the base, with the pendulum secured to the shaft.

    -Phil
  • JohnBFJohnBF Posts: 107
    edited 2009-02-28 22:57
    By inverted pendulum do mean a segway-like device? If so, and if you only need to balance in relation to a level floor, another approach is to use an inexpensive distance measuring sensor to measure distance to the floor. I built this using a Parallax Ping sensor:



    Others have done this kind of thing with even less expensive IR emitter-receiver pairs.

    /John
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-01 20:30
    Should have been more clear yes I am building a segway like device that will travel over variable terrain that makes the distance sensing approach unviable. So what I am really asking is there a decently priced sensor that detects tilt relative to gravity and that is not affected by acceleration as the segway robot will be moving.
  • FranklinFranklin Posts: 4,747
    edited 2009-03-02 00:59
    You will probably find you will need to use more than one sensor and math to do what you want. A combination of gyro and accelerometer should get you started.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-03 06:53
    I was kind of hoping not to use the gyro and accelerometer combo. I am wondering if there is another way of doing this
  • SRLMSRLM Posts: 5,045
    edited 2009-03-03 07:46
    @Trezitorul

    Asking not to use distance, acceleration or rotational sensors on this type of robot is like asking for a car without an engine: sure, it might work in certain instances (going downhill with the car, square wheels with the bot), but there are certain essential features that make it possible.

    By the way, at a minimum you can get by with a gyro (for short periods).

    The question boils down to: how to I tell if I'm falling. I can:

    See how far away the ground is and compare it to how far it should be.
    Feel a tilt (gyro)
    Feel a change in the direction of a pull (gravity, acceleration).
    Look at the horizon and keep it in the middle of my view.

    I'm sure there are other schemes, but they can get pretty complicated for poor results...
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-05 02:01
    You are right SRLM but what I am wondering if there are any other tilt sensors that I may use instead of the traditional Gyro and accelerometers. I have no intentions of leaving out rotational sensors or any kind of sensor. I am merely exploring the possibilities for tilt sensors.
  • Jack CrenshawJack Crenshaw Posts: 46
    edited 2009-03-12 03:09
    SRLM said...
    Asking not to use distance, acceleration or rotational sensors on this type of robot is like asking for a car without an engine: sure, it might work in certain instances (going downhill with the car, square wheels with the bot), but there are certain essential features that make it possible.

    By the way, at a minimum you can get by with a gyro (for short periods).

    The question boils down to: how to I tell if I'm falling. I can:

    See how far away the ground is and compare it to how far it should be.
    Feel a tilt (gyro)
    Feel a change in the direction of a pull (gravity, acceleration).
    Look at the horizon and keep it in the middle of my view.

    I'm sure there are other schemes, but they can get pretty complicated for poor results...

    Let's think about this for a moment. Suppose I'm standing. To make it more challenging, assume that I'm blindfolded and the nerves from my inner ear have been surgically cut.

    Will I be able to stand without falling? The answer is yes, because I'm getting feedback from my feet telling me that I have a certain weight distribution between heel and toes. If I feel the weight on my toes too much -- especially if it's increasing -- I know that I'm soon going to be falling forward. So I apply more pressure to my toes to make myself lean backwards a bit. I'll stabilize in a position such that the weight is balanced. Ditto for side-to-side balance. If I sense more weight on one foot than the other, I'll apply even more pressure to bring myself back to equilibrium.

    Now, what if the floor is not level? It doesn't matter. My toes may be higher or lower than my heels, but I still want the weight to be evenly distributed.

    Now let's make it more interesting. Suppose that I'm not standing on the floor, but in the aisle of a stationary train. Now suppose that the train starts moving. Assuming that it doesn't accelerate too fast -- that its acceleration doesn't exceed the control authority of my toes -- it's still no problem. As good ol' doctor Einstein has taught us, the acceleration is relative. Gravity or acceleration, it makes no difference. I'll still adjust my position so that my weight feels evenly distributed.

    So on the basis of this thought process, I think you don't need any tilt sensors at all. Just strain gauges, either on the "post" of the Segway-bot, or on some movable joint.

    This doesn't necessarily mean that the overall control of the bot doesn't need other sensors. I may need, for example, tachometers to tell me that I'm moving, speeding up, or slowing down. Or a pot to tell me that the "post" is inclined relative to the chassis (assuming that it's got a pivot at all, which need not be the case). But in the end, I just want to keep my center of gravity aligned with the acceleration vector, and strain gauges or toes are all I need to do that.

    Jack
  • SRLMSRLM Posts: 5,045
    edited 2009-03-12 03:34
    @Jack

    I don't think that will work for a robot. First off, it will probably use wheels (that's what I assumed). Sure, robots like the penguin and the toddler don't fall over and they don't have any of these types of sensors, but that is because they use feet instead of wheels. With wheels, you quite obviously have only one point of contact (in a perfect world) with the ground, while a foot will have an area. I suppose you might be able to make a wheeled robot with a large weight on a pole, and measure the deflection, but you will have to be constantly rolling about and have some very sensitive measurement devices I'd think.
  • dredre Posts: 106
    edited 2009-03-12 14:40
    Does this link help?

    http://www.memsic.com/data/pdfs/an-00mx-012.pdf

    Please post Pbasic math if you use this approach to help others like myself.

    cheers, David
  • Jack CrenshawJack Crenshaw Posts: 46
    edited 2009-03-12 15:01
    SRLM said...
    I don't think that will work for a robot. First off, it will probably use wheels (that's what I assumed). Sure, robots like the penguin and the toddler don't fall over and they don't have any of these types of sensors, but that is because they use feet instead of wheels. With wheels, you quite obviously have only one point of contact (in a perfect world) with the ground, while a foot will have an area. I suppose you might be able to make a wheeled robot with a large weight on a pole, and measure the deflection, but you will have to be constantly rolling about and have some very sensitive measurement devices I'd think.

    You miss my point. The discussion was not about feet and toes, but about sensing where down is. I was trying to explain, by analogy, that you (or your robot) don't need gyros or accelerometers to know that you're falling. Sensing the distribution of forces -- and the way they are changing with time -- is enough.

    Jack
  • JohnBFJohnBF Posts: 107
    edited 2009-03-13 01:32
    Jack,

    This is a great thought experiment, but I'm not sure your suggestion eliminates accelerometers, it just invents a new type. An accelerometer works by measuring a physical change caused by acceleration. The Memsic 2125 works by measuring the position of a heated bubble in a liquid. The Crenshaw Heelerometer measures changes in pressure of objects pressed together by forces of acceleration.

    Ultimately all accelerometers are confounded by the fact that gravity is a form of acceleration. If you are standing blindfolded in the aisle of a train and the train begins to accelerate very smoothly in the direction you are standing, neither a Memsic or Heelerometer could determine whether the sensor reading is because you are starting to lean backward or the train is accelerating forward. But the corrections are different - if the train is accelerating, the balance point puts more pressure on the toes.

    Or maybe I'm not looking at it right. But I'm not convinced we've found an alternative for Trezitorul.

    /John
  • Jack CrenshawJack Crenshaw Posts: 46
    edited 2009-03-13 14:23
    JohnBF said...
    This is a great thought experiment, but I'm not sure your suggestion eliminates accelerometers, it just invents a new type. An accelerometer works by measuring a physical change caused by acceleration. The Memsic 2125 works by measuring the position of a heated bubble in a liquid. The Crenshaw Heelerometer measures changes in pressure of objects pressed together by forces of acceleration.

    Well, that's a good point. I suppose that, in the case of the human, we've turned the whole body into an accelerometer. Point taken.
    said...
    Ultimately all accelerometers are confounded by the fact that gravity is a form of acceleration.

    But that's precisely the point.

    This discussion has migrated a bit as we learned more about Trezitorul's needs. He originally said he wanted a "tilt sensor" without using a full-up, 6-d navigation system. Some of us interpreted the question differently, based on what we thought he wanted to do. Some thought that he was looking for an absolute, gyro-horizon type of level. IOW, tilt relative to the surface of the earth. Others, I think, were thinking in terms of his more immediate need, which seems to be to decide whether to speed up or slow down the base of the bot. Put me in the latter camp.

    In retrospect, I think we should have asked him the control-system question: Once you know the "tilt," what do you plan to do with it? If the goal is just to keep the bot from falling over, I'm claiming that you don't really need to know which direction the center of the earth is. You don't NEED to distinguish between gravitational and vehicle acceleration, and a much simpler set of sensors will do.
    said...
    If you are standing blindfolded in the aisle of a train and the train begins to accelerate very smoothly in the direction you are standing, neither a Memsic or Heelerometer could determine whether the sensor reading is because you are starting to lean backward or the train is accelerating forward. But the corrections are different - if the train is accelerating, the balance point puts more pressure on the toes.

    Can we please drop the obsession with toes? http://forums.parallax.com/forums/emoticons/smile.gif

    ??? Why the difference??? The only point, seems to me, is that you need to stay on top of the combined acceleration vector. i.e., keep the center of gravity aligned with this vector. Under constant acceleration, the best balance strategy is exactly the same as if you're standing still. So saith Einstein. If you want to "put more pressure on the toes," it's because you anticipate more acceleration yet.

    Can we please drop the obsession with toes? I'm starting to get athlete's foot. http://forums.parallax.com/forums/emoticons/smile.gif


    Jack
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-21 18:09
    Thanks for all of the responses. Sorry for all of the confusion but I was thinking when making this segway device that I would find the angle of tilt relative to gravity not the earth. This would allow it to handle tilted terrain. Essentially a pendulum sensor would work fine but it has problems with oscillations. I actually came up with a similar design except inverted. I would like your opinion on it. Essentially it is a container full of water. Inside there is a light weight rod attached to the rotating part of the potentiometer and the other end is attached to a container of pressurized gas. The container full of gas will always float straight up and it will theoretically turn the potentiometer to indicate where straight up is and thus the direction of gravity.
    1374 x 768 - 20K
    1374 x 768 - 10K
    1374 x 768 - 10K
  • JohnBFJohnBF Posts: 107
    edited 2009-03-22 12:43
    I'm not clear why you think this is better than something like the Memsic accelerometer. It's kind of a huge, slow one-D accelerometer.

    Are you trying to damp the oscillations you mention? Trying to balance a segway-like robot with just an accelerometer leads to a rapid oscillation of the wheels as lateral motion and tilt keep telling the wheels to go in the opposite direction. This water-damped accelerometer slows everything down, but I don't think it solves the underlying problem.

    By the way, another approach might be to use an accelerometer plus a wheel encoder. If the encoder tells the processor what lateral motion to expect, it might be possible to cancel it out. And a wheel encoder might be cheaper than rate gyro.

    /John
  • ZootZoot Posts: 2,227
    edited 2009-03-22 13:45
    You will need to use a PID or perhaps just a PI algorithm to drive the wheels/actuators, regardless of sensor. There are many examples for the Stamp, SX, Prop posted at the forums (also read up at Wikipedia on the general theory). PID control loops dampen oscillations and eliminate steady-state errors in these kind of control systems.

    I agree with JohnBF -- not sure what your resistance is to purchasing a $30 accelerometer and/or a $30 gyro -- the complexity of what you are describing building yourself will surely take much more time and $$ then these tried-and-true solutions. You can also purchase ready-to-go IMUs (which contain several axes of accelerometers and gyros) on one board for less than $80 or so. Just something to consider.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • W9GFOW9GFO Posts: 4,010
    edited 2009-03-22 16:56
    I think you should build it just to see how it functions. No need to pressurize the gas in the float, that just adds weight. However I do not believe it will work.

    Say you are standing still on your balancing machine. It starts to tilt forward. Your float, if it works properly, will try to remain standing up which will tell the wheels to go forward. Now that the wheels are moving the acceleration will cause your float to move further rearward and you would soon be on your butt. Now if your container was full of a very dense gas and your float was a helium balloon on a graphite rod - the acceleration would cause the float to move forward - the dense gas would be moving rearward. Just like what happens when you have a helium ballon in a vehicle. When you brake, the balloon moves rearward.

    Like has been said, you would be better off just buying the sensors. On the other hand, building something like a Segway using such DIY sensors definitely has value.

    Rich H
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-22 20:04
    Just exploring possibilities I guess. You bring up a good point W9GFO that the mass would cause it to misread the angle of tilt when the device began to accelerate. I have thought of this and I was thinking to use extremely light weight parts for the rod and the bubble. The resistance of the water would hopefully cancel out the inertia of the rod and the bubble. It is all theoretical at this point and I would appreciate any criticisms about this design.

    Thanks,

    Trezitorul
  • JohnBFJohnBF Posts: 107
    edited 2009-03-22 21:20
    Guys, I think you've got the physics a little backwards here. The float is lighter than the water. When the wheels accelerate the robot forward, the water will be pushed back, and the float, being lighter than the water, will be forced forward. This will make the robot think it is tilting backwards and the wheels will accerate the robot to the rear, which will make the robot think it is tilting forward and reverse the motors. Ad infinitum, which is why the wheels will merely oscillate unproductively.

    /John
  • W9GFOW9GFO Posts: 4,010
    edited 2009-03-22 21:33
    I had assumed that the container would be closed and full of water, no room to slosh about. The sloshing would defeat the purpose of damping. Since water is essentially incompressible I wouldn't think that the float would move opposite the water. It would be easy enough to test though....

    Rich H
  • JohnBFJohnBF Posts: 107
    edited 2009-03-22 21:46
    Sloshing not necessary. If the float floats at all, it is because it is being forced in the same direction as the acceleration, as the heavier water is pushed away from the direction of acceleration. Keep in mind that standing still on the surface of the earth is the same as being out in space and accelerating upward (toward your head) at 32 ft/sec per second. So in a horozontal acceleration forward the float moves forward. If an experiment shows otherwise it will be big news!

    /John
  • W9GFOW9GFO Posts: 4,010
    edited 2009-03-22 23:13
    Indeed I was right! It was easy to test [noparse]:)[/noparse]

    I stuck a ping pong ball on a 4" string and stuck the string to the bottom of a jar. The jar was filled with with water and capped. There remained a jellybean size bubble of air in the jar because my sink isn't deep enough to assemble fully submerged.

    Results - shove the jar to the right, the ping pong ball goes right, then oscillates for ten to twelve seconds before becoming motionless, JohnBF is correct. I would have expected better dampening. Air space in the jar doesn't affect dampening as much as I would have thought but it does alter the oscillations. Also, a shorter string increases the time for the oscillations to stop.

    So, no big news here!

    Rich H
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2009-03-23 00:40
    I wrote an article for Servo a couple of years ago about pendulum/potentiometer attitude sensors.
    With a capacitor in the loop you can damp out the oscilations pretty easilly.
    It's the December 2005 issue.
    Jim-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-23 23:50
    Wow thanks for all of the input. I did not think about float floating as it being forced above the water. Thanks for the insight JohnBF. I had assumed that not having any space for the water to go would mean that it would reach a sort of equilibrium and not move within the container at all. Does anyone have any other ideas for a diy cheap tilt sensor, since my pet ideas has gone down in flames at least as a tilt sensor. You could use it as an accelerometer by measuring the amount that the float goes in the direction of the acceleration.
  • SRLMSRLM Posts: 5,045
    edited 2009-03-24 05:44
    You could always measure tilt by comparing the relative position of a known celestial object with a clock and a star chart...
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-25 16:51
    That is a good idea but since the device moves it would be awfully difficult to watch the reference point and it would be awfully difficult to account for slopes. Hmm I wonder what other ideas are out there.
  • JohnBFJohnBF Posts: 107
    edited 2009-03-25 17:59
    When I built a simple robot that balances by reference to the ground, some of my friends suggested I could have done it even more simply with square wheels. Ha Ha, I said. But slightly less rediculous is this... If you use large wheels and have enough of the weight slung below the axle, so that the center of gravity is below the axle, the robot will balance with no active measures. Not very interesting. However, if the center of gravity is a little above the axle, dynamic balancing will be necessary, but require less speed and accuracy than a robot with a very high center of gravity.

    This is not a good strategy for a segway-like robot, because a high center of gravity is necessary so that the wheels effectively get themselves under the top of the robot, instead of just pushing the whole thing around without changing tilt.

    HOWEVER... another approach would be to use a servo to move a mass attached to the robot - like a person swinging arms to stay in balance. This would not require a high center of gravity, and there would be no constant motion of the wheels to confuse an accelerometer. A low-slung robot like this might work using just an accelerometer. Or might not - just a thought.

    /John
  • TrezitorulTrezitorul Posts: 68
    edited 2009-03-25 23:07
    Hmmm sounds interesting. Unfortunately I am trying to actually build a segway replica and so a solution such as that would not work. But it is a very good idea.
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-04-06 13:29
    With the oscillatory damping device in place, a simple 20 cent mercury tilt switch is the cheapest tilt detector. I built a very inexpensive inclinometer to detect tilt on Toddler robots when walking inclines.

    humanoido
  • cessnapilotcessnapilot Posts: 182
    edited 2009-04-10 06:04
    Hi Trezitorul,


    A cheap tilt sensor (that works) is 2 HM55B mounted
    orthogonally to form a 3-axis magnetometer. A cheap
    microcontroller, like the Propeller, can calculate the
    Earth's magnetic field vector at the given location using,
    for example, the WMM2005 or the IGRF-10 mathematical models.
    These are free. Tilt can be figured out (+- 2.5 deg)
    comparing the measured and the actual vector. If you combine
    this with a H48C 3-axis accelerometer with low-pass filtered
    signals and Fuzzy logic, the 'Triad' algorithm can yield a
    +-1 deg accurate attitude even then when the device is
    accelerating. The sensors can be mounted in one cubic inch
    in rugged form + the PCB for the Propeller. You put in less
    than 50 mA and get out digitized attitude data.

    By the way, how much does your robot cost?


    - Istvan·
Sign In or Register to comment.