Friday, May 14, 2010

It might actually work

A hacked up old mechanical mouse, two Lego pieces, a bit of hot glue, a piece of double sided tape and there you have it - a functional Coasterbot wheel encoder.

Finished encoder (left), parts required (center)

Or at least it looks like it might be functional - the Lego pieces will make it easy to build into the Coasterbot drivertrain, and the Arduino gets counts from the encoder. There are still a few things to test, including  but not limited to:

  • Are the encoder counts valid? The sensor and the encoder wheel have to be lined up pretty accurately in the plane of the encoder wheel (although there can be some play along the shaft axis). Also, the encoder wheel shaft and the Lego axle have to line up accurately, otherwise there will be too much runout in the encoder wheel to ever get the sensor in the right position. If this isn't right, I'll get counts for part of the revolution of the encoder wheel but not all of it - worthless.
  • How many counts are there per revolution? Looks like around 130, but I have to actually count the slots to get this number precisely.
  • Can the encoder keep up? I have no idea how fast the chip in the mouse runs, so I might end up with an encoder that works great, but only for low rotation rates. It would be possible to gear down the shaft driving the encoder to slow the rotation to a readable rate, or use an encoder with fewer slots, but then positioning accuracy suffers. 130 counts/rotation is 2.7 degrees per count. Gearing the read shaft down increases the degrees/count on the rotation I want to measure. Maybe OK for speed control, but not great for measuring distance to determine a position. And putting another Lego gear in the system adds more lash, reducing the accuracy even more. It might end up being a lot of work to get an answer that is less accurate than making an estimate from a pwm value/battery level/motor speed lookup table.
  • Is this robust enough to handle being in the Coasterbot? The sensor isn't worth much if it works great for 2 minutes then falls apart. If it looks promising but not strong enough, I'll have to figure out a better way to mount the encoder wheel and sensor. Maybe drilling a hole in the encoder wheel and mounting it on the axle, then building a housing for the sensor and LED so the final product would look something like an RCX rotation sensor.


If all the above works, then I can start work on the motor control Arduino code to implement PID, using one of the Arduino PID libraries (or writing it myself to learn what's involved).

Side note - the MAKE Coasterbot Build winners are announced today! It will be interesting to see who wins. The BDR Coasterbot should be a contender - it's strong on function, expandability, and documentation; but weak in creative use of the coasters, overall aesthetics, and maybe the design is too simplistic. It's more of a engineering exercise than an art project - I just wanted something that met the goals of the contest, and go me moving on building an expandable Arduino controlled robot. Anyway, we'll see what the results are soon.

Brian
The Black Dog

No comments:

Post a Comment