Buidling the Anyway NXT Scooter

The "Anyway" in profile
The “Anyway” in profile
The "Anyway" self-balancing scooter -balancing itself.
The “Anyway” self-balancing scooter – balancing itself.

As I mentioned in my last post, my sons’ school had a science fair last week where I ran a demonstration involving angular momentum and gyroscopes.  In researching the use of gyroscopes in engineering today, I found that extremely large gyroscopes, weighing up to hundreds of tons, are used to stabilize ships, and extremely small gyroscopes that operate by vibration are used in electronic circuitry, such as that in smart phones and video game controllers.  One application that many people are familiar with is the use of gyroscopic sensors to stabilize self-balancing two-wheel scooters, like the Segway.

Googling “self-balancing robots” reveals a remarkably large number of homemade robot projects, but I didn’t have the time to start a project like that from scratch.  Fortunately, I found a link to build a Segway-style scooter using only a LEGO Mindstorms set, and a third party gyroscope sensor.  I ordered the HiTechnic LEGO Mindstorms gyroscopic sensor from Amazon, and set to building as soon as it arrived.

The project details are here:  http://robotsquare.com/2012/03/13/tutorial-segway-with-nxt-g/.  The author, Laurens Valk, calls it the “Anyway” scooter, because it can be built from any standard Mindstorms kit along with a gyroscopic sensor.  It was a remarkably easy robot to build – my eight year old did most of it, and Valk kindly provides all of the code necessary to run it.  We downloaded the NXT code, and the robot ran perfectly the first time.  The gyroscopic  sensor detects the robot’s tilt angle and rolls the wheels forwards or backwards accordingly to maintain balance.  Getting the starting balance right took a little bit of practice, but it was remarkably stable as it ran.  We tested it over bumps, carpet, one wheel over an bump, etc. and it did pretty well with most obstacles.

Understanding the code is significantly trickier than running it.  NXT is not an ideal language for programs with multiple variables and detailed calculations, but Valk does a remarkable job of organizing and executing the code.  He also makes the code available in RobotC, which is much easier to follow, though also challenging to understand, unless you are familiar with PID (Proportional-Integral-Derivative) algorithms in control systems.  A PID algorithm uses a feedback loop to control a system dependent on undetermined variables.  Fortunately it is not necessary to understand the code to get the “Anyway” working.

When the newest version of the LEGO Mindstorms NXT kit, the EV3, is released this fall, it will come standard with a single-axis gyroscopic sensor.  Then you will be able to buld a self-balancing robot right out of the box.  That is something to look forward to!

Leave a Comment