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
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