Shop OBEX P1 Docs P2 Docs Learn Events
Incremental Encoder --> Absolute Encoder — Parallax Forums

Incremental Encoder --> Absolute Encoder

crgwbrcrgwbr Posts: 614
edited 2006-10-06 17:42 in General Discussion
Hello Everyone,
I'm working on a project that requires the use of a very acurette encoder.· We should be using a 12 bit absolute encoder with PWM output, but because of budget cuts, we have to use this one (2500 ppr incrementle encoder).· It has·an "NPN open collecter output."· I have yet to figure out what that means.· What I would like to do is, as soon as the unit turns on, assign the·ENCODER varible 0.· Then every step·the encoder takes up, add one too ENCODER; every step down, subtract one.· I could most likely figure this out on my own, however, I am concerned about the encoder moving while the program is doing somthing else (read keypad, display stuff on LCD, ect.).· At most, the encoder will be moving at 0.5 rpm, but moving·almost constantly.· How can I avoid this "slipage affect."

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life

Comments

  • BeanBean Posts: 8,129
    edited 2006-10-05 13:15
    2500 ppr * 30 revolutions per second = 75000 pulses per second.
    2500 ppr * (0.5 / 60) = 20.8333 pulses per second.
    So as long as you sample faster than that, you shouldn't lose any pulses.
    Or you could use the PortB interrupts and that would be even better.

    NPN Open collector just means you need a pull-up resistor on the outputs.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    Don't mistake experience for intelligence. And vis-vera.


    Post Edited (Bean (Hitt Consulting)) : 10/5/2006 2:51:42 PM GMT
  • crgwbrcrgwbr Posts: 614
    edited 2006-10-05 13:37
    Thanks Bean,
    Although I'm not sure where you got the 30 revolutions per second. I had mentioned 0.5 rpm, meaning about 0.008 revolutions per secound or about 20 pulses per second. Eather way it shouldn't be a problem. Pull-up resister, that means the pulses will be low, and the space will be high, corect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • BeanBean Posts: 8,129
    edited 2006-10-05 14:48
    Oops,
    Ol' bean multipled instead of divided. 75000 pps or 21 pps... I was close...

    Your right about 21 pulses per second. That can easily be handled without missing any by using a period interrupt. For example "INTERRUPT 100" will run the interrupt routine 100 times a second.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    Don't mistake experience for intelligence. And vis-vera.
    ·
  • crgwbrcrgwbr Posts: 614
    edited 2006-10-05 14:53
    Sorry, but I have never used Interrupts before. I'm assuming you write a block of code, with Interrupt 100 in it, then write the rest of the code after that. And it automaticly goes to the interruppt every 100 mS, nomatter where it is in the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • BeanBean Posts: 8,129
    edited 2006-10-05 15:00
    Basically yes, except it will run every 10mSec (100 times per second).
    You must put the interrupt routine BEFORE any SUBs or code.
    Then use:

    INTERRUPT 100
    ' Run this code 100 times per second (every 10mSec)
    RETURNINT

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    Don't mistake experience for intelligence. And vis-vera.
    ·
  • crgwbrcrgwbr Posts: 614
    edited 2006-10-05 15:02
    Thank You. I think I have it now.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • wbahnwbahn Posts: 13
    edited 2006-10-05 17:44
    Is this incremental encoder just an optical sensor and a disk? Or does it have some smarts (some kind of logic) that is producing the pulses. If the former, then you have to be concerned with transition bounce. This is when the output bounces up and down a few times as the disk transitions from a shaded region to a clear region (or vice versa). If you sample fast enough, you can catch these bounces and interpret them as the disk moving faster than it really is. Most basic encoders have two outputs that change in quadrature to permit you to detect and compensate for this. This also lets you detect what direction the disk is turning in. Incremental encoded intended purely for speed measurement on systems that don't change speed very much often only have a single output.
  • wbahnwbahn Posts: 13
    edited 2006-10-05 17:48
    I finally got my browser to follow your link and the one you pointed to has quadrature outputs. I noticed that there is also a model that has line driver outputs, which would eliminate the need for pull-up circuitry. You might consider that one.
  • crgwbrcrgwbr Posts: 614
    edited 2006-10-05 18:25
    I did think about the line driver version, but I was unable to figure out what a line driver was. The NPN open collecter sounded simpler, so I ordered it already. The pull-up circuitry isn't a big deal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • James NewtonJames Newton Posts: 329
    edited 2006-10-06 17:42
    Bean (Hitt Consulting) said...
    Basically yes, except it will run every 10mSec (100 times per second).
    You must put the interrupt routine BEFORE any SUBs or code.
    Then use:

    INTERRUPT 100
    ' Run this code 100 times per second (every 10mSec)
    RETURNINT

    Bean.

    I just have to say: That is SUCH a COOL feature of SX/B. Doing all the ISR setup and allowing the user to just specify how often the interrupt should run. Once again: Nice job Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



Sign In or Register to comment.