Velocity measurement

Hi All,

I am trying to measure angular velocity in my mobile robot. Currently I use a quadrature encoder. I want to improve the accuracy using "Velocity mode" quadrature, which measures the time between transition events such as channel A rising edges. But I am not sure all the quadrature decoder has this "capture" capability. So far I found that only PIC 18F2331 series have such capability. If I were to use PIC for measuring the velocity, pic can output PWM (10 bits) as measured velocity to a linux computer. Is this a good way for doing it? My linux computer has a Sensoray 526 board which has

4 channel quadrature input, (it can also be used for PWM output), analog in/analog out.

Any suggestions are welcome.

Everett

Reply to
Everett X. Wang
Loading thread data ...

On Thu, 27 Dec 2007 03:56:46 +0800, I said, "Pick a card, any card" and "Everett X. Wang" instead replied:

A three axis accelerometer would work great. Two are all that are needed as long as there is no incline involved. Use that third axis to monitor gravity. Anything that departs from normal will indicate an incline and require some simple geometry to correct. Add and subtract derived velocity vectors from the three accelerometers and you're home free.

See eBay item 230205768086 for a reasonable device. About $20.00.

formatting link
or
formatting link

Both of the above are the same link.

-- Ray

Reply to
Ray Haddad

If you are not concerned with direction reversal when attempting to measure rotation speed, many micros have timers that can be used to measure time between edges.

Usually not. PWM output is normally filtered and then used as an analog voltage. I recommend some standard binary encoding and transfer.

So, do you want to bypass the micro and go straight into the Linux box?

--
Thad
Reply to
Thad Smith

Hi Thad,

Thanks for the information. Yes, I want bybass the micro and go straight into the Linux box. But I am not sure the Sensoray 526 has the capture function.

This is from the company website: "Encoder Counters The four quadrature encoder inputs and index inputs may be differential (RS-422) or single-ended TTL. Counting resolution can be increased by selecting x2 or x4 counting modes. Each counter may be programmed to cause an interrupt when it overflows. The current value of a counter may be read without affecting the counting process.

Counters may be configured as timers by counting pulses from an internal clock of 27 or 13.5 MHz. Timers can generate a single-shot pulse or a pulse width modulated waveform at one of the digital outputs."

They also have a more detailed manual here:

formatting link

Page 8 has some descriptions on the "captured Events" Can this be used for measuring the time between quadrature pulse edges?

Have a merry Xmas and happy new year,

Everett

Reply to
Everett X. Wang

Our bots use an AnalogDevices rate gyro IC to measure angular velocity. Why not use one?

Reply to
sdeyoreo

You can take the encoder out and divide one of the outputs by an even number to give a square wave (using the counter). Use that output to gate a timer using the 27 MHz internal source. When the square wave out is low (timer disabled) reset the timer, wait for the square wave to go high, then low, then read the timer, giving the duration of the high period. The choice of divisor determines the trade-off between update rate and resolution.

--
Thad
Reply to
Thad Smith

??????: snipped-for-privacy@4ax.com...

We am trying to measure a wheel rotational angular velocity. We also have an IMU to measure lean angle.

Reply to
Everett X. Wang

Hi Thad,

Thanks for your suggestions. Let me try to understand it. Is the quadrature encoder output already a square wave? It seems to me that both A and B channels produce square wave when the encoder shaft is rotating. So can I skip the dividing step? Suppose I take channel A and connect it to a counter, which is configured as a timer with 27 Mhz internel source then use your suggestion to measure the high time of the square wave? Without the divider, I can pick the number of the pulses per rotation from encoder to determine the trade-off of update rate and resolution?

Everett

Reply to
Everett X. Wang

Please do not quote tag lines.

It depends on the encoder, I suspect. Although the output is nominally square, it might be, say, 40% high and 60% low if it is read directly from the encoder stripes. Dividing by an even number eliminates the bias, although it won't remove edge jitter. Dividing will reduce the effect of the jitter, though.

Part of the suggestion was to use the divided encoder signal to gate the timer to give accurate start and stop signals for the timer. If you use software, you will get lower resolution and possibly be subject to jitter from interrupts. I made the suggestion of dividing down the counter pulses, partly based on what it looked like your board would do (with a quick glance).

--
Thad
Reply to
Thad Smith

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.