# NXT Segway

Name of Activity

NXT Segway

Author

Jay Clark

Keywords

NXT, balance, wheels, sensors, wiring, math blocks, proportional controllers, light sensor

Subject

NXTs

9+

Time

3 Hours Total

Brief Description

Students build and program an NXT to balance on only two wheels using two light sensors.

Lesson Objectives:

Master the use of wiring and math blocks

Master Building with NXT pieces

Introduce the concept of proportional controllers

Materials Needed:

NXT kit plus one additional light sensor for each group.

Computers with LEGO Mindstorms installed.

Preparation and Set Up:

Make sure this activity is done in an evenly lit room with a consistently-colored floor. Otherwise, it will not work.

Distribute extra light sensors to each group.

Necessary Background

An NXT segway works by separating two light sensors about the center of gravity of the robot. If the robot loses its balance and starts to lean one way, one light sensor will receive more reflected light than the other. The differnce in these values can be scaled and then used to control the motors.

Generally, the following tips allow for the easiest construction of an NXT Segway:

The robot’s center of gravity should be such that the robot’s balancing point allows for the two light sensors to be evenly spaced off the ground.

The further the light sensors are from the robot, the more sensitive the response.

Weight should be added way above the pivot point (the wheels). Think about balancing a broom vs. balancing a watermelon.

Vocabulary: Proportional Controller – Control in which the amount of corrective action is proportional to the amount of error

Procedure

Introduce students to the concept of proportional control. examples:

• slowing down based on distance from stop sign
• changing dial in shower based on error from desired temperature.

Introduce proportional control in the human brain in the form of keeping balance.

• If you lean forward a little bit, your brain applies pressure to your toes to try to push your center of gravity back.
• If you move to far forward, your brain will step forward.
• If you are leaning way far forward, your brain will call for a very quick, large step.

The reaction is proportional to the error.   Introduce the segway activity. Now that we know how to balance an object that we know is leaning one way or another, we need to determine how we can figure out if the NXT is leaning. Ask students for suggestions. Encourage all ideas, but in the end, tell them that we’re going to use light sensors because they have the most consistent response and resolution. Activity If we mount the light sensors so they are the exact same distance off the ground when the robot is balanced, we can be sure that the light sensors will have the same reading. If the robot starts leaning, there will be a difference in the light sensor readings. We can use that difference to control the motors to balance the robot.Notes Students will have to experimentally determine their constant of proportionality. Because the power input of the move block converts negative numbers into positive numbers, there needs to be a comparison block to set the move block’s direction.

Reference 1

http://sites.tufts.edu/stompactivitydatabase/files/formidable/a3.png

Reference 2

http://sites.tufts.edu/stompactivitydatabase/files/formidable/b4.png

You must be