Unit 6 - Shaft Encoders

Unit Objectives

This unit goes in depth into the purpose and function of the shaft encoder. In addition it introduces the concept of a while loop and how it can be used to program shaft encoders to have your robot travel a desired distance.

Unit Teacher Notes

Click here to download teacher notes for Unit 6

Lesson 6.1 (420 minutes)

This lessons provides a basic understanding of how to program a shaft encoder using while loops and booleen logic. Students also learn how to calculate tick distance based on their drivetrain geometry.


  • Describe Programming concepts and the forms of applied logic. Students will be able to
    • Describe the role of decision making in robotics
    • Describe Boolean logic, its operations and laws, as used in robotics
    • Translate data specifications into truth tables and extract logical expressions
    • Explain the three parts of a while loop
  • Be able to explain the purpose of an optical quad encoder
  • Explain how an optical quad encoder operates shaft encoders to control robot behavior.
  • Demonstrate the function of a optical encoder through various activities
  • Write code for performing actions within a code segment using while loops for as long as a given condition exists.
  • Write code using calculated distance values that evaluates sensor data to provide feedback control.

Lesson 6.2 (120 minutes)

This lessons spends some time reviewing the concepts of the shaft encoder and allowing the students to create their own quiz questions related to the lesson.


  • Identify the three primary parts of a while loop
  • Explain the purpose and function of a shaft encoder and it’s role in programming

Quiz (30-60 minutes)

Quiz on the unit


  • Check for Understanding