Author Topic: Measuring Distance with MC50-110 controller and quad encoder  (Read 3848 times)

Offline TheTurfDude

  • PLUS+1 Developer
  • ***
  • Posts: 37
  • Karma: +0/-0
    • Trebro Turf Equipment
Measuring Distance with MC50-110 controller and quad encoder
« on: October 14, 2015, 10:47:27 PM »
Hello everyone/anyone,

I have been trying to measure distance using a quadrature encoder using quadcount on pin 18 of an MC50-110 controller (using the LG template). I am counting up until a target is reached then resetting the count and continuing the process. While bench testing it works quite well, however, I am spinning the encoder shaft by hand. My count reaches it's target, fires my output and resets the count.

The field test did not go as well, my results varied anywhere from an inch to an inch and a half  :o

I logged everything with the service tool(loop time, count, pin 18 freq, target, and my output) and created a graph with excel after exporting to a .csv file. the first thing I noticed was my count was resetting before it reached it's target (sometimes 5 counts before and other times 7-10 counts) my loop time was consistent throughout (2ms) my output was firing consistently and the freq was a bit jagged (27-35).

I have spoken with Plus+1 helpdesk and have tried what they recommended but was hoping someone else has a better way of measuring distance. Maybe an alternative to a quad encoder? I just can't imagine that it could vary that much, my code is not complex and my loop time is exceptionally fast.

Any suggestions are welcome  :D

Thanks

Offline jashom1

  • PLUS+1 Expert
  • ****
  • Posts: 78
  • Karma: +6/-0
Re: Measuring Distance with MC50-110 controller and quad encoder
« Reply #1 on: October 26, 2015, 04:36:54 AM »
Hi,

I know I have had issues in the past on an MC050-010 with quadrature inputs where it would not register the count properly when the voltage dropped below 24V.  Anything over 24V it worked fine.  What is the sensor supply like? My PinConfig0 is 2 and PinConfig1 is 2, (Depends on the encoder/sensor signal type)  DigInConifgHigh is the default 3000, and DigInConfigLow is also default 2000. 

Obviously you have set FreqConfig to 1?

All else fails do you need to know direction? Is that why you are using quadrature input? If not, then just use one of the signals and turn off the quadrature mode and use the count signal.

Good luck.

John.

Offline TheTurfDude

  • PLUS+1 Developer
  • ***
  • Posts: 37
  • Karma: +0/-0
    • Trebro Turf Equipment
Re: Measuring Distance with MC50-110 controller and quad encoder
« Reply #2 on: October 27, 2015, 05:31:13 PM »
John,

Thank you for the response. We are running a 12v system, I had not considered that voltage could be the issue. I do need to know direction so the quadrature encoder is a must. I played around with the count signal and was pretty bummed when I realized it counted in both directions.

I am interested to see what 24v+ will do for me, thank you again for the tip!

Jake

Offline jashom1

  • PLUS+1 Expert
  • ****
  • Posts: 78
  • Karma: +6/-0
Re: Measuring Distance with MC50-110 controller and quad encoder
« Reply #3 on: November 23, 2015, 03:02:11 AM »
Hi Jake,

I checked my code and found that I had forgotten that I put a check in the software to not count if the voltage dropped below 24V, so I might have given you the wrong idea!

My apologies!

John.