decoding quadrature encoders


Closed Thread
Results 1 to 40 of 94

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    Quote Originally Posted by cbrun17 View Post
    Thank you Richard. I will test this and let you know the results.

    Also, though the encoder is optical, I am going through a 74C14 hex Schmitt trigger with rc filtering to remove any stray noise. all cabling from the encoder is shielded. Monitoring the output results in clean square wave with fast rise and fall times.

    Chris
    Out of curiosity, what R/C values did you find to be optimal on your schmitt triggers?

    Picster

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    Quote Originally Posted by picster View Post
    Out of curiosity, what R/C values did you find to be optimal on your schmitt triggers?

    Picster
    Ok, I did some trials myself and ended up with R1=100k, R2=33k, C=0.1uF working well with Schmitt trigger inputs on the PIC I'm using (see circuit attached). That's with a detented encoder, using the same values for the two rotary outputs AND the built-in pushbutton.
    Name:  schmitt.jpg
Views: 865
Size:  11.2 KB

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,129


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    I would use 10th of this values.

    Ioannis

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    Quote Originally Posted by Ioannis View Post
    I would use 10th of this values.

    Ioannis
    You certainly could. Yet this works great in my application, for which I am using switch polling, not interrupts. I would imagine it also depends on the characteristics of the encoder.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,129


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    Of course it does. But I am worried about the input impedance of the PIC and leakage currents.

    Ioannis

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    Hey Ioannis,

    I'm hoping you can shed some additional light on this for me.

    I know the "design standard" is to use a 10k pullup for PIC inputs that switch to ground - which from my understanding is really not so much about leakage, but more about noise on the "antenna" that an input wire or trace can become. The internal weak pullups tend to work on a breadboard or on a PC board, as long as the system isn't subject to much electrical noise, but "guaranteeing" that environment is far from possible in real world applications. The internal "weak pullups" have equivalent impedance ranges from 200k to 16k, per PIC specs. Meanwhile, input impedance for ports works out to around 50Mohms per specs. I agree, it is always good to have a "solid" and unquestionable pull-up instead of something where spurious glitches can put you into nebulous range, particularly with an input that's NOT configured as a schmitt trigger and you can get all kinds of undefined questionable results. Absolutely makes sense to use "tried and true" 10k in these situations.

    However, despite the above, part of the benefit of using a capacitor on the input (again, only with the schmitt trigger config) is that it will help to eliminate spurious noise, effectively shunting spikes to ground and only letting relatively persistent voltage levels through. Hence the reason, I believe, why these values may be demonstrated to work for a schmitt trigger input configuration. I picked these values around the 0.1uF capacitor since I have a ton of them.

    Does this make sense, or am I missing something else that I should be considering?

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: decoding quadrature encoders

    Quote Originally Posted by picster View Post
    Hey Ioannis,

    I'm hoping you can shed some additional light on this for me.

    I know the "design standard" is to use a 10k pullup for PIC inputs that switch to ground - which from my understanding is really not so much about leakage, but more about noise on the "antenna" that an input wire or trace can become. The internal weak pullups tend to work on a breadboard or on a PC board, as long as the system isn't subject to much electrical noise, but "guaranteeing" that environment is far from possible in real world applications. The internal "weak pullups" have equivalent impedance ranges from 200k to 16k, per PIC specs. Meanwhile, input impedance for ports works out to around 50Mohms per specs. I agree, it is always good to have a "solid" and unquestionable pull-up instead of something where spurious glitches can put you into nebulous range, particularly with an input that's NOT configured as a schmitt trigger and you can get all kinds of undefined questionable results. Absolutely makes sense to use "tried and true" 10k in these situations.

    However, despite the above, part of the benefit of using a capacitor on the input (again, only with the schmitt trigger config) is that it will help to eliminate spurious noise, effectively shunting spikes to ground and only letting relatively persistent voltage levels through. Hence the reason, I believe, why these values may be demonstrated to work for a schmitt trigger input configuration. I picked these values around the 0.1uF capacitor since I have a ton of them.

    Does this make sense, or am I missing something else that I should be considering?
    Note: 10k/3.3k/0.1uF also works with the switch I'm using, so I've changed to this configuration just to stay "standard", and I need not bother with larger caps.

Similar Threads

  1. Quick thoughts: DT Ints with encoders
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 7th January 2010, 01:01
  2. PMDC SERVO MOTOR WITH quadrature encoder DRIVE ?
    By phoenix_1 in forum Schematics
    Replies: 37
    Last Post: - 22nd November 2009, 19:45
  3. 32-bit Quadrature Counter With Serial Interface
    By precision in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th June 2008, 02:49
  4. quad encoders
    By cpayne in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th March 2007, 17:49
  5. "momentary" IR decoding
    By sporker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th June 2005, 01:53

Members who have read this thread : 4

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts