Skip to main content
sami
Associate III
January 15, 2014
Question

Incremental Encoder to STM32f407

  • January 15, 2014
  • 5 replies
  • 1972 views
Posted on January 15, 2014 at 20:51

Hi

I am trying to understand how to interface incremental encoders to stm32f407 ( 2 encoders) :

my problems :

Which pins can I connect to it; should I connect to the pins directly ?  .

How can I did  detect the direction of the encoder?

Thank you in advaned .

Esat

#qei
    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    January 15, 2014
    Posted on January 15, 2014 at 21:57

    What encoder? Provide a cite.

    Does it generate a quadrature signal?

    You'll need one timer per encoder, a 32-bit timer will give you much better range.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    sami
    samiAuthor
    Associate III
    January 16, 2014
    Posted on January 16, 2014 at 11:43

    It have only A signal and B signal :PEC11-4225F:

    I want to know if stm32 can detect the direction or do I need for external circuit .

    Thank you Clive

    jpeacock2399
    Associate III
    January 16, 2014
    Posted on January 16, 2014 at 15:53

    In the QEI interface one phase counts steps while the other phase determines up/down direction.  With a two phase encoder (and assuming 90 degree shift between encoder phases) you won;t need external circuitry to detect position.

    However, without an index you won't have any calibration information.  If you are measuring shaft angle or linear distance the QEI will only give you realtive change, not absolute position.

      Jack Peacock
    plcperovic
    Visitor II
    January 18, 2014
    Posted on January 18, 2014 at 12:12

    Dear

    Encoders are devises witch can work on very wide of voltage (5-28).

    So, according of the chosen voltage for supply of encoder you must make divvy voltage with resistors. To be sure that your program works correctly you can use third output from encoder. It's signed with mark ''Z''.

    That signal Z is going to appear only once for full rotation of encoder. For ex: If you have encoder with 500 steps, for every 500 impulses on signal A or B you will have just one impulse on signal Z.

    Be careful with speed of impulses because that will be reason for mistake in counting of impulses.

    Regards, Perovic

    francescatodiego
    Associate III
    January 18, 2014
    Posted on January 18, 2014 at 12:29

    look at

    the ICs

    of this type

    26LS33

    As mentioned by

    others

    encoder outputs

    configuration l

    ine

    drive

    -

    push pull

    -

    open collector

    ?

    encoder output voltage range  ?

    encoder maximum count freqeuncy ?

    You could also

    separate the encoder lines

    from the input micro

    with

    optocouplers but

    you have to

    take into account the

    maximum

    frequency

    ....Uhm sorry RBR (Reply Before Read...) mistake....

    The Encoder isn't an industrial rotary encoder but similar to a potentiometer easy to interface with two external interrupts

    See the waveform figure on thi sdocument

    http://www.adafruit.com/datasheets/pec11.pdf