Author Topic: Bourns incremental encoders not really quadrature  (Read 2354 times)

0 Members and 1 Guest are viewing this topic.

Offline DaveTopic starter

  • Super Contributor
  • ***
  • Posts: 1355
  • Country: si
  • I like to measure things.
Bourns incremental encoders not really quadrature
« on: May 28, 2016, 03:24:16 am »
Here I am, programming a microcontroller to read an incremental encoder for a circuit that I'm working on and wondering, why the state machine, that I coded for the encoder, isn't working as it should.

I coded the state machine to follow along as the signals A and B go high or low and added in a safety that throws an error if the state machine tries to skip a step in the quadrature. I flashed the code into the chip, expecting it to work as planned, but to my demise, it seemed to throw an error every time I turned the knob.

So I went ahead and looked at A and B signals on the encoder. Here's the interesting part:
As I ever so slowly turned the axle clockwise, both A and B were pulled to ground in the exact same moment and only jumped up one after the other.

So instead of this (taken from the datasheet),


what I really have is this.


Now I know that it still outputs a signal which can be used for detecting rotation and direction, but this isn't the point. The datasheet says the signal is quadrature, but there are only three different states which can be found on the output.
Just to make sure that I'm not crazy (and because I happened to have a spare), I decided to check the other one as well. Same story.
Does anyone have an idea what might be going on? I bought these encoders directly from Mouser, so I don't think they are counterfeits (they look and feel pretty solid).

The exact part number is PEC16-4120F-N0012.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Bourns incremental encoders not really quadrature
« Reply #1 on: May 28, 2016, 03:50:30 am »
I think you've got your wiring wrong. If you have the wrong pin on your encoder wired as the "common" pin, it'll end up outputting A and (AB), not A and B. Which is consistent with what you're seeing.
 
The following users thanked this post: Dave, MarcosL

Offline DaveTopic starter

  • Super Contributor
  • ***
  • Posts: 1355
  • Country: si
  • I like to measure things.
Re: Bourns incremental encoders not really quadrature
« Reply #2 on: May 28, 2016, 04:04:05 am »
I think you've got your wiring wrong. If you have the wrong pin on your encoder wired as the "common" pin, it'll end up outputting A and (AB), not A and B. Which is consistent with what you're seeing.
I'm an idiot. :palm:

But you can see how this confused me.


Welp, time to pull out a knife and make my PCB look like shit. :-\

There, mystery solved. Nothing to see here.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22433
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Bourns incremental encoders not really quadrature
« Reply #3 on: May 28, 2016, 08:19:17 am »
1. Because
3. Sense.
2. this makes

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: Per Hansson

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 17203
  • Country: 00
Re: Bourns incremental encoders not really quadrature
« Reply #4 on: May 28, 2016, 10:41:17 am »
So I went ahead and looked at A and B signals on the encoder. Here's the interesting part:
As I ever so slowly turned the axle clockwise, both A and B were pulled to ground in the exact same moment and only jumped up one after the other.

Not possible. Nothing would work with them.

Check results again.

I'm an idiot. :palm:

We've all been there!  :-DD

Difference: Idiots don't learn from mistakes.

mystery solved. Nothing to see here.

 :)
« Last Edit: May 28, 2016, 10:43:44 am by Fungus »
 

Offline Refrigerator

  • Super Contributor
  • ***
  • Posts: 1578
  • Country: lt
Re: Bourns incremental encoders not really quadrature
« Reply #5 on: May 28, 2016, 10:47:22 am »
1. Because
3. Sense.
2. this makes

Tim
I guess they hired Yoda to make that PDF.
I have a blog at http://brimmingideas.blogspot.com/ . Now less empty than ever before !
An expert of making MOSFETs explode.
 

Offline DaveTopic starter

  • Super Contributor
  • ***
  • Posts: 1355
  • Country: si
  • I like to measure things.
Re: Bourns incremental encoders not really quadrature
« Reply #6 on: May 28, 2016, 02:38:54 pm »
I feel like I owe you guys some post-bodge pics.

She does work as expected now. The state machine works like clockwork. :-+
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf