Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

low-speed quadrature algorithm

Status
Not open for further replies.

mgeerts

Computer
Nov 10, 2009
34
Hello all,

I am using a quadrature sensor on a motor-driven piece of farm equipment that spins at a wide range of speeds under normal use (uses a hydraulic CVT). The quadrature signal may be in the low kHz range down to a complete stop or 0.5Hz.

At present I am using two speed algorithms. One works great and the other not so much...

High-speed algorithm: Delta-quadrature per time
The quadrature value is sampled about every 100ms and a rolling buffer of about 2.5 seconds of data is collected. The sum of the buffer is directly proportional to speed and is converted with a multiplier to the required units of measure.

Low-Speed algorithm: Delta-time per quadrature step.
An 8MHz clock counts the time between quadrature signals.
The sampled value will be either the last completed time segment or the current time count if it is greater than the last completed one.
This value is inversely proportional to speed and is converted with a multiplier to the required units of measure.
A measurement over a given threshold is indicated as zero speed.

The decision of which algorithm to used is based on the sum of the high-speed buffer. If it is great enough that we are within our resolution tolerance (+1 or -1 count in the sum is still a small enough step in the final answer to be useful) otherwise, we use the low-speed algorithm.

Okay, this has been really long-winded so far, sorry...

First and most basic question - is there simply a more standard, known, works-great algorithm for doing what I'm doing here? This would be great.

Second question - the lowspeed algorithm suffers a terrible flaw. If the engine on the machine is running but the shaft is not turning it will vibrate and cause one of the quadrature signals to oscillate and the other to stay still. The count stays the same so the sum is low and it uses the low-speed algo which sees the quadrature count changing and triggers the timer - the display shows the speed bouncing all over the place.

er... help?

THANKS!!!
Matt
 
Replies continue below

Recommended for you

So, why can't you measure both quadrature signals?

TTFN

FAQ731-376
 
I think you may have misunderstood something. I can always read the quadrature count, the problem that occurs with the low-speed algorithm is when the machine is in neutral (ie, bottom of the CVT speed range) or the transmission is disengaged. The vibration of the motor causes the count to wobble +1, -1, +1, -1 and this triggers the timer used in low-speed calculation, which then calculates to a speed that is not actually occuring (because it isn't actually going anywhere).

Is nobody aware of any standard way to measure speed via quadrature that accepts very low input speed with resistance to this sort of oscillation?
 
"cause one of the quadrature signals to oscillate and the other to stay still"

That's your posting that I "misunderstood." If one is toggling, and the other is not, then it's either broken or not moving.

TTFN

FAQ731-376
 
That is correct, the shaft is not turning, it is just vibrating so only one part of the quadrature is oscillating. The problem that this causes for the low-speed algorithm is that the counter repeatedly resets and causes a falsely-low time reading which creates a falsely-high speed reading - hense, when the machine is in neutral it is reading a bouncing speed on the screen (and in the control algo).

I have come up with a possible solution. I will post it if this works.
 
My "possible" solution has created a massive improvement in the low-speed control. I dare say it is perfect when moving very VERY slowly, but it is still jumpy (about 1/10th the magnitude and 1/10th the regularity).

I made the low-speed algorithm have two counters. One for up and one for down. The last direction that has been moved twice consecutively determines which counter to use, and the counter is not reset until there are two consecutive moves in one direction.

So as the shaft turns slowly there will be noise around the transitions, but only the counts in one direction at a time will be observed.

However, it appears that when the machine is in neutral or the transmission is disengaged the vibration of the motor seems to be able to cause the quadrature count to make two steps and there is some speed reading making it through the filter.

So I tried making it take 3 steps in a given direction before it begins to use that counter, but I did not force it to make 3 consecutive steps before resettting... this still let the noise through. I need to take care of the latter part.

I don't believe that I need any more help, I just figured I'd post this for searchability for the next guy dealing with this.

-Matt
 
Is there no "edit" function on this board?

Anyway, my second sentance reads:
I dare say it is perfect when moving very VERY slowly, but it is still jumpy (about 1/10th the magnitude and 1/10th the regularity).

but was supposed to read:
I dare say it is perfect when moving very VERY slowly, but it is still jumpy (about 1/10th the magnitude and 1/10th the regularity) when in neutral or disengaged.
 
Sadly no - there is no editing facility..

Can you get out of the box on this one? If you are in "neutral" why not just block any signal or disable the drive and continue monitoring the counts.

Keith Cress
kcress -
 
Good thought, but I need to monitor the counts in neutral because half of this machines operation is someone manually turning the shaft.

The machine is a hose reel. The operator puts the machine in neutral to pull out the hose with a tractor, then the engine is used to reel it back up again (big, long hose with a sprinkler head at the end. Speed control is to determine how deep the water is accumulated from the sprinkler.)

With the improvement that I have made the product should be acceptable (not exactly a high-precision instrument) so we're leaving it as is for now to tackle bigger issues.

Thanks for you input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor