Shop OBEX P1 Docs P2 Docs Learn Events
Reading Futaba 401 gyro information — Parallax Forums

Reading Futaba 401 gyro information

patterson7019patterson7019 Posts: 25
edited 2008-09-11 00:27 in BASIC Stamp
Anyone know how to read the Futaba 401 gyro positional information? Would it be safe to read it like a servo? Would the parallax servo controller read it's info correctly?

Thanks,
Lee

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://perfectaperture.com/robb

Comments

  • ZootZoot Posts: 2,227
    edited 2008-08-20 20:14
    Read it "like a servo", i.e., PULSIN and convert the pulse width to microseconds (for ease) or just use the raw in if you don't mind.

    Just like PULSOUT to a servo (in reverse).

    ~1500us (1.5ms) pulsewidth should be "level".

    I *would* put a 220 or 470 ohm resistor between the signal out of the gyro and your Stamp pin, however. This way if you accidentally make the pin an output, you won't short out and release smoke from your Stamp.

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

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-08-22 22:38
    Did this work? I have one of those gyros wasting away in the box. I could use it if this works.
    J-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A wise man told me; "All electronics are made to work by magic smoke.

    Don't ever let it out as it's·very difficult·to get it back in."
  • ZootZoot Posts: 2,227
    edited 2008-08-23 17:24
    I've checked this out a bit more and unlike some of the other gyros I've used, the R/C gyros require an input and then deliver an output. In other words, a standard servo pulse is sent *in* to the gyro, and it "changes" that servo pulse and sends it to the output -- depending on the rotation about it's axis. It's meant for auto-trimming flying aircraft.

    So.... the trick to using these inexpensive gyros is generating a 1500us servo pulse (dead center) into the gryo so that the output can be read as "tilt" or deviation from dead center.

    On an SX this is easy -- one pin to the gyro (in the ISR) generates a constant neutral pulsewidth, another pin reads the pulsewidth generated (like pulsin).

    On the Stamp I do not think this is possible without a peripheral that is generating constant servo pulses for the input. With a PSC (Servo Controller), then it would be easy -- set one servo channel to 1500us (750) and leave it there. That's the input to the servo; then read the output signal with PULSIN.

    One advantage here is that one could generate an input that is not dead center -- to tune the gyro if it's not mounted exactly straight or whatever -- since the output is the deviation from whatever the input is.

    I'm going to order one of these to play with -- I really want to build a balancing bot (that'll be an SX, though, not a Stamp).

    e.g.

    www3.towerhobbies.com/cgi-bin/wti0001p?I=LXMSF8

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

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • ZootZoot Posts: 2,227
    edited 2008-09-09 14:58
    OK, I've had a chance to receive and play with a GWS PG-03 gyro. I picked up this unit for about $35 on sale over Labor Day weekend.

    patterson7019 -- The Futaba 401 you refer to is *much nicer* -- and pricier :-) -- more stable and allows for what's called "heading-hold" which means that it will report more accurate axis rotational info.

    The PG-03 works as follows (the 401 is similar but will prob. give you better results without having to integrate the readings to get tilt/rotation):

    - servo signal goes into servo cable (I set up a PSC to output a 1500us reference pulse, but a 556 timer or an SX or just about anything that can be configured to output a servo pulse will work)

    - adjust setup pot on gyro so·LED·shows "red/green" simultaneously

    - gyro servo socket is tied to an input pin for use with PULSIN

    - gyro is read via pulsin

    - I did not need to adjust the gain pot at all

    Now, since the gyro is meant to "stabilize" a connected servo, it reports just the "change" in rotation about it's measureable axis, then returns to "center". So you don't get what I would think of as "absolute" tilt without integrating the error.

    My attached test program works fantastically well -- very stable and consistent readings as I tilt the gyro back and forth. Can't wait to build a balancing bot this winter....



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

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 9/9/2008 3:06:41 PM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,563
    edited 2008-09-10 03:06
    Zoot,

    Excellent! Keep us posted with your results!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-09-10 21:28
    Well? Hows it going? I was going to suggest a 555 timer for your base pulse, it might free up some code and execution time on your software.
    Jim-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A wise man told me; "All electronics are made to work by magic smoke.

    Don't ever let it out as it's·very difficult·to get it back in."
  • ZootZoot Posts: 2,227
    edited 2008-09-11 00:27
    Cannibal -- Are you asking me or patterson0719? See my above posts. Any servo pulse source will work. I just used a PSC and BS2 because I had them free on my bench.

    My own future project will be an SX-based 'bot, which will be more than capable of handling a number of servo pulse outs, measurements, ir modulation (sensors), and pwm out to h-bridge motor drivers.

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

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.