Shop OBEX P1 Docs P2 Docs Learn Events
Reading LISY300 Gyro with a Stamp 2 Microcontroller — Parallax Forums

Reading LISY300 Gyro with a Stamp 2 Microcontroller

crazyarch93crazyarch93 Posts: 9
edited 2011-02-20 13:17 in Accessories
I am trying to connect a LISY300 gyro to my Stamp 2 microcontroller. I have it connected up and I am running the demo code with a few modifications for my application (which is to adjust an R/C servo with a camera attached).

I looks like everything is working per spec and the readings I'm getting are what is expected. So far so good. Where I'm having trouble is where to go from there?

I have tried polling the results of the gyro for a few microseconds, then averaging the degrees per second rates, then dividing that by the seconds to get actual rotating. I am getting mixed results from this and I am introducing some pretty huge errors if the mount experiences a quick tilt.

Does anyone have any clues as to how to take the gyro information on rate/second and convert that to actual rotation? I know there are several sources of error using this method (drift, noise, calculation error multiplying, etc.) but I was going to try this before getting more complicated.

I am using the PBASIC on the stamp 2. would appreciate any code examples if anyone has any.

On a side note, is this pretty new technology? Seems there isn't a lot of information on it compared to other sensors. Just wondering as I'm new to the whole robot hobby.

Comments

  • crazyarch93crazyarch93 Posts: 9
    edited 2010-12-05 13:20
    It is a little strange because it occurs to me that I'm actually having a conversation with myself on this forum, but hey I'm having fun with this little challenge and that's what hobbies are all about I suppose. Anyway I got into the whole robot thing only because I wanted to build a gyro camera. My "hobby" is riding bikes and photographing the process. I must admit though that this little project has peaked my interest in robotics and I even helped my wife out this weekend with a VEX robot competition at her school. Never in a million years would I have thought that keeping a camera level on a moving motorcycle be such a technical feat!

    There was a thread in these boards concerning motorcycle lean angles and there were several "solutions" put forward but those really are theoretical at best and it's turning out that the environment of a moving bike is exposing the weakness of almost all approaches I've tried. For example:

    Idea #1: Distance 2 sensors pointing down one on either side of the bike and comparing the difference to get rotation. There are several problems with this approach. The first is apparently the signals are not bouncing back off the road predictably as I get crazy results if any at all. At 160 mph, so many sources of noise interfere with the sensor and wind and flying objects destroyed several sensors. The bike may also be moving so fast that the pulses are coming back to where the sensor used to be! I could go to better sensors but frankly, I got such little success with this approach I didn’t feel it was worth looking for more robust sensors and better mounting/isolation methods.

    Idea #2: Another proposed solution was to analyze lean angles versus turning radius/speed. The problem with this is that the actual forces/angles involved in turning a real motorcycle are extremely complicated. The theory books say a bike turns using the cone effect, meaning that leaning the bike angles the tires against the road so the bike turns like an ice cr
  • ArieJacobiArieJacobi Posts: 2
    edited 2011-02-20 13:17
    thanks for talking to yourself a while. I just read it now and I find it interesting. one thing I'd like to add.... it might help understand the lean angle problem.

    If for some crazy reason you wanted to make a cup hold for your bike that would keep the coffee level, you might want to hold the cup on a pivot that would let the coffee swing from side to side. You might think that when you were turing that the cup would lean so that it was perpendicular to the ground. If you did this you'd realize that you'd wasted your effort. the cup would always lean so that is was inline with the tires. (this does not take into account the change of center of mass caused by leaning way out into the turns.) if you made a static cup holder, the coffee would always (except for splashing) tend to stay level relative to the cup and motorcycle. ie. gravity is not going to inform you of your lean angle. That is why we need something like a gyro to give us that info. This is the beauty of a motorcycles dynamics. it always finds just the right lean angle to balance all its forces.

    I'm just starting down the road you've been on for a while. Wish me luck,

    Thanks,
    Arie
Sign In or Register to comment.