Shop OBEX P1 Docs P2 Docs Learn Events
Propeller and Rotary Encoder — Parallax Forums

Propeller and Rotary Encoder

xanaduxanadu Posts: 3,347
edited 2012-03-23 06:36 in Propeller 1
I got this rotary encoder http://www.sparkfun.com/products/10982 and....

Will this object http://obex.parallax.com/objects/24/ work with the push button function?

Thank you.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-22 16:54
    I've used the quadraure encoder object in the Prop Tool's library before with an encoder with a push button.

    The button is just treated like a normal button, independent of the encoder.

    I'd think the object you linked to would work the same way, but I'm not sure about the "grey code" part of SparkFun's description. I thought grey code was different than just a normal quadrature encoder output (but I'm not sure).
  • xanaduxanadu Posts: 3,347
    edited 2012-03-22 19:20
    Can you tell me what pins the push button uses? I have the encoder working with the object. I didn't think the push button was encoded but I'm stumped on what pin it uses...
  • jagrifenjagrifen Posts: 36
    edited 2012-03-22 19:20
    JonnyMac wrote an object that I've used with great success. It directly supports the button. Unfortunately I can't find it in the Object Exchange. It was part of a Nuts and Volts Article in May 2010. Try looking here.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-22 20:17
    jagrifen wrote: »
    JonnyMac wrote an object that I've used with great success. It directly supports the button. Unfortunately I can't find it in the Object Exchange. It was part of a Nuts and Volts Article in May 2010. Try looking here.

    It's Spin Zone #6.

    I based my Mecanum robot's encoder code on JonnyMac's code.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-22 20:24
    xanadu wrote: »
    Can you tell me what pins the push button uses? I have the encoder working with the object. I didn't think the push button was encoded but I'm stumped on what pin it uses...

    The push button shorts the common anode of the LEDs to the middle pin of the group of five pins.

    Connect the center pin to a Prop IO pin set as an input (with a pull-down resistor on the Prop pin). When the pin reads a high level, the button has been pressed.

    These are different than the other encoders with push buttons I've used.

    The right angle RGB encoders SF sells use the same sets of pins for the button.
  • xanaduxanadu Posts: 3,347
    edited 2012-03-22 20:37
    Here's what I have so far...

    [video=youtube_share;7TQxMgffmAE]

    Thanks for the link to the article. In that article the encoder's push button shows a switch circuit, mine does not. I'm still completely stumped by that part of the datasheet :/
  • xanaduxanadu Posts: 3,347
    edited 2012-03-22 20:56
    Duane Degn wrote: »
    The push button shorts the common anode of the LEDs to the middle pin of the group of five pins.

    I was wondering what that pin was for haha, it's just not very obvious in the datasheet. Thanks Duane!
  • Mark_TMark_T Posts: 1,981
    edited 2012-03-23 03:42
    Duane Degn wrote: »
    I've used the quadraure encoder object in the Prop Tool's library before with an encoder with a push button.

    The button is just treated like a normal button, independent of the encoder.

    I'd think the object you linked to would work the same way, but I'm not sure about the "grey code" part of SparkFun's description. I thought grey code was different than just a normal quadrature encoder output (but I'm not sure).
    Its "Gray code", named after Frank Gray, and a Gray code is one where successive values differ in one symbol position (usually bit position) only. So binary quadrature encoding is the simplest Gray code beyond the trivial one-bit code. Its also a reflected Gray code.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-23 06:36
    xanadu wrote: »
    I was wondering what that pin was for haha, it's just not very obvious in the datasheet. Thanks Duane!

    I couldn't make sense of that datasheet. I just tested pins with my mulit-meter until I found a pair that shorted with the button pressed. I wasn't expecting one of the button pins to be shared.

    The button can only be used as a normally low button unlike a normal push button that can be used either normally low or normally high.

    Besides the pull-down resistor on the IO pin connected to the button, you might need a series resistor between the button and the Prop if you're powering the LEDs with more than 3.3V.

    Mark_T wrote: »
    Its "Gray code", named after Frank Gray, and a Gray code is one where successive values differ in one symbol position (usually bit position) only. So binary quadrature encoding is the simplest Gray code beyond the trivial one-bit code. Its also a reflected Gray code.

    Thanks Mark.

    After a bit more reading, I see a device I had thought produced Gray code doesn't. Apparently one of the key features of Gray code is only one bit position changes at a time, unlike binary which can have changes in many postions as it is increased or decreased by one.
Sign In or Register to comment.