Incremental Shaft Encorders/Potentiometers

M

Thread Starter

Matt Laughlin

I don't have much of a history in programming or in application of real sensors but I need to log the position of a disc with time so I can test a Kalman filter I am writing that will be using the data from an IMU (inertial meas. unit) and a GPS reciever that will be mounted on the disc.

This task is a part of an undergraduate thesis I am doing for a BE (Aero) but is a bit out of the scope of the main focus of the thesis, being Kalman Filtering for UAV attitude solutions.

I am not sure which sensor will be more appropriate but interpolation of data on the encoder between pulses, or on the potentiometer in the dead zone, is not a problem. What is a problem is I am not sure how to set up either unit such that data can be logged.

If I was to use an encoder, with a pulse about every 2 degrees lets say, would it be appropriate to write a short C function that logged the time whenever it recieved a pulse? (ie. the vector length of logged times can be used to calculate position based on 2 degrees per logged time and the time can be used to match data from the sensors and GPS)

If anyone could give suggestions it would be great.

Thanks, Matt.
 
R

Robert Scott

> If I was to use an encoder, with a pulse about every 2 degrees lets say, would it be appropriate to write a short C function that logged the time whenever it recieved a pulse?

Is the disc going to rotate only in one direction and never back up? Then you can count pulses. For maximum resolution, I suggest that you count every transition of the two phases (A and B). If the wheel is going slow enough, you can just poll the A and B phase signals in software. But don't rely on fast response time in Windows. It may interrupt your application long enough for you to miss some pulses. If you run the pulses into a counter then you will not have to worry about missing pulses. And if you use a real quadrature decoder board, then you can even track the position through direction reversals.

-Robert Scott
Real-Time Specialties
Embedded Systems Consulting
 
Top