Jegway – Lego NXT Segway

Engscope is home of the Jegway, a Segway like device made from Legos! Actually, I am by no means the first to make this out of Legos Mindstorm NXT set. That credit would go to Steve Hassenplug’s Legway, the world-famous self-balancing LEGO robot. The Legway uses an optical detector to maintain a certain distance from the sensor to the ground. Next, there’s the NXTway, by Philo. It uses the optical sensor that comes with the NXT set. Lastly, the inspiration for the Jegway comes from the NXTway-G by Ryo Watanabe. His implementation involves a gyroscope and displays outstanding stability.

Of course, I can just leave it at that. A real Segway uses accelerometers and gyroscopes. The reason for the use of both types of sensors comes down to the estimation of tilt angle, and I will discuss more on the subject in each of the Jegway segments.

I have made two implementation, using just the gyroscope, similar to Ryo Watanabe’s NXTway-G, and another that combines a gyroscope and accelerometer to get a more accurate measure of the tilt angle. This idea comes from both the original Segway, and also Trevor Blackwell’s balancing scooter.

Jegway Rev0 – Implemented using the Hitechnic gyroscope.

Jegway Rev2 – Implemented using the Hitechnic gyroscope, Hitechnic accelerometer and the Mindsensor PS2 controller.

Enjoy, you’ll find documentation as well as code for both versions. The code is implemented in RobotC. Originally it was written in NXC, but because NXC does not support floating point arithmetic, I eventually broke from the pope and converted to RobotC.

62 Responses to “Jegway – Lego NXT Segway”
  1. Alex says:

    Rev0 is, at least in my understanding, the first revision of the code. Similar to saying version 1, whereas Rev2 would be version 2, and so on.

  2. Carol says:

    Oh okay. Thanks for clarifying. Well, or now we’ve stopped working on the segway, and are working on a mining robot. We have reached a point with the sgeway where we have to stop work on it temporarily. We weren’t getting anywhere, really. So, wish us luck that this slow time would pass!

    -Carol.

  3. Carol says:

    Hey. I said we stopped working on the segway, not gave up on it! We have just reached a slow point with it, but are still trying very hard to try and get it working! And we still need help! Like, we need to know what programming would work best for beginners like us! NXT-G or RobotC still! Please answer us back!

    -Carol.

  4. Alex says:

    RobotC is the way to go, hands down. But if you really want help it’d be a lot easier if I could see what you’ve got so far.

  5. Carol says:

    Well, I don’t know how to put a picture on this website, but when I find out, I’ll post a picture.

    -Carol.

  6. Alex says:

    As I said before, you can always e-mail me at Beattieboy@comcast.net.

  7. Carol says:

    Okay, I will. But what happened to jliu83? In my opinion, it’s pretty confusing. Anyway, expect an e-mail from me soon.

    -Carol.

  8. Alex says:

    It’s not so difficult to understand at the basic level. But you’re right it can get really complex really fast. I’ve written two versions of the code for my segway from scratch, both around thousand lines long.

  9. Carol says:

    WOW. I’m absolutely amazed and blown away by that. Well, right now it’s gotten really complicated for us. We can’t understand how to use RobotC anymore. We’ve been trying to contact all sorts of people even Carnegie Mellon. They didn’t really help, even though they are the best technical school in the U.S. So anyway, we are all really confused.

    -Carol.

  10. Alex says:

    Well I’m back to square one again as I just finally started programming what is probably the final version of mine. This one’s full scale. Driven by two wheelchair motors and I’m using the mindsensors servo controller to let the NXT control the motors’ speed controllers. But the new one’s got an actual tilt sensor, though it’s not implemented yet. But the servo controller unfortunately slows the loop times considerably sometimes as it is an I2C device.

  11. Carol says:

    Wow cool. So anyway, we can’t do anything with the segway. We even tried going back to the light sensor and not even that’s working. So, we’ve given up on the segway. Sorry for dissapointing everybody. Goodbye. :(

  12. AJ says:

    Do you know where I can find the build instruction for Jegway?

  13.  
Leave a Reply