Re: quadrature encoder rotation rate averaging
- From: Tim Wescott <tim@xxxxxxxxxxxxxxxx>
- Date: Mon, 12 Jun 2006 21:57:09 -0700
Jamie Morken wrote:
Hi,
I am using this quadrature encoder:
"http://www.usdigital.com/products/e4p/"
with 300 cycles per revolution / 1200 pulses per revolution.
I have it hooked up to an AVR microcontroller (atmega168) using two
external interrupt pins for the A and B channel (there is no
index channel). This is working and I have a variable that
keeps track of the encoder pulses and uses a 4state machine
to check the rotation direction, so the variable goes + for
forward rotation and - for reverse rotation.
I am now trying to get an averaged rotation rate for the last 1ms, 10ms,
100ms, 1s and 10s. I have an interrupt that runs every 1ms for this
but the code only updates the rotation rate variables once per period,
ie. once per second for the 1s variable, instead of giving a
continuously updated value from the last second.
Any ideas on how to fix this? I was thinking about using a digital
lowpass filter:
(http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html)
for each rotation rate variable but am not sure if that is the best way
to do it.
cheers,
Jamie
What is best depends entirely on just what you want to do with the information, and what your memory resources are. The IIR filters that you'll get from that page will certainly give you effective averaging at low phase delay and low memory requirements, but they won't give exact moving averages, if that's what you really need.
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Posting from Google? See http://cfaj.freeshell.org/google/
"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
.
- References:
- quadrature encoder rotation rate averaging
- From: Jamie Morken
- quadrature encoder rotation rate averaging
- Prev by Date: Re: Q of a super-inductor
- Next by Date: Re: Q of a super-inductor
- Previous by thread: quadrature encoder rotation rate averaging
- Next by thread: Re: quadrature encoder rotation rate averaging
- Index(es):
Relevant Pages
|