Wednesday, December 28, 2011

aBot – Wheel Encoder Mystery Solved Again

Short story:

I was wrong.  The waves formed by the sets of peaks and valleys was not due to the wheel being untrue.  It appears to have been a combination of:

  1. The reflectance sensor being too far away from the encoding disk.  Needs to be 1mm to 2mm away from the encoder disk.
  2. The width of the white and black stripes on the disk being too narrow.  I believe this causes a higher low reflectance as the sensor gets reflection from a mix of white and black and not just black.

Long story:

On Thursday, December 22 my parts for the new wheel encoder came in.  Given it was 3 days to Christmas I didn’t get a chance to work on things until a couple days later.

I wired up the QRD1114 to an analog pin and collected some data.  What I found when I plotted it was a similar double wave pattern that I had seen with the QRT-1RC. 

As you can see from the graph from my post, aBot – Wheel Encoder Mystery, the highest valleys are higher than the lowest peaks.  This created a problem as there was not one voltage that could be fed into the comparator.

I spent parts of the next two days trying to figure out how to fix the problem and get a consistent set of peaks and valleys. 

As I thought my problems were caused by the wheel being untrue I experimented with other wheels.  No matter what I tried it didn’t solve the problem…

I thought maybe it was because I didn’t have the disk centered on the wheel so I adjusted the disk on the wheel.  Still no solution…

I tried placing the sensor at different distances from the wheel and double checked the datasheet.  I found as I put the sensor closer to the wheel I got a more consistent baseline for the valleys.

I found I need to put QRD1114 1mm to 2mm from the encoder disk.  Peaks are still all over the place and the voltage difference is too low…

I tried varying the speed of the motor turning the encoder disk.  The time between peaks and valleys increased as was expected.  The peaks are still inconsistent and too low…

I was running out of things to change…

On a whim I reduced the number of white and black stripes.  I dropped from 64 (32 black / 32 white) to 24 (12 black / 12 white) and was on to something…

The peaks were much more consistent peaks and much higher.

I was stumped if it could handle 24 transitions at high speed why couldn’t it handle 64 transitions at well below half the speed.  I played around with the timing a bit more before deciding that it must have to do with the size of the white and black stripes on the encoder disk.

I was using a disk that was just under 3”.  As a result on the 24 stripe disk the size of the white and black stripes was around 10mm.  On the 64 stripe disk the size of the white and black stripes was only 3mm.  My hypothesis is that with the narrower stripes the reflectance was based on a mix of white and black while with the larger stripes it wasn’t and therefore resulted in a higher peak.

To test this I created a 6” disk with 64 transitions on it and it appears to be correct.  With the larger disk the stripes end up being 6mm and the QRD1114 has a consistent baseline of valleys, consistent peaks, and a significant voltage difference between the peaks and valleys.

No comments: