Working with Rotation Sensors PART II

(Click here for Part I)

 

Programming a Vehicle to Move a Certain Distance

So far you have programmed your robots to go certain distances by telling them how much time they should travel. This worked well for many problems you solved, but it has its limitations. For example, as the batteries grow weaker and the robot slows down, it’s going to go a shorter distance for the same amount of time. The same can happen as you move from hardwood or vinyl floors to carpeted floors. Using input from a rotation sensor can help you overcome some of these problems.

What you will need:

Gearbot with a rotation sensor (Ask your teacher for building instructions)

A calculator (optional)

Measuring tape or a ruler

A marker or whiteout liquid to mark a dot on a tire

2 sheets of paper (8 ˝ X 11 printer paper or any notebook paper), taped together along their short sides.

 

What to do:

You will now measure the distance GEARBOT travels first with a set of large wheels in the back and then with a pair of smaller back wheels. For each set of wheels, you will push GEARBOT twice—first until the sensor value reads 16 and then until it reads 32. You will then record your measurements in a chart on the next page.

  1. Build Gearbot with a rotation sensor attached to the back wheel that is not on the same side as the motor.
  2. Mount 2 large wheels (the largest in the kit) in the back and 2 medium-size wheels with yellow hubs in the front.
  3. Use a marker or whiteout liquid to mark a dot on the tire of the wheel connected to the rotation sensor.
  4. Place Gearbot so that the marked dot on the wheel is lined up with the short side of the paper. Make a pencil mark where the dot meets the edge of the paper.
  5. Turn on the RCX and have the View arrow pointing to the Rotation Sesnsor input port. Be sure the starting sensor value is 0. If it is not, turn off the RCX, and repeat Steps 4 and 5.
  6. With your hand, push Gearbot forward in a straight line on the paper until the sensor value reads 16. The marked dot on the tire should be in its original position, touching the paper.
  7. Using a pencil, without moving Gearbot, mark a short line where the dot on the tire meets the paper.
  8. Using a ruler and a pencil, connect the starting point at the edge of the paper with the end point. What is the length of that line? __________

 

 

Repeat these measurements and see if you get the same distance each time. Be sure to align the dot with the edge of the paper and check that the starting value is 0.

 

Now, complete the column “distance traveled” in the chart on the next page. You already have the measurement for the first trial. Get the second measurement for the

large wheel (32 sensor ticks), then move the front wheels to the back, replacing the large wheels. Use the smallest wheels in the kit for the front.

 

Be sure to draw a new line when you replace the large wheels with the smaller ones.

 

Important note: You have only one set of medium size wheels in your kit. When you replace the large wheels with the smaller ones, move the front wheels to the back and place the smallest wheels in the kit in the front.

 

Wheel

Sensor value

(Number of sensor ticks)

Number of rotations

(turning full circle)

Distance Traveled

Wheel  

Measured

 Circumference

Calculated*

16 1      
32        
Remove back wheels. Move front wheels to the back. Mount smallest wheels in front.
16        
32        

* The end of this worksheet will remind you of how to calculate the circumference of a wheel. You may choose to do it now or later, after you have finished the rest of the activity. Ask your teacher, if needed.

 

Figure out how the distance traveled is related to the wheel size (circumference).

 

Fold the sheet of paper along the line traveled by the large wheel.

Place one end of the line at the dot on the tire and wrap the line around the tire. Stop at the dot when one end of the line touches the other.

 

Think about it: What is the wheel circumference? How is it related to the length of the line traveled?

 

Look at the illustrations of a rolling wheel, page 8. Suppose the circumference of the wheel is 3”. Use the illustrations to help you think about how to figure out the number of rotations a wheel made, the number of sensor ticks, or the distance the wheel traveled.

 

 

Wheel Circumference

Distance Traveled

Number of Rotations

 

Number of Ticks

(sensor value)

3”

3”

 

 

3”

6”

 

 

3”

9”

 

 

3”

 

5

 

3”

 

 

64

3”

21”

 

 

3”

45”

 

 

Find a way to explain to someone how to figure out the number of sensor ticks to enter in a program if you know the wheel circumference and you know the distance you want it to travel.

 

In short:

 

How to use the number of sensor ticks in a program.

 

Now that you know how to figure out the number of sensor ticks, learning how to use it in a program is very simple. If you remember how you used input from a light sensor in a program, this is about the same.

 

Here is a sample program, telling Roverbot to go forward and to stop after 160 sensor ticks.

© The LEGO Group

 

Roverbot will go forward for an unlimited amount of time. When the sensor value reads 161 it will stop, because it is its first reading that is greater than 160.

 

What is the distance Roverbot would travel if its wheel circumference is 6”? _____________

 

Circumference = 3”

Distance Traveled = 3”

What’s the number of rotations? _____

How many sensor ticks would that be? ________

 

 

Circumference = 3”

Distance Traveled = 6”

What’s the number of rotations? _____

How many sensor ticks would that be? ________

 

Circumference = 3”

Distance Traveled = 9”

What’s the number of rotations? _____

How many sensor ticks would that be? ________

 

 

How to calculate the circumference of a wheel.

 

In the previous problem you measured the circumference of your robot’s wheels. There is also a way to calculate the circumference of a wheel (or a circle), which you may have learned in geometry classes.

 

For every circle, the circumference is 3.14 times bigger than its diameter. This number is called Pi, and its common symbol is .

 

To calculate the circumference of a wheel, you will have to accurately measure the diameter first. Once you know the diameter, multiply it by 3.14 to get the circumference.

____________ x 3.14 =

Diameter

___________

Circumference

____________ x 3.14 =

Diameter

___________

Circumference

Write the circumferences you calculated here in the chart “calculated” column in the chart on page 5. Are they the same as the circumferences you measured? If they are different, what do you think could be the reason?