logo

AnyWay - Build a SegWay in under an hour!

no-caption

So you want to build a LEGO MINDSTORMS NXT self balancing robot, also known as a Segway? Look no further! Here you'll find instructions to build and program a working Segway in under an hour. (Skip to building the Segway or skip to programming.)

The "AnyWay" design can be built with "any" NXT set, and ready to run programs are provided. Above you see the original project made in May 2010. A new, updated version (November 2011) is below, featuring easy to edit source code and support for multiple NXT Gyroscopic sensors.

no-caption

Building the "AnyWay" Segway

You can build the segway with this set (or any other NXT set) plus a Gyroscopic Sensor

You can build the segway with this set (or any other NXT set) plus a Gyroscopic Sensor

What do you need?

  • Any version of the MINDSTORMS NXT system
  • A LEGO MINDSTORMS NXT compatible Gyroscopic sensor. Currently the following sensors are supported in this project:
  • Programming software. Currently the following software is supported in this project:
    • NXT-G: The software that comes with the Mindstorms NXT kit. You may want to download version 2.0 (download here), but that's not necessary if you just want to run this program.
    • RobotC: You need version 3.0 or later (download here)

Building the AnyWay with the HiTechnic Gyroscope

Step 1

Step 1

Step 2

Step 2

Step 3

Step 3

Step 4

Step 4

Step 5

Step 5

Step 6

Step 6

Step 7

Step 7

Selecting wheels

As you can see in step 7, you can choose between three different wheels and tyres to use with your AnyWay. If you use the biggest wheels, consider adjusting the design so that it has a wider wheel span to increase stability.

Building the AnyWay with the Dexter Industries Gyroscope

Step 1

Step 1

Step 2

Step 2

Step 3

Step 3

Step 4

Step 4

Step 5

Step 5

Step 6

Step 6

Programming the Segway

Making a program for a balancing robot is not easy at first, but it would still be great fun to make a LEGO Segway, right? The next two sections should give a helping hand with free ready-to-run programs for a LEGO NXT Segway. The RobotC code is most complete and supports both Gyro sensors. If you want to use NXT-G (the LEGO Sofware), you should use the HiTechnic Gyro sensor, simply because the provided NXT-G program only works with that sensor for the moment.

Programming with RobotC (With source code!)

Programming a Segway has never been so easy. The program (download link below) consists of one Segway Driver file, which will handle all the balancing for you. In your main program, you can easily control the Segway's movement, simply by telling the robot how fast to move and how fast to turn.

Detailed instructions and examples are included in the download. One of the example programs will make the Segway drive around and avoid objects, just as in the second video on this page.

These programs are meant to be used with RobotC 3.0, and in some cases you will need the latest version of the RobotC 3RD Party Driver Suite. It supports both HiTechnic and Dexter Industries Gyro. Full details are in the program files.

Segway-RobotC-Driver-and-Examples.zip 7 kb Download

Programming with NXT-G (LEGO Software)

The Segway program for the LEGO Software comes as an exectutable file only, which means you'll be putting it onto your NXT brick straight away with no programming. This works a little differently than you're used to. Follow the steps carefully. You can only use this program with the HiTechnic Gyroscopic sensor!

Loading the program

  • Download the program using the link below, and save it on your Desktop.
Anyway.rxe 14 kb Download
  • Launch the NXT programming software, and open a new program.
  • Connect your robot to the computer with a USB cable.
  • To use this program, the firmware on the NXT brick must be 1.28 or higher. If you have the NXT 2.0 set skip, you can this step. If you do not have the NXT 2.0 kit, you must update your NXT firmware:
    • Click here to download the latest firmware, and unzip it to your computer in the following location:
      Program Files or Program Files (x86)\LEGO Software\LEGO MINDSTORMS NXT\engine\Firmware
    • Restart the programming software, go to 'tools' and click 'Update NXT firmware'.
    • Select Firmware v1.29, and click 'Download'.
    • Wait for the NXT to be updated. Your NXT screen will go out (this is normal). Your NXT will switch on automatically when the download has completed.
  • Open the NXT window.
  • In the window that pops up, select your NXT from the list, and then click the 'Memory' tab.
  • Click 'Download'. Select the program you previously saved on your Desktop (Anyway.rxe), and click 'OK'.
  • Using the same method, download the following sounds to your robot: "Object Detected.rso", "Hello.rso", "OK.rso", "03.rso", "02.rso", "01.rso", and "Start.rso". You will find these files in the following folder:
    Program Files or Program Files (x86)\LEGO Software\LEGO MINDSTORMS NXT\engine\Sounds
  • You can now close the NXT Window by clicking 'close'.

Making the Anyway move

Congratulations, you have successfully built and programmed the Anyway, your Segway! Now we'll launch the program and make the robot move! The NXT screen will give you most of the instructions, but the first time you use Anyway, you might want to follow the these more clearly explained steps.

  • Start the program as you normally would: Turn the NXT on, and navigate to 'My Files > Software files > Anyway > Run'.
  • The robot will ask you to select which wheels you attached to your robot. Make the selection by clicking one of the NXT buttons as indicated on the screen. See the last page of the instructions to see which wheels you are using.
  • Next, you can select the speed at which your robot should move around. Choose 'still' the first time you run the program. The robot will then balance in place. If it all works well, you can choose 'slow' or 'fast'.
  • Now, lay the robot still (i.e. on the ground), and press the Enter button. Your robot will now calibrate the gyro sensor. Do not move the robot until it's said "Ok".
  • Now hold your robot upright (in its balanced position) as it counts down. Make sure that as you start the program, there should be no objects within 3 feet of the robot's eyes.
  • After it has said 'start', you can let it go, and your robot should now balance!

More Segway Videos

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site