Shop OBEX P1 Docs P2 Docs Learn Events
Building tip - how to increase distance accuracy without changing code. — Parallax Forums

Building tip - how to increase distance accuracy without changing code.

AImanAIman Posts: 531
edited 2012-02-19 20:22 in Robotics
This refers specifically to the position controller kit that Parallax sells and how to increase its accuracy without new code. The link and item code are below

http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/665/Default.aspx?txtSearch=wheel+encoder

Item code 27906


In short, this is an item that by simply moving the placement from the wheel to a location on the motor shaft, before, after or even inbetween gears can give much greater accuracy then simply placing it on a wheel.

Why? Simply put if a wheel moves at 5 RPM and a motor is turning at 500 rpm, your going to get a much more accurate distance measurments from the motor shaft because its rotating a lot more.

For those who like to do math, attaching it at various locations before, between or after gears will also give much greater results.

There is one drawback - you need to figure out how to mount it.

Since you may need to make a new wheel do-hicky to mount to a different axel or shaft, here is a simple way to make a new wheel of the same size as the original. Simply use the existing wheel as a pattern and make the hole for the shaft how you need to make it. For those who don't know about making a pattern, lay the original wheel flat and trace around it so you know the exact dimensions. Be careful not to trace half a pencil width off.

If you want to increase or decrease the size of the wheel here's a trick -
Run the original wheel on its edge across an ink pad several times so that the 'sprockets' of the wheel are well inked and then simply run the wheel across a piece of paper. Measure the distance between each 'sprocket' and write it down and measure the width of each sprocket and write it down. Make a circle of the paper with the pattern on it the same size as the new wheel you want. Be careful to line up the space where the ends of the paper meet so that one 'sprocket' has correct spacing.

Trim off any excess pattern and lay the paper flat again, count off the number of 'sprockets' needed to make a bigger or smaller wheel. You can now make the new wheel.

If it is helpful, make the circle from the paper again being careful with the space at the ends of the paper.

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-02-18 20:36
    Note that with this method your code will still have to be changed. Specifically, the constants for comparison to distance will have to be made larger (in the example given, multiplied by 100). The logic is the same though.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-02-19 05:45
    Alman,

    Have you tried adding this encoder on a motor?

    Many encoder systems do what you suggest and mount the encoder on the motor shaft instead of the wheel to increase the resolution. The S2 encoders are mounted on the motor shaft.

    I ask if you done this with this encoder because I tried encreasing the resolution of the encoders in one of my projects by using more "sprockets" on the encoder disk. It worked well at low speeds but at higher speeds the encoder no longer would register the transistions.

    You'd also have to take into consideration the speed of the uC reading the encoder. You're plan should be fine for a Propeller, but a Basic Stamp would likely have trouble counting pulses if they were occuring too frequently.

    My guess is that your suggestion should work with the encoder you linked to, but I'd want to test it to make sure before finalizing a robot design.
  • AImanAIman Posts: 531
    edited 2012-02-19 19:35
    I did this to a project of mine and ran it without code changes on a Basic Stamp 2. The only difference with how this ran was the number of pulses were bigger then when mounted on a wheel - a factor that has to be dealt with to determine distance regardless of where an encoder is mounted.

    You are correct that a Propeller handles the pulses better than a BS2 and you are correct that other encoders are made to be mounted in different places. You are also correct that lower speeds handles the encoder much better.

    Yes, there are issues if you ramp up the rpm, however I have had no issues with running the code. More to point, the last time I used an encoder like this with high RPM (like a couple thousand) the wheel wobbled and for lack of a better description, the electronics looked like a Dremel running a circular saw blade had attacked it. For my high speed projects - like my project involving a R/C truck - I cannot use this type of encoder and have to use several different items to get accurate distances.
  • ercoerco Posts: 20,255
    edited 2012-02-19 20:22
    Also, the issue of pulses per second comes up using a BS2 with 2 quad encoders on a motor shaft. I've been down that road before!
Sign In or Register to comment.