How to build a LEGO Mindstorms robot that does not fall from the table

In this episode we are showing the great similiarity between the sensors in NXT Mindstorms. We are solving a common problem - How to make a robot that do not fall from the table. We are using the Ultrasonic sensor, Light Sensor and Touch Sensor to solve the same problem, but with three different sensors.

  • #27
  • 23 Jun 2013
  • 4:41

You could use this video as a how to on working with mindstorms sensors.


Have your robot ever fall off from the table and broke in pieces. Well this won't happen again today I will show you how to make a program that does not let your robot to fall of the table.

It is obvious that you can not solve this task without using sensors. The regular mindstorms set comes with four sensors. Touch Light Ultrasonic And Sound Sensor With the last one it will be really hard to know when you reached the edge of the table. Still with the other three sensors it is possible. Actually the solution with the three sensors is almost identical. First let's attach the three sensors. I have attached the Ultrasonic sensor facing the ground at five centimeters away from it. Then I have attached the Light sensor which again facing the ground, but only a half centimeter above it. And last I have here the Touch sensor which has an attachment that is keeping it pressed while the robot is on solid ground and when the robot gets to the end of the table the Touch sensor is released. And the robot knows that it's on the edge of the table. Let's take a look at how the program should look like.

First we'll move unlimited until we reach the edge of the table. In our case we will use the Ultrasonic sensor to detect when we are at the edge of the table. So we will move forward unlimited until we detect a distance greater than five centimeters. With the Ultrasonic sensor.

Then we need to stop and the next few actions depend on your aim. I have decided to go back for one rotation and then make a turn with Motor C backward for two rotations. All of this I will repeat unlimited and our program actually is ready.

Now let's go on with the other two sensors. As I said in the beginning of the video the three programs are almost identical. That is why the only difference will be in this orange sensor block. Now let's try it with the Light sensor. On the place of the Ultrasonic sensor I will take a Light sensor which will wait until the light is over 50. And this is the program with the Light sensor.

Finally we will change the sensor to the Touch sensor.

And unlike most programs this time we will wait until the sensor is released.

So this is our third program let's try it.