Lego Segway


This project was done at KTH Elekro for a project course.

This course mostly aimed for project management in groups of five persons, the project our group got was to build a segway robot based on lego mindstorm kit.

The problem was that no group before was able to make the robot stand for more then 12 seconds. Only the PhD student group was able to create a robot that could stand without time limit. The goal was to beat the PhD student’s time.

My main role in this project was to create the empirical model of a lego segway robot, and this is what I did. we only had access to the lego mindstorm kit the two last weeks, so it was very important that the theory was done before we got the lego kit.

Given the time limit it was important to collect as much information as possible before creating the basic control system structure. For the sensor data collection, I built a test rig with accelerometers and gyros, and put together a signal logging program.

Sensorkort (Custom).jpg


With this test rig the different angular algorithms could be tested.

A idea was to be able to use the rig on the final lego robot. but after implementation to the lego robot data interface a big flaw was detected. The data transfer was to slow and took to much process power when I implemented it in the lego unit. So the idea was scraped.

We went away from the recommended programing language, the lego unit uses a so called Real time operating software. And I knew the importance of selecting the right programing language when the processor resources are limited.

And I went with Robot C that has the best performance when used with the integrated software in the lego unit. I could skip the integrated software and write processor compiled code, but that would take much more time than a could afford for the project.

It was not so difficult to get the robot standing only with the gyro sensor, but it had a awful gyro drift fault, this cannot be calculated, and it gives sporadic data faults.

When I tried to integrate the accelerometer in the control algorithm the extra time delayed when fetching the accelerometer data made the robot much more unstable.

So instead of the accelerometer I used the wheel sensor, this sensor does not have the best performance, but that was solved with moving average type collector.

Here is the final control system for the segway robot

Bild1 (Custom).JPG

Then I created a function in my logging program that enable me to send control data trough Bluetooth and control the robot with the PC mouse movements.
The PhD studens robot could only stand still on the same spot or run forward with a constant speed.

RemoteJoystick (Custom).JPG

Final result.

Video 2  ” Not the best video quality”


Get every new post delivered to your Inbox

Join other followers: