PACERBOT Parts 8 – 11: Custom Optical Encoder
Measuring speed can be done in many ways. I chose to build an optical encoder, to sense the frequency of the drive shaft’s revolutions, and calculate the speed by recording the time between pings.
Initially I have debated with myself regarding what method of speed measurement I should use. Whether to use a Hall effect switch with a magnet on a wheel, an encoder, or even just to rely on the consistency of the speed controller’s output.
I finally chose to go with the encoder. It seemed as the most elegant and simple option. A wheel with a slot is placed between a light sensitive sensor and an LED. Every time the slot’s position is between the LED and the sensor, one revolution has passed from the last time the slot has been there. By recording the number of revolutions the recorded drive shaft has undergone in one second, the frequency, in Hz (in this case revolutions per second, and if multiplies by 60, RPM), can be calculated. Therefore, using the frequency, and multiplying it by the differential’s gear ratio and the wheel’s circumference, the linear velocity of the robot can be found.