Quadrature encoder troubleshooting

27 views
Skip to first unread message

Dylan

unread,
Sep 6, 2016, 9:12:03 AM9/6/16
to Connected Community HackerSpace

Hi All


I was wondering if anyone has much experience troubleshooting quadrature encoders? I've been trying to get a few I got from china up and running and i'm getting some funny behavior out of them. I've posted a detailed explaination here


http://forum.arduino.cc/index.php?topic=422507.0


I thought i would post this here as i'm from melbourne and i have a feeling my current project is right up the ally of the CCHS.


Please let me know if this isn't the place for these type of posts.


Thanks

tubular

unread,
Sep 6, 2016, 7:38:08 PM9/6/16
to Connected Community HackerSpace
Hi Dylan

I've seen an expensive industrial encoder go faulty before and it's a bit of a pain to diagnose.   In that case it was missing some edge transitions, though not all, causing some down but most up counts, yielding a faulty total count for a full revolution.  

Have you tried a second encoder to see if its code or hardware?   Even if its one of those cheap little 16ppr switch encoders?   Perhaps try some small caps across the switch outputs to limit bounce? 

regards
Lachlan 

Zac Faragher

unread,
Sep 7, 2016, 1:05:32 AM9/7/16
to connected-commu...@googlegroups.com
You could use LEDs to show the state of the encoder channels if you're really worried about the Serial lib screwing with your interrupts.
Either way, you might consider disabling interrupts inside the interrupt handler, and enabling them just before leaving the handler, but for such a short handler subroutine it probably won't have much effect.

-Zac F

--
You received this message because you are subscribed to the Google Groups "Connected Community HackerSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connected-community-hackerspace+unsu...@googlegroups.com.
To post to this group, send email to connected-community-hackerspace...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/connected-community-hackerspace/be0cde17-5793-4737-99d2-133316098d67%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Dylan

unread,
Sep 7, 2016, 6:37:38 AM9/7/16
to Connected Community HackerSpace
Thanks for the reply Tubular

as you said i tried another encoder and it seems to be behaving as expected.  Using a stepper motor and a timing belt i moved forward and back a number of times and the encoder pulses are consistently between 8-25 counts out, given i'm using both channels on a 600p/r encoder and the interrupts are being triggered on changes that will mean 2*600*2=2400 pulses per revolution.  So 25 pulses would be about 4 degrees or so, which could plausibly be caused by backlash, belt stretching and inaccuracy in the stepper.  When i get some more time i will try turning the interupts off in the interrupt handler as Zac suggested, but for now i should have enough to keep moving forward with the project.  

Just for my own knowledge
i'm pretty sure this is a optical encoder while those cheap 16ppr encoders have mechanical switches? in which case there shouldn't be an switch bouncing on mine?  is that right?

Clifford Heath

unread,
Sep 7, 2016, 6:59:54 AM9/7/16
to connected-commu...@googlegroups.com
> i'm pretty sure this is a optical encoder while those cheap 16ppr encoders have mechanical switches? in which case there shouldn't be an switch bouncing on mine? is that right?

Quadrature is used precisely because it avoids problems with switch bouncing.
As long as B stops bouncing before A toggles, its all good... as long as you
don't miss transitions. You need to read A when B changes, and B when A
changes...
Reply all
Reply to author
Forward
0 new messages