Page 346 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 346
Amphibionics 07 3/24/03 9:13 AM Page 325
Chapter 7 / Turtletron: Build Your Own Robotic Turtle
:1003600083120800061683160612831206178316D8
:10037000061383128614831686108312861583163D
remote-sonar.hex file
listing (continued)
:10038000861183120800061683160612831286163B PROGRAM 7.10
:10039000831686128312861483168610831286159E
:1003A000831686118312080006168316061283121E
:1003B000861683168612831286148316861083127D
:1003C0000615831606118312080001308C008D017A
:1003D000053084000130102001308C00053084008D
:1003E000023001200C08A6000D08A70026088C008A
:1003F00027088D000F308E008F01DF20A4000D082C
:0C040000A5000A30A22008006300042AB6
:02400E00F53F7C
:00000001FF
Distance Measurement
Using an Optical Shaft Encoder
A shaft encoder is a sensor that measures the position or velocity
of a shaft. Shaft encoders are generally inexpensive devices that
are most often mounted on the output shaft of a drive motor or on
the axle. The signal that is produced by this sensor can be either
a code that corresponds to a particular position of the shaft (called
absolute encoders), or it may be a pulse train. Shaft encoders that
produce a pulse train are called incremental encoders. The
encoder is typically a disk that has numerous holes or slots along
its outside edge. An infrared LED is placed on one side of the disk
and an infrared-sensitive phototransistor is positioned directly
opposite the LED. As the shaft rotates, the holes pass the light
intermittently and the state of the phototransistor output changes
from high to low or vise versa, producing a pulse train. The rate at
which the pulses are produced corresponds to the rate at which
the shaft turns. By using a microprocessor to count the pulses, the
robot can determine how far its wheels have rotated. The combi-
nation of an infrared LED emitter and a phototransistor, packaged
325