a line follower robot using lego mindstorm

5
1 A Line follower robot using LEGO MINDSTORM Mithun Chowdhury, Siavash Danaee 03.11.2012 Abstract The presented report describes the different steps taken to reach the final line follower robot using the NXT Lego Mindstorm. The mechanical assembly is carried out using the manual instruction and then the appropriate programme has been written meeting the problem requirements. The programme has three parts. The line following part which is the running task has been done applying the light sensor as the detector. The ultrasonic and sound sensors have been implemented to detect the system disturbances which are consisted of: sound and obstacle. Before having the robot works the calibration has been done to get the optimal results. 1. Introduction A Line follower robot is a robot that can follow a path. The path can be visible like a black line on a white surface (or vice-versa) or it can be invisible like a magnetic field. The reason for having such a robot is that the robots can be taught in a way that follows the line thus giving a human-like property of responding. These robots are widely used in automated cars running on roads with embedded magnets; guidance system for industrial robots moving on shop floor and so on. IR sensors as the detector of the black and white backgrounds are extensively used in Path Following Robots to distinguish the two colors. The sensing process is done using different resistance values. It means that the resistance of the sensor decreases as IR light falls on it. With this in mind a perfect sensor will have near zero resistance in presence of light and a very large resistance in absence of light. The figure 1 shows the implementation of the sensor in a Path Following Robot. Figure.1 Illustration of a detecting mechanism by a light sensor The studied robot has the following main components to do the tasks as a line follower robot: 1. Vehicle with embedded NXT microcontroller 2. Sensors

Upload: mithun-chowdhury

Post on 21-Apr-2017

47 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: A Line Follower Robot Using Lego Mindstorm

1

A Line follower robot using LEGO MINDSTORM Mithun Chowdhury, Siavash Danaee

03.11.2012

Abstract The presented report describes the different steps taken to reach the final line follower robot using the NXT Lego Mindstorm. The mechanical assembly is carried out using the manual instruction and then the appropriate programme has been written meeting the problem requirements. The programme has three parts. The line following part which is the running task has been done applying the light sensor as the detector. The ultrasonic and sound sensors have been implemented to detect the system disturbances which are consisted of: sound and obstacle. Before having the robot works the calibration has been done to get the optimal results.

1. Introduction A Line follower robot is a robot that can follow a path. The path can be visible like a black line on a white surface (or vice-versa) or it can be invisible like a magnetic field. The reason for having such a robot is that the robots can be taught in a way that follows the line thus giving a human-like property of responding. These robots are widely used in automated cars running on roads with embedded magnets; guidance system for industrial robots moving on shop floor and so on. IR sensors as the detector of the black and white backgrounds are extensively used in Path Following Robots to distinguish the two colors. The sensing process is done using different resistance values. It means that the resistance of the sensor decreases as IR light falls on it. With this in mind a perfect sensor will have near zero resistance in presence of light and a very large resistance in absence of light. The figure 1 shows the implementation of the sensor in a Path Following Robot.

Figure.1 Illustration of a detecting mechanism by a light sensor

The studied robot has the following main components to do the tasks as a line follower robot: 1. Vehicle with embedded NXT microcontroller 2. Sensors

Page 2: A Line Follower Robot Using Lego Mindstorm

2

3. Drive motors 4. Software

In this exercise it has been attempted to have a line follower robot carrying out desired tasks.

2. Mechanical Construction First part of assignment consists of mechanical construction of the robot according to the provided instruction. It is done in the way to obtain a very uniform in color surface. The final assembled robot is shown in Fig 2.

Figure 2- Mechanical Construction of the Final Robot

3. Program Program of the robot is consisted of four parts which are the three tasks and the main part. Every part of the program is described in further sections.

3.1 Main Part According to the instruction there are three tasks which should be done by the robot. These three tasks are follow_line, object_detected, and sound_detected. These three tasks are related to each other in the main part of the program. In the main part, Precedes command is implemented to define the relation between three major tasks. This relation is shown in Fig 3.

Page 3: A Line Follower Robot Using Lego Mindstorm

3

Figure 3- Main and Tasks

3.2 Task sound_detected In this task the robot is supposed to stop from moving as the sound sensor detects any sound. To show the detected sound the robot gives a beep sound. The sensor uses the frequencies around 3-6 kHz where the human ear is most sensitive. In order to stop the robot from moving the Off command has been used. The PlayTone has been implemented to give the beep for the probable sound detected. Figure 4 is schematic illustration of the flow chart for the sound detected task.

Figure 4 - The flowchart of a sound_detected task

3.3 Task follow_line There are several techniques which can be used in a line follower robot. In this approach a specific zigzag technique is implemented. First of all, the light sensor is calibrated by the line and the environment. It is observed that the percentage value of the light sensor in the middle of the line is around 30. Coming nearer

Page 4: A Line Follower Robot Using Lego Mindstorm

4

to the edge of the line, this value is increased up to values around 40. Light values in the out of line are more than 40. The flowchart of line following task is shown in Fig 5.

Figure 5 – Flowchart of follow_line task

3.4 Task object_detected In this task, the robot should detect the objects closer than 5 cm to it and stop. To detect the objects, ultrasonic sensor is used. When the robot sees an object near to it, first should stop. To do this Off command is used. Then the robot should say “object detected”. To do this, PlayToneEx command is implemented. Then the robot should display “Stopping” in its LCD. To do this TextOut command is implemented. The robot should remain in this phase as far as the object is not removed. Hence, a while loop is used. The flowchart of object_detected task is shown in Fig 6.

Page 5: A Line Follower Robot Using Lego Mindstorm

5

Figure 6 - The flowchart of the object_detected task

4. Problems In this approach, several problems have been coped. First of all, the performance of the light sensor was not totally acceptable. This sensor is highly sensitive to ambient light which causes bad performance of the program. Moreover, there were lots of problems in defining parallel tasks with mutex. To solve this problem, semaphore trick has been implemented. In addition, due to the structure of the robot, it was not possible to detect objects in low heights and the robot is just able to detect objects in heights equal to its height.