1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Velocity measurement

Discussion in 'Embedded' started by Everett X. Wang, Dec 26, 2007.

  1. 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 X. Wang, Dec 26, 2007
    1. Advertisements

  2. Everett X. Wang

    Ray Haddad Guest

    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.
    or http://tinyurl.com/2nj9jl

    Both of the above are the same link.
    Ray Haddad, Dec 26, 2007
    1. Advertisements

  3. Everett X. Wang

    Thad Smith Guest

    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 Smith, Dec 27, 2007
  4. 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

    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:

    http://www.sensoray.com/downloads/526 Manual.pdf

    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 X. Wang, Dec 27, 2007
  5. Everett X. Wang

    sdeyoreo Guest

    Our bots use an AnalogDevices rate gyro IC to measure angular
    velocity. Why not use one?
    sdeyoreo, Dec 27, 2007
  6. Everett X. Wang

    Thad Smith Guest

    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 Smith, Dec 27, 2007
  7. We am trying to measure a wheel rotational angular velocity. We also have an
    IMU to measure lean angle.
    Everett X. Wang, Dec 27, 2007
  8. 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

    Everett X. Wang, Dec 27, 2007
  9. Everett X. Wang

    Thad Smith Guest

    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 Smith, Dec 29, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.