Activity #33: Motor Control

Exploring Robotics with the ARX ASURO

 Introduction

How can we control the movement of the robot?

What good is a robot with wheels if we can’t drive it around? We can use programs to control the motors which turn the wheels and make the robot move.

In this activity we will learn how to control the motors on the robot.

 BACKGROUND

How do we control each of the motors on the robot?

We have a left and right motor control circuit that we assembled and installed onto the PCB.  We saw on the schematic diagram that each circuit was connected to several pins on the microcontroller. You may recall that there is a clever device called an H bridge used with AND gates to provide a stronger signal to generate power to turn the motors. 

Lucky for us someone else wrote the C code that interacts with the pins and the AND gate, and they developed functions that we can just call when we want to turn the motors on and off.  Those functions are in a file called asuro.h that we include with our program.

In this lesson we learn how to use those functions to turn on and off the motors, and control their speed. With these functions we can make the robot move forward and reverse and also turn left and right, and stop.

 objectives / outcomes

By the end of this activity (and the other programming activities) you will be able to:

  1. Demonstrate ability to increment and decrement variable values
  2. Demonstrate ability to define constants
  3. Demonstrate understanding of datatypes
  4. Demonstrate ability to assign values to variables
  5. Demonstrate ability to create loops using for and while statements
  6. Demonstrate understanding of logic functions for AND, OR, and Exclusive-OR
  7. Demonstrate ability to use conditional statements and operators
  8. Demonstrate ability to use switch statements to compare multiple values
  9. Demonstrate ability to create functions and call them
  10. Demonstrate ability to use these ASURO functions: MotorDir(), MotorSpeed(), Sleep(), SerWrite(), and SerRead()

 Activity / Process

Complete these steps.

  1. Open worksheet and review:  Activity 33 Worksheet
  2. Read section: 33 Driving Motor Control  in book
  3. Review the other resources linked below.
  4. View activity video:
  5. Complete activities in the worksheet
  6. Complete Assessments

 OTHER Resources

Links to additional materials:

Main Menu