Shop OBEX P1 Docs P2 Docs Learn Events
Looking for someone to develop a quadrature encoder counter module — Parallax Forums

Looking for someone to develop a quadrature encoder counter module

fma38fma38 Posts: 42
edited 2007-10-24 17:45 in General Discussion
As it is very difficult to read quadrature encoders with a Basic Stamp, I'm looking for a dedicated module, like those existing for driving DC or stepper motors. But it does not seem to exist. There are some specialized IC, like the LS7366, but they seem to be very hard to found and buy (at least from France), and they take a lot of place on a board, especially when you need 2!

So, I was wondering if someone could develop such module, able to read 2 encoders providing signals up to 5kHz, store their position in a 24bits counter, and communicating through a simple serial interface? I think that it could be made from a PIC 12C508 or so...

If someone is volonteer, please let me know.

Thanks,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr

Comments

  • bennettdanbennettdan Posts: 614
    edited 2007-06-06 22:07
    Frederic,
    IN the SX/B examples their is a Quadrature encoder reader project that displays the value to a 7 segment display this example could be modified to do what you want.
  • metron9metron9 Posts: 1,100
    edited 2007-06-07 04:27
    Could you tell me exactly what the signal is or post the output from a scope the signal the encoder sends. This sounds like a simple project for a teeny tiny tiny13.

    Is it like this? http://zone.ni.com/devzone/cda/tut/p/id/4763

    Tiny11 will work as well for one if it is like the one in the link above. If you have a sync signal as well we can add that.
    Of course output is necessary as well. Do you want shiftin and shiftout commands, that would be best.
    Also I would add a zero feature to zero the counter. You would use one chip per encoder. This should work up to 100Khz I think.

    Code so far will keep a 16 bit value updated forwards and backwards. It will roll over at 0000 to FFFF or FFFF to 0000.

    .include "tn11def.inc"
    
    ; 3.17mA active 
    ; 1MHZ internal oscillator
    
    ; 8 pin DIP
    ; Pin 6 input A PINB1 INT0 INterrupts on any change
    ; Pin 5 input B PINB0 
    
    .def     temp        =    r16
    .def    encL        =    r17
    .def    encH        =    r18
    .def    tempsreg    =    r19
    
    rjmp    RESET        ; Reset handler
    rjmp    EXT_INT0    ; IRQ0 handler
    rjmp    PIN_CHANGE    ; Pin change handler
    rjmp    TIM0_OVF    ; Timer0 overflow handler
    rjmp    ANA_COMP    ; Analog Comparator handler
    
    
    RESET:
    
    ldi temp,(1<<INT0) 
    out GIMSK,temp
    ldi temp,(0<<ISC01)|(1<<ISC00) ;Any change on INT0
    out MCUCR,temp
    
    ldi temp,(1<<ACD)    ;Disable Analog Comparator (to save power)
    out ACSR,temp
    
    SEI 
    MAIN:
    rjmp main
    
    
    EXT_INT0:    ; IRQ0 handler 
    in tempsreg,sreg
    sbis portb,0 ;skip next instruction IF B channel is high
    rjmp Forward
    rjmp Backward
    
    forward:
    inc encL
    brne exitint
    inc encH
    rjmp exitint
    
    Backward:
    cpi encL,0
    brne skipH
    dec encH
    skipH:
    dec encL
    exitint:
    out sreg,tempsreg
    RETI
    
    
    PIN_CHANGE:    ;Pin change handler
    RETI
    TIM0_OVF:    ; Timer0 overflow handler
    reti
    ANA_COMP:    ; Analog Comparator handler
    RETI
    
    
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!

    Post Edited (metron9) : 6/7/2007 5:49:11 AM GMT
  • fma38fma38 Posts: 42
    edited 2007-06-07 05:57
    @bennettdan: I don't know very much µ-controlers; I chose the BS2 because it is simple to use, and I don't need to learn too much low levels things (serial programing, for example)...

    @metron9: yes, the signals are like the ones described in your link. If you can help me on this project, please contact me in private; I will give you more informations, and explain what it is for.

    Thanks,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Frédéric
  • jeffjohnvoljeffjohnvol Posts: 197
    edited 2007-06-07 13:41
    I'm not sure what your application is, but have you considered an absolute encoder? It would require an ADC, but if you use the PLC module from Parallax it has an ADC built in that can read up to 4 analog inputs, and they give sample code to read it, and believe me, its very simple to use. I used the BS2 because its simple to use as well and was amazed how easy it is to read this encoder. You plug your BS2 into the PLC module, and its nice because it has terminals you can add your wires to with a straightslot screwedriver.

    The nice thing about this encoder is if your stamp is delayed in processing for a bit, you don't have to worry about missing a "tick" from the quadrature encoder. You just re-read the voltage and you know where it is.

    Good luck.
    Jeff
  • fma38fma38 Posts: 42
    edited 2007-06-07 14:08
    Unfortunally, I'm building a new hardware to drive an already existing mecanic stuff, so I have to use the quadrature encoders.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • cnc002cnc002 Posts: 2
    edited 2007-10-24 16:35
    The problem I have discovered when trying to directly read a quadrature encoder with a basic stamp is that it can't keep up with the counts if you go over about 100Hz. Above that the Stamp is not reliable. However, there are some dedicated quadrature reader chips out there, one of which is an LS7366 by LSI/CSI (probably actually made by someone else). Also, there is a short lab example that lists code and also has a schematic with it. You can find the PDF file at this link: http://robotics.me.jhu.edu/~llw/courses/me530420/lab/lab_LS7366R_27.pdf

    I hope this helps
    Randy A.
  • fma38fma38 Posts: 42
    edited 2007-10-24 16:48
    Yes, I know the LS7336 (great product), but it is hard to find in small quantities...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-10-24 17:21
    In another thread, I posted a MoboStamp-pe coprocessor app that does just what you want. The first post in the thread includes a zip with the AVR object code and the documentation. Using the Mobo will make life easiest, but you can also use the hex file to program an ATTiny13 DIP chip to use standalone.

    To date, this code will support one encoder. You would need two AVRs to deal with two encoders. Future versions could well support two encoders in one chip.

    -Phil
  • fma38fma38 Posts: 42
    edited 2007-10-24 17:45
    Great [noparse]:)[/noparse] That's exactly this way I like to use µ-controllers! I can keep focusing on high level tasks, with the BS2.

    Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Frédéric
Sign In or Register to comment.