Shop OBEX P1 Docs P2 Docs Learn Events
VEX Quadrature encoder — Parallax Forums

VEX Quadrature encoder

lbhooballbhoobal Posts: 6
edited 2009-03-08 23:53 in BASIC Stamp
Hi All,

I am using VEX Quadrature encoder to get the direction and the distance traveled by the Boe-bot.I do not know the circuit and as well as the ways to retrieve these values through the PBASIC.Can anyone help me in accomplishing this?

Thank you in advance,
Lokesh

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-01 22:07
    · The key to your program is reading the quadrature encoder, I think.

    · I've attached a bit of coding that I've used several times with good results.

    ·· The pulses coming into the Stamp have to be relatively slow ( say no more than 10 per second) in order that the Stamp has time to do other things.

    · Hope this helps.·

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
  • lbhooballbhoobal Posts: 6
    edited 2008-12-02 15:28
    Hi Tom,

    I thank you for your reply.I will work on this with your program.If I face any problem,I will post here.

    Regards,
    Lokesh
  • lbhooballbhoobal Posts: 6
    edited 2008-12-02 15:42
    Hi Tom,

    Can you please share the circuit diagram for the program that you have attached?

    Thank you in advance,
    Lokesh
  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-02 20:27
    I'll see if I can get a sketch done tonight.

    Basically, each encoder pulse is fed into an input ( pin 6 and 7 in the program).

    An LED (and resistor) connected to pin 0 turns on if the encoder is going in one direction and off if going in the other.

    Pins 8 through 15 show the binary count of the encoder. You can optionally put LEDs (and resitors) on each pin to see the count.

    I only needed to count a limited range so I started "counter" at 127. You can put any number you want there.

    Cheers,

    · <<<<<<<<<<<<< Edit:· Sketch added Dec 2, 2008 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com


    Post Edited (stamptrol) : 12/3/2008 12:47:24 AM GMT
    896 x 736 - 75K
  • lbhooballbhoobal Posts: 6
    edited 2008-12-03 17:10
    Hi Tom,

    I thank you once again for providing me further input.I have set the circuit in the way that you have specified.However I am not receiving the desired output when I rotate the motors.

    The following is my set up.
    1.I took both the black wires of the encoder to the ground.
    2.I took both the red wires of the encoder to the +5 V power supply.
    3.I connected one of the white wires to the one end of the 100 ohm resistor whose other end goes to PIN 6 of the STAMP.
    4.I connected another white wire to one end of another 100 ohm resistor which in turn is connected to PIN 7 of the STAMP.
    5.I connected anode of the LED to the resistor that in turn is connected to PIN 0 of the STAMP.I connected cathode of the LED to the ground.

    When I run the program,I do not see the LED glowing irrespective of the direction in which the motor is rotating.I would like to know as to where am I going wrong.

    Thank you in advance,
    Regards,
    Lokesh
  • $WMc%$WMc% Posts: 1,884
    edited 2008-12-03 18:36
    ibhoobal

    I haven't used the VEX encoder,But I have a API-HAROWE,inc Quad encoder.It needs at least 7.5volts input to deliver a 4volt output.
    I would double check the DOC.s on Your VEX.Any voltage checks/test/changes should be done w/ the VEX removed from the $stamp.as this could exceed the 5volt TTL limit.This is a no no on any I/O pin on the $stamp.


    _______Its just a Thought________$WMc%_____
  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-04 13:31
    Had a quick look at the VEX info. Too bad they didn't show a simple schematic of the device!

    Your connections sound fine......you do have the encoder ground connected to the Stamp ground, right?

    Also, don't forget you will be feeding the Stamp 90 pulses per revolution of the encoder. If the encoder spins at any great speed, the stamp won't be able to keep up. If the shaft turns once per second, that's 90 pulses per second which, in my experience, is too fast for the Stamp.

    Finally, check the signal level on the white leads with a voltmeter to make sure the high level is somewhere between 4 - 5 volts and that it drops close to 0 volts. Turn the shaft VERY slowly to see the switching action.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • lbhooballbhoobal Posts: 6
    edited 2008-12-08 16:46
    Hi Tom,

    I tried running the program with the circuit but I couldn't get it to work.Is there any ways that you suggest me of troubleshooting this and getting it to work.For testing purpose,I was rotating the shaft by hand.

    Thank you in advance,
    Lokesh
  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-08 18:31
    Lokesh,

    Are the signal voltages switching between 0 and 5 volts as you rotate the shaft?

    Tom

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • lbhooballbhoobal Posts: 6
    edited 2008-12-09 16:08
    Hi Tom,

    The signal voltages are switching between 0 to 5 V when I rotate the shaft.However the range that I get is from 0V to 2.6V.

    Regards,
    Lokesh
  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-09 20:21
    I assume when you say 2.6 volts, thats when the encoder is hooked to the stamp pin?

    If its only going to 2.6 volts, it won't switch reliably. An earlier post had some information about having to drive the VEX with 7 volts in order that the outputs get closer to 5 volts.

    Alternatively, does the VEX recommend pull-up resistors to +5 volts?

    T

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Adam YakaboskiAdam Yakaboski Posts: 4
    edited 2009-03-08 23:53
    I know I am a little late to the party but Im fairly certain that all of the inputs on the controller have pull-up resistors which is why a lot of the sensors don't work without them.
Sign In or Register to comment.