Shop OBEX P1 Docs P2 Docs Learn Events
Encoder Guidance — Parallax Forums

Encoder Guidance

ajwardajward Posts: 1,130
edited 2012-08-28 09:12 in Robotics
Hi All...

I'm reviving my 'bot, Orville. He was built with the MSR1 control board, the 7.2 volt motor and wheel kit and the big caster wheel. He was ==fast== but mostly uncontrollable, with the dings in the drywall to prove it.

Today's mail brought me a set of Pololu motors with built in quadrature encoders. These guys: http://www.pololu.com/catalog/product/1447. At 131:1 they are a little slower than I'd like, but I'd also like to have a little control over the beast.

Now, I have only the vaguest idea how encoders function and was wondering if someone could point me to a tutorial, how-to, etc... on making these things work?

Many thanks for any guidance!!!!

Amanda

Comments

  • kwinnkwinn Posts: 8,697
    edited 2012-08-18 22:56
    Take a look at the section titled "Incremental rotary encoder" at http://en.wikipedia.org/wiki/Rotary_encoder
  • ercoerco Posts: 20,256
    edited 2012-08-19 00:02
    http://prototalk.net/forums/showthread.php?t=78

    http://www.ni.com/white-paper/7109/en

    http://letsmakerobots.com/node/24031

    http://www.robotoid.com/appnotes/circuits-quad-encoding.html

    I figure if I bury you with lots of technical QE reading, you'll have less time to surf Ebay and beat erco's lowest price postings. You're beating me at my own game!
  • ajwardajward Posts: 1,130
    edited 2012-08-21 11:35
    Thanks guys... very helpful!

    I set up the motors this morning, running each motor on 6 volts and the hall sensors on 6 to 12 volts. On the 'scope, I got the two out of phase square waves at 5 volts.
    The next step is connecting the hall sensor outputs to the propeller, but I'm unsure of how to interface the 5 volt signal to the prop input pins.
    (The output of the sensors was 5v regardless of Vin) <-Hmmm, that shouldn't be right. More experimentation is needed!
    Ah... I initially used a Homework board to power the Hall sensors and was one pin off. Was supplying the sensors with Vdd instead of Vin. Arghhhhhh!

    Experimenting, I found i can use a 19k pulldown resistor to get to 3.0 volts. Is this sufficient or should I look at something more elaborate?

    Thanks for any advice.

    Amanda
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-08-21 11:48
    Since you are using the MSR1 board I think you will find this thread very useful. There are wiring examples and code on the second page. It has samples with the encoders on pins 8,9,10, and 11. I followed that on my Stingray robot and it works great so far.

    http://forums.parallax.com/showthread.php?118906-Stingray-Motor-Shaft-Encoders&highlight=stingray+encoder

    Robert
  • ajwardajward Posts: 1,130
    edited 2012-08-22 06:11
    Thanks Robert!

    Good information. I "think" I saw the thread before, but never dug into it. Spent a couple of hours looking at the code and have a better idea of how the encoders work.
    My stumbling block before was thinking the motor/encoder worked like a servo. DOH!

    I should finish up the mechanical bits this morning and hope to have Orville moving under his own power later in the day.
    Had Orville running just a bit ago with power directly to the motors. Pretty slow, but I'm running both motors from a tired 6v battery pack. Traversed the living-room carpet in a (mostly) straight line. I like the lower speed... I don't have to run to catch him before he runs into something.

    Thanks again,

    Amanda
  • ajwardajward Posts: 1,130
    edited 2012-08-26 10:44
    More questions! More of a hardware nature tho'...

    I have Orville all wired up and rechecked "several" times. I'm using Ray Tracy's Poly-1 code from the link above, however I can't get to work. The issue seems to be the encoder pulse train is running at about 1.5 volts which is below the Prop's threshold.

    If I run the bare motor/encoder at 5v, I get a 5v square wave out. When I connect the encoder outputs to the Prop pins, the square wave drops to 1.5 volts. If I connect the encoders to an external supply at about 8 volts, the square wave goes to a little over 2 volts and the code starts to work. Can the Prop pin drop that much voltage? Am I missing something in the way I'm connecting the encoders? (I'm connection the outputs directly to pins 8-11)

    Thanks again for any advice!

    Amanda

    Forgot: Running the board from a 9.6 volt battery pack. The 5v source from the MSR1 ports runs from about 4.98 to 5.03.
  • ratronicratronic Posts: 1,451
    edited 2012-08-26 11:42
    Amanda the MSR1 uses voltage translator ic's to interface the Propeller @ 3.3v to the 5v servo output header's. I have found that to be able to over come the translator's output it needs to see ~3.3k to 4.7k or less to either ground or 5v to make it an input instead of an output.

    In the past when I have ran into these kind of problem's of my device not being able to supply the current needed to force the translator's from output to input, I have bypassed them for which the MSR1 has provision's for. When they are bypassed I would use a series resistor from the 5v device to the Propeller.

    Not that I am recommending this but it is another way to use your encoder's with the MSR1.
  • ajwardajward Posts: 1,130
    edited 2012-08-27 11:54
    Success!!!!! Well... sort of.

    After some measuring, tweaking, more measuring and more tweaking and maybe a bit of coarse language, I have Orville moving, albeit not quite the way I want. Programming a six-sided figure results in a "square" with 90 degree angles and 6 legs... a square and a half, if you will. BUT!!! The MSR1 is reading the encoders! I just need to twiddle with the constants.

    After looking at the waveforms, I decided to power the encoders from Vin, the 9.6v battery potential. If I go up to the motor's rated 12 volts, I may need to look at pull down resistors.

    Back to the laboratory!

    Amanda
  • ercoerco Posts: 20,256
    edited 2012-08-28 09:12
    WooHoo! Sounds like the encoders are guiding YOU! :)
Sign In or Register to comment.