Quadrature Wheel Encoders

217 views
Skip to first unread message

John Leichty

unread,
Dec 3, 2013, 3:49:09 AM12/3/13
to diyr...@googlegroups.com
There's been some talk in various topics about encoders and that motivated me to write up the encoders I did for my Traxxas Rustler earlier this year to share with y'all. The hardware works pretty well but I've not yet done anything fancy with them in software.


Jon Russell

unread,
Dec 3, 2013, 11:43:05 AM12/3/13
to diyr...@googlegroups.com
Cool. 

Out of interest; why do you need all 4 wheels ? surely you cant trust the rear powered wheels as they will slip ? or do you compare the powered and non-powered wheels to feedback to the controller to stop wheel spin ?
Also, to simplify it, you don't need two offset black and white strips ? Don't you just need one single black and white strip, but with the two sensors offset slightly ?
It looks a bit susceptible to dirt and water though ;-)
Great stuff though. lovely engineering ...

Regards,

Jon.

Jon Watte

unread,
Dec 3, 2013, 11:43:36 AM12/3/13
to diyrovers
That's super delicious!

Looks like you've tried it on some dirty ground, too :-)

Sincerely,

jw





Sincerely,

Jon Watte


--
"I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all."
~ Adopted by U.S. Congress, June 22, 1942


--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/1f3a70ce-dfe7-40c7-88ee-49709600079b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ted Meyers

unread,
Dec 3, 2013, 11:54:45 AM12/3/13
to diyr...@googlegroups.com
That looks great! Is that a 4WD vehicle?  I suspect that you will have some issues with sunlight. The other problem that I've found with that type of wheel is that they are fat (wheel base changes) and they are squishy (wheel diameter changes).  Hard skinny tires work much better.

Ted

Minuteman

unread,
Dec 3, 2013, 12:41:24 PM12/3/13
to diyr...@googlegroups.com
Whoa, that looks sweet! I'm wondering, though, why bother with quadrature? I guess on a real "robot" they would be helpful, but if you're having to back-up on the AVC course, something is very wrong. Although it would be cool to see a robot get stuck, then intelligently get unstuck and resume the course. You'd get serious kudos for that!

Michael Shimniok

unread,
Dec 3, 2013, 12:54:20 PM12/3/13
to diyr...@googlegroups.com
Wow, very nicely executed! I love the boards you did. There are definite
advantages to having the pattern on the wheel rim instead of on a disc
like I did.

FWIW, my encoders are mounted on foam core discs, also located inside
the wheels, and I never noticed any sunlight problems manifesting in any
of the encoder speed plots I did on many, many runs over the last three
years. I noticed malfunctions right away, though, so I doubt I'd miss
interference. It might be helpful that I have an RC bus body blocking
sunlight? Or maybe the shade offered by the wheel itself is sufficient?

I wrote a desktop program, Wheel Encoder Generator, to generate the
discs, but it doesn't generate strips :) Maybe in a future revision :)
It should turn up in Google searches. I can post the link, otherwise.

Regarding wheel diameter changes, I found a youtube video suggesting RC
tires start to expand significantly above 25-30mph. I've observed
similar results.

I learned a little trick from the high speed RC crowd. Belted tires. You
mount RC tires yourself, but first put Gorilla tape (like Duct Tape on
steroids) around the inside of the tire to prevent expansion.

I observed a significant reduction in expansion above 30mph between the
belted and unbelted tires (both running on the vehicle at the same
time). I don't have hard data, only visual observation.

That said, increases in speed offer diminishing returns in the current
AVC. Since consistency is heavily weighted, it'd be far better to go
slow and perfectly consistent than fast. I doubt there's much reason to
hit 30mph in the current competition. Even 20 is questionable. At least,
that's my analysis.

Ted, When you say wheelbase changes, do you mean track width or am I
missing something obvious again? :)

Michael
> --
> You received this message because you are subscribed to the Google
> Groups "diyrovers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to diyrovers+...@googlegroups.com.
> To post to this group, send email to diyr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/diyrovers/c9f1b8e0-c23b-455c-93f0-616b06a8a889%40googlegroups.com.

Michael Shimniok

unread,
Dec 3, 2013, 1:06:02 PM12/3/13
to diyr...@googlegroups.com
On 12/03/2013 09:43 AM, Jon Russell wrote:
> Out of interest; why do you need all 4 wheels ?
Curious about this too.

> surely you cant trust the rear powered wheels as they will slip ? or
> do you compare the powered and non-powered wheels to feedback to the
> controller to stop wheel spin ?
I *only* ran encoders on the rear wheels. My distance estimation was
based solely on encoders, not GPS. It was accurate enough to trust. I
can't say they gave me accurate data regarding heading changes. I also
can't say if the reason was slippage or other factors. I'd love to
investigate that further.

I also know that Scott H. was able to get heading data out of his rear
drive encoders to feed into an Extended Kalman Filter and it was enough
to win the AVC multiple times.

I'd be very interested to compare front and rear wheel data to determine
if there's slippage on the rear wheels. I've been thinking about doing
front wheel encoders...

These are the sorts of questions I love about diyrovers.

> Also, to simplify it, you don't need two offset black and white strips
> ? Don't you just need one single black and white strip, but with the
> two sensors offset slightly ?
Good point. Probably harder to arrange just so. This way any wheel
diameter is accommodated without modifying sensor position.

> It looks a bit susceptible to dirt and water though ;-)
Mine hasn't been affected--even by rather thick coatings of dust on the
sensors. The dust hasn't affected the discs, either. I've run mine in
the rain with no ill effects. Mud? Yeah that might fail. :)

Michael

jesse brockmann

unread,
Dec 3, 2013, 1:41:30 PM12/3/13
to diyr...@googlegroups.com
I have been working on a strip based encoder program.  It's at the following URL
It doesn't support quadrature yet, but if I could get some pictures/links of what they look like I'm sure I could add it quickly.

I would put some type of blocking disk on the inside of the outer rim to keep the light out.  Plus, if you have a full sized body on, it should keep light getting through from the inside.

As far as tires go.  I use asphalt tires (anaconda tires), not sand/mud tires.    They have much less deflection then the mud/dirt tires, less nubs to disturb results and better traction.  But the Gorilla Tape sounds like a great idea for high speeds! :)

I use a 4wd truck, so I'm not sure that having encoders on the wheels will work too well.  The outriggers look like a much better solution, but I wonder how they work at higher speeds or ramps!  :)

JesseJay



On Tue, Dec 3, 2013 at 11:54 AM, Michael Shimniok <shim...@gmail.com> wrote:
Wow, very nicely executed! I love the boards you did. There are definite advantages to having the pattern on the wheel rim instead of on a disc like I did.

FWIW, my encoders are mounted on foam core discs, also located inside the wheels, and I never noticed any sunlight problems manifesting in any of the encoder speed plots I did on many, many runs over the last three years. I noticed malfunctions right away, though, so I doubt I'd miss interference. It might be helpful that I have an RC bus body blocking sunlight?  Or maybe the shade offered by the wheel itself is sufficient?

I wrote a desktop program, Wheel Encoder Generator, to generate the discs, but it doesn't generate strips :) Maybe in a future revision :) It should turn up in Google searches. I can post the link, otherwise.

Regarding wheel diameter changes, I found a youtube video suggesting RC tires start to expand significantly above 25-30mph. I've observed similar results.

I learned a little trick from the high speed RC crowd. Belted tires. You mount RC tires yourself, but first put Gorilla tape (like Duct Tape on steroids) around the inside of the tire to prevent expansion.

I observed a significant reduction in expansion above 30mph between the belted and unbelted tires (both running on the vehicle at the same time). I don't have hard data, only visual observation.

That said, increases in speed offer diminishing returns in the current AVC. Since consistency is heavily weighted, it'd be far better to go slow and perfectly consistent than fast. I doubt there's much reason to hit 30mph in the current competition. Even 20 is questionable. At least, that's my analysis.

Ted, When you say wheelbase changes, do you mean track width or am I missing something obvious again? :)

Michael



On 12/03/2013 09:54 AM, Ted Meyers wrote:
That looks great! Is that a 4WD vehicle?  I suspect that you will have some issues with sunlight. The other problem that I've found with that type of wheel is that they are fat (wheel base changes) and they are squishy (wheel diameter changes).  Hard skinny tires work much better.

Ted

--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.

To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/c9f1b8e0-c23b-455c-93f0-616b06a8a889%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.

To post to this group, send email to diyr...@googlegroups.com.

Jon Watte

unread,
Dec 3, 2013, 1:57:26 PM12/3/13
to diyrovers
Quadrature are 90 degrees out of phase.
Assuming that your phase goes from 0.0 to 1.0, then the "A" strip should be colored where phase < 0.5, and the "B" strip should be colored where phase >= 0.25 and phase < 0.75.

Vertically, this is two full cycles of A (left) and B (right.)

Inline image 1


Sincerely,

jw





Sincerely,

Jon Watte


--
"I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all."
~ Adopted by U.S. Congress, June 22, 1942


To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.

To post to this group, send email to diyr...@googlegroups.com.
quadrature.png

Jon Russell

unread,
Dec 3, 2013, 2:20:26 PM12/3/13
to diyr...@googlegroups.com
No need for two out of phase stripes ... use a single black and white strip (generated by the website above) and bend / mount your second sensor 0.5 away from the first sensor. Same quadrature output, but a single row of stripes.

Regards,

Jon.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.

Tim Myrtle

unread,
Dec 3, 2013, 2:23:39 PM12/3/13
to diyr...@googlegroups.com

Very nice!  I love the idea of bending the sensor wires for adjustment.

I've done something similar on an E-Maxx, with a single sensor.  I'm still trying to figure out how to fit printed encoder strips, since the inside of the wheel is actually conical.   For testing I've just been drawing the dark strips by hand using a paint pen - painful!  Were you able to make one long strip work?

For now, I've running these on the rear wheels only, and have removed the rear drive shafts to make the car FWD in order to minimize slip.  On pavement, FWD seems to work fine.

-Tim


Tim Myrtle

unread,
Dec 3, 2013, 2:29:45 PM12/3/13
to diyr...@googlegroups.com


On Tuesday, December 3, 2013 10:41:30 AM UTC-8, JesseJay wrote:
I have been working on a strip based encoder program.  It's at the following URL


Sweet!  Thanks for making this available.  I'll definitely be using it. 

Ted Meyers

unread,
Dec 3, 2013, 2:36:18 PM12/3/13
to diyr...@googlegroups.com

Ted, When you say wheelbase changes, do you mean track width or am I
missing something obvious again? :)

Yeah, track width; I know this is not what is usually meant by wheelbase, but seems to be the term used in odometery literature (such as the UMBmark paper), so I use it.  In order to have good heading results I've found that you need to know the wheelbase accurately and the relative difference in the two wheel's circumference even more accurately (.1% and .01%).  The wheelbase affects how much the heading appears to changes in a turn and the circumference affects how much the heading appears to change regardless of how the bot turns.

Ted

Michael Shimniok

unread,
Dec 3, 2013, 2:57:05 PM12/3/13
to diyr...@googlegroups.com
On 12/03/2013 12:36 PM, Ted Meyers wrote:

Ted, When you say wheelbase changes, do you mean track width or am I
missing something obvious again? :)

Yeah, track width; I know this is not what is usually meant by wheelbase, but seems to be the term used in odometery literature (such as the UMBmark paper), so I use it.
Right, I guess that's why I was confused. :D  I thought I knew what you meant... but wanted to be sure.


  In order to have good heading results I've found that you need to know the wheelbase accurately and the relative difference in the two wheel's circumference even more accurately (.1% and .01%).
8-O

Well, that's good to know. Previous attempts at heading from wheel encoders have generated truly awful results. I guess I know why?

So you'd need a circumference accuracy of 0.0003" on a 3" tire?!?  My digital calipers only resolve to 5 ten-thousandths of an inch. So that won't work.

Even < 1% would be difficult to achieve on standard tire setups at competitive AVC speeds. A change in weight squishing down the tire (as you alluded to) changes the effective circumference. Any appreciable speed, say 15mph, could cause a change in circumference. Going around a corner with body lean can cause the contact patch and its location to change to the outside/inside of the tire, thus changing circumference. A change in temperature might change circumference.

How in the world is a person supposed to mitigate all that??

Michael

Ted Meyers

unread,
Dec 3, 2013, 4:34:14 PM12/3/13
to diyr...@googlegroups.com

So you'd need a circumference accuracy of 0.0003" on a 3" tire?!?  My digital calipers only resolve to 5 ten-thousandths of an inch. So that won't work.

Even < 1% would be difficult to achieve on standard tire setups at competitive AVC speeds. A change in weight squishing down the tire (as you alluded to) changes the effective circumference. Any appreciable speed, say 15mph, could cause a change in circumference. Going around a corner with body lean can cause the contact patch and its location to change to the outside/inside of the tire, thus changing circumference. A change in temperature might change circumference.

How in the world is a person supposed to mitigate all that??


Not quite that bad, it is the difference in the circumference of the two tires.  It can be measured indirectly by driving a straight line and calculating the difference between the two wheel encoder values.  But still, you really do need solid wheels and thin, solid tires.  I know that one of my current issues is the tire leaning up on the edge/rim on turns.  Wheel base can also be adjusted by driving a known course (with a turn) and calculating the difference between nominal and measured values.

But yeah, that is why heading doesn't work well unless you go to extremes.  And my goal with those error values was to get +/-2 feet on a 30 foot square course (on paved road).

Ted

Ted

Ted Meyers

unread,
Dec 3, 2013, 7:48:49 PM12/3/13
to diyr...@googlegroups.com
Been thinking about this some more and it does seem a little crazy.  So, here's how I arrived at my conclusions:

My error budget is 2 feet, I'd say that about 1 foot of that is random error (that's how I got to 2 feet).  I'm using half of that remaining foot for the wheel base and the other half for wheel circumference.

For the  wheel base, the course I'm running is about 100 feet around, so an angle error of 0.3 degrees gives a tangent of 0.5 feet over the 100 feet.  Wheel base angular error is proportional to the wheel base error, and 0.3 degrees of 360 degrees (all the way around the course) is about 1 part in 1000.

For the wheel circumference, my wheel circumference to wheel base circumference ratio is about 1:7, and there are about 100 wheel circumference units around the course.  So, if one wheel was 1% larger than the other it would make 1 more complete turn than the other (1% of 100 = 1).  This is 360 degrees / 7 (the circumference ratio) = 51 degrees.  I want to get down to about .3 degrees (as with the wheel base), so I need to divide again by 100 to get down to 0.5 degrees of error.

Real world, I recorded encoder pulses and ran them back on a simulator, for one such run a wheel base factor of 1.000 and circumference factor of 1.0000 gives an error of 2.167 feet. changing the wheel base to 1.001 (and wc=1.000) gives an error of 2.08 feet, changing to wb=1.000 and 1.0001 gives 2.03, and the min error is somewhere around wb=1.007 and wc=1.0008 with 0.87 feet of error.  This is a fairly typical result with wb=1.01+/-.005 and wc=1.001+/-.0005

Okay, so I guess you don't really need that much precision in the wheels, but it does make a difference out to that many decimal places.  Still, you really do need the wheel base to 1% and the circumference to 0.1%, and probably better if you want to use JUST wheel encoders for heading.

Ted

jesse brockmann

unread,
Dec 4, 2013, 1:20:17 AM12/4/13
to diyr...@googlegroups.com
Thanks to you Jon, and Michael I now have my encoder program generating quadrature outputs.  Enjoy.  If some one has any feedback on the program... let me know!    Set quadrature to one, and generate away.

http://www.jessejay.com/jenc.cgi

FYI, I have played a bit with metric as well, but it's not there yet.  What units should I use.. MM, CM?

JesseJay


quadrature.png

John Leichty

unread,
Dec 4, 2013, 1:48:32 AM12/4/13
to diyr...@googlegroups.com
Thanks for the feedback everybody. Regarding some of the questions and comments:

4 wheels versus 2
I don't have a terribly good reason here. The 2 front wheels are certainly sufficient and easier for odometry, and since it's a subset of 4 I have that to fall back on. I'd like to try to do some more advanced stuff though, such as detecting wheel slip and doing closed loop control around rear wheel speeds. Also want to look at the lag/windup between the motor and the wheels just for fun.

Black and white stripes
I thought about doing just one set of strips and offsetting the sensors, but decided that it was easier to print the tracks with a precise offset done on the computer, and then all the manual adjustment would be in lining up the sensors evenly as opposed to trying to bend them to a 25% pattern pitch separation.
@Tim, I was able to make one long strip work, but the inside of my wheels seemed pretty cylindrical. It's quite forgiving of cutting it long, because then you just have one sensor transition that might be slightly longer than the others at the wraparound, but there's no loss or addition of counts.
@Jesse, very cool program. I was drawing mine manually before....

Dirt and water
Yeah, this is a pretty big deficiency. I'd like to replace the stripe tracks with something other than printer paper, which might help a little with water. This got me thinking about buying some new wheels and trying to embed a sensor in the wheel, sealed or at least shielded from the outside.

Sunlight
I only did very limited testing, but I didn't see any trouble with sunlight. Because the sensors are right at the top of the wheel, they can't really ever see direct sun. It might be possible to put a little shield on the inside of the wheel to keep light out.

4WD vehicle
No, just a 2WD with rear differential.
@Jesse, I don't think having a 4WD vehicle should matter for getting good data from wheel encoders -- I don't think there should be any tangential slip on the wheels unless the differential is locked?

Wheel diameter changing at high speeds
I'd like to characterize this with GPS over long distances and adjust the wheel diameter on the fly according to the rotational rate. Or at least measure the ballooning of the tires on the bench (it's quite visible) and then do a polynomial fit, which would be better than nothing.
@Michael, it's a lot for a person to mitigate, but with the right model it might not be too bad for a robot. I speculate that Google's autonomous Priuses have some sort of model for wheel diameter using wheel speed from encoders and turn rate from gyros, etc. Just armchair roboticizing at this point....

Quadrature
For the AVC, yeah I agree that if your wheels are going backwards you are having a bad day. I'd like to do more with the platform though and I'm used to working with quadrature encoders, so I decided to go for it.

Russ Johnston

unread,
Dec 4, 2013, 12:15:33 PM12/4/13
to diyr...@googlegroups.com
I'm going to disagree with the comments about backing up. With the new format of the race I'm convinced that if you do back up and finish the race you will still have a chance to be in the running. Either way, winning is not my primary goal and if I had been able to back up and restart last year I think I would have done a lot better.

Russ

Michael Shimniok

unread,
Dec 4, 2013, 12:30:24 PM12/4/13
to diyr...@googlegroups.com
Also of note, backing up is a requirement for robomagellan so good to see quadrature solutions.

Sent from my iPhone

> On Dec 4, 2013, at 10:15 AM, Russ Johnston <rust...@gmail.com> wrote:
>
> I'm going to disagree with the comments about backing up. With the new format of the race I'm convinced that if you do back up and finish the race you will still have a chance to be in the running. Either way, winning is not my primary goal and if I had been able to back up and restart last year I think I would have done a lot better.
>
> Russ
>
> --
> You received this message because you are subscribed to the Google Groups "diyrovers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
> To post to this group, send email to diyr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/2cf0f146-9a25-4fa2-8c61-29bb7aa0a031%40googlegroups.com.

Jon Watte

unread,
Dec 4, 2013, 5:33:28 PM12/4/13
to diyrovers

Speaking of which, what are the next robomagellan events anyone in the list will attend m

Also. It seems robogames 2014 really aren't happening?

Jw

Ted Meyers

unread,
Dec 4, 2013, 9:40:36 PM12/4/13
to diyr...@googlegroups.com
Yeah, at some point I'd like to go to a robomagellan, it looks like a blast!  Some of in the Denver area might have to organize our own.
Reply all
Reply to author
Forward
0 new messages