Author Topic: QUAD COUNT ERROR  (Read 12161 times)

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 220
  • Karma: +7/-0
QUAD COUNT ERROR
« on: June 05, 2020, 12:20:46 AM »
hey Guys,

I have looked at another post talking about the quad count error, but does not may give me a clue the reason of the error I have.

Basically I am reading an encoder with a MC012-110, pin 8 is A+ and pin 9 is B+ , the encoder is 5 volts powered by the controller.  1 rev is 360 pulses.

Now when I rotate the wheel clockwise i count 360 pulses per revolution, no matter the speed, it always counts correct.

then, turning the wheel counterclockwise I always loose 2 pulses per revolution, each rev it only counts 358 pulses.


we did another test, we connected B- to pin 9 and we left A+ to pin 8.

turning the wheel clockwise it did read 358 pulses it lost 2 pulses, each revolution, it never counted 360

turning counterclockwise it reads 360 pulses always.

basically the issue was inverted... this tell us the problem may be the pulse count at the pin itself.

has anyone ran into this issue?  why does it could loose 2 pulses in one direction and none on the opposite direction?

did you find a fix for that?

thank you for any advise

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 220
  • Karma: +7/-0
Re: QUAD COUNT ERROR
« Reply #1 on: June 05, 2020, 06:46:03 PM »
Well,

I am thinking loud, when changing direction, I can see I can loose a couple of pulses, however after keep moving in the same direction it should get corrected, isnĀ“t?

now if my formware is wrong, why when I connected B- the issues get reversed and it is always present?

pin8 is where the pulses are detected, pin 9 only looks for direction. So if my firmware is wrong I should see the issue all the times, am I correct?

just thinking a little more about




Offline SJ Industries

  • PLUS+1 Expert
  • ****
  • Posts: 60
  • Karma: +2/-0
Re: QUAD COUNT ERROR
« Reply #2 on: June 05, 2020, 10:36:25 PM »
Do you have a truth table for the encoder?

I use a 2 bit rotary encoder in some of my projects in place of a potentiometer dial, if the RPM is  too slow or the pulse count is low per rpm the quadcount wont work properly.

If you are using a 4 bit encoder perhaps the lost pulses are due to the sequence output from the encoder?

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 220
  • Karma: +7/-0
Re: QUAD COUNT ERROR
« Reply #3 on: June 06, 2020, 05:16:02 PM »
Hey SJ

I have looked for the truth table but so far no luck on that.

no matter if I connect A+ and B+ or A- and B- the result is always the same 2 pulses less.

I have tried with another encoder and same results


Offline SJ Industries

  • PLUS+1 Expert
  • ****
  • Posts: 60
  • Karma: +2/-0
Re: QUAD COUNT ERROR
« Reply #4 on: June 07, 2020, 01:56:05 AM »
Can you try A+ and A-. I think because you are only using 2 outpus of a 4 output encoder you are missing pulses. If you had pins enough you could use A+ & A- on one pair and B+ & B- on another pair and that would be CW & CCW on corrosponding channels. The Danfoss control "should" indicate direction anyway but you just use the one "A" channel.


Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 220
  • Karma: +7/-0
Re: QUAD COUNT ERROR
« Reply #5 on: June 09, 2020, 02:43:25 PM »
Hey SJ,

after cheking with some other guys one recomendation was , why not you try just the pulse count alone?  I had different tasks in the controller. basically it had to remember the last count on power up, or from a display you can set a count, so all that was done on the controller.

so I tried just the count logic and it works fine it counts the same in both directions at 3000 Hz - that is what we want as max speed- .

perhaps the NV memories I had in the firmware were creating a consistent delay when going in the "negative" direction on the wheel

thanks for you feedback

Regards

Offline SJ Industries

  • PLUS+1 Expert
  • ****
  • Posts: 60
  • Karma: +2/-0
Re: QUAD COUNT ERROR
« Reply #6 on: April 16, 2023, 12:26:59 AM »
I have had a few people ask about the logic to create a quad count I have attached a picture of the page I created. I use the DigIn pins with frequency function.

It will count up and down as the direction of the coder is turned, logic further on in this program converts to percentage output.

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 220
  • Karma: +7/-0
Re: QUAD COUNT ERROR
« Reply #7 on: November 22, 2023, 12:28:28 AM »
Hi SJ

I have not noticed you replied.

So yes my logic is somewhat like your picture

turns out the coupler to the encoder had some slippery and misalignment, that was my problem, I installed a step motor to drive the encoder and get it tested but that coupling was the bad guy.

Thanks for the advise.