an external command reading white line follower...

14
EE-712 Embedded System Design: Course Project Report An External Command Reading White line Follower Robot 09405009 Mayank Mishra ([email protected]) 09307903 Badri Narayan Patro ([email protected] ) Under Guidance of Prof. P.C. Pandey Abstract The report discusses the design of an 8051 based white line follower robot which accepts the commands placed along the white line and reacts accordingly. White line follower robot is an autonomous robot which once placed on a white line keeps following it. It makes use of LDRs to distinguish between contrasting light and dark coloured surfaces (in this case it is white coloured line in form of a strip over a black surface). These kind of robots find applications in many situations like in places where some materials are to be transferred from one place to another. They carry out the navigation task without human guidance as they are able to sense where to move by following the white line. This report describes a novel mechanism by which the behavior of line following robots can be altered and controlled by using external commands. These commands are themselves a pattern of white strips which are kept along the white line path of robot. Upon reading these commands robot carries out necessary actions like slowing down, turning left in next junction etc. These commands allow us to have more control on the robot and thus improves the usability. The code is written is C language using Keil as the IDE and debugger. The status of the robot while following line and accepting commands was displayed using status LEDs. The Robot was found to follow the path and take the turns accordingly along with executing the commands kept on the track. 1 Problem Statement: To design a white line follower Robot which is capable of reading external commands kept along the track. The commands themselves will be in form of a white strips pattern. 2 Design approach: 2.1 Robot’s Mechanical Structure: As shown in the figure 1 below, the Robot consists of 3 wheels and an array of Sensors mounted on a board which acts as a chassis. Out of three wheels the front wheel is an omni-directional wheel and the two wheels at the back are driven by motor. Here are the specifications of mechanical structure of Robot. Driving Wheels: 2 with 5 cm diameter. Omni directional Wheel: 1 with 1.8 cm height.

Upload: others

Post on 19-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

EE-712 Embedded System Design: Course Project Report

An External Command Reading White line Follower Robot

09405009 Mayank Mishra ([email protected]) 09307903 Badri Narayan Patro ([email protected])

Under Guidance of Prof. P.C. Pandey

Abstract

The report discusses the design of an 8051 based white line follower robot which accepts the commands placed along the white line and reacts accordingly. White line follower robot is an autonomous robot which once placed on a white line keeps following it. It makes use of LDRs to distinguish between contrasting light and dark coloured surfaces (in this case it is white coloured line in form of a strip over a black surface). These kind of robots find applications in many situations like in places where some materials are to be transferred from one place to another. They carry out the navigation task without human guidance as they are able to sense where to move by following the white line. This report describes a novel mechanism by which the behavior of line following robots can be altered and controlled by using external commands. These commands are themselves a pattern of white strips which are kept along the white line path of robot. Upon reading these commands robot carries out necessary actions like slowing down, turning left in next junction etc. These commands allow us to have more control on the robot and thus improves the usability. The code is written is C language using Keil as the IDE and debugger. The status of the robot while following line and accepting commands was displayed using status LEDs. The Robot was found to follow the path and take the turns accordingly along with executing the commands kept on the track.

1 Problem Statement: To design a white line follower Robot which is capable of reading external commands kept along the track. The commands themselves will be in form of a white strips pattern. 2 Design approach: 2.1 Robot’s Mechanical Structure: As shown in the figure 1 below, the Robot consists of 3 wheels and an array of Sensors mounted on a board which acts as a chassis. Out of three wheels the front wheel is an omni-directional wheel and the two wheels at the back are driven by motor. Here are the specifications of mechanical structure of Robot. Driving Wheels: 2 with 5 cm diameter. Omni directional Wheel: 1 with 1.8 cm height.

Page 2: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Motors: 2, 12 V DC motors, 100 RPM. Chassis: 10cm x 15cm plywood piece.

2.2 Basic Working Scheme: White line follower Robot makes use of the principle that a light coloured surface reflects more light than the dark coloured surface. The light source is a set of bright Red LEDs and the reflected light sensors are the LDRs. We made use of an array of 3 LDRs to track the line. The sensors change their resistive value depending upon the intensity of light falling over them. The detection of a white line over a black surface is possible by a properly arranged LDR and LED pair as shown in the figure 2 below. The position of white line can be detected by the sensor which gets the maximum reflected light. This can be seen in figure 4.Depending on the position of line the drift in the path of Robot can be detected and thus corrective measure can be taken by turning the robot.

Figure 1 : Reflection by Black and White surfaces. White reflects more

Figure 2 : Top view of arrangement of sensors (LED, LDR pairs)

The LDRs give an analog Voltage output value inversely proportional to the amount of light falling over them. I.e. if a white surface is kept in front of LDR than the voltage output is more than in case of a black surface. The voltage output is then given to a

Page 3: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

comparator which compares against a threshold value and gives binary output. The threshold value is to be derived by experimentation and in this case we found it to be 2.5V. The binary signal from comparator is then directly given to the microcontroller which takes motor control decisions based on the inputs. The schematic is shown below.

Figure 3 : Schematic Diagram

2.3 Robot Movement/Turning and Drift Adjustment When the white line is below the center line sensor the robot moves straight. It does so by enabling both the motors. In case the robot drifts away from the white line the left or the right line sensor become active depending on whether drift is in right or left direction respectively. In order to properly follow the line the robot is required to rectify this drift by taking a left or right turn. The turning effect is provided by enabling or disabling the motors attached to wheels. Here is the table which describes the turning. Left Motor rotation Right Motor rotation For Moving Forward Anticlockwise Clockwise For Turning Left Off (Disabled) Clockwise For Turning Right Anticlockwise Off (disabled) For Moving Backward Clockwise Anticlockwise

Table 1 : Robot's Motion/Turning The drifting is shown in figure 6. 2.4 Command Sensing and Execution: The mechanism to detect commands is same as that of detecting the White line. The command is in the form of a set of 3 white strips arranged parallely to each other as shown in figure below.

Page 4: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Figure 4 : Movement of sensors over White line and command

Figure 5 : Command structure

The white line follower has dedicated sensors to sense commands. Commands are of 3 bits each. Each bit of a command is a combination of a Guard Strip and the Command Strip. The command strip is valid only when the guard strip is present. This mechanism is required because if we don’t have the guard strip mechanism then Robot will never come to know when to take the 0 bit.

Page 5: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

The commands which have been implemented are Command Code and Name

Description How it is Achieved

MOVE_FAST This command is to make Robot move faster. Giving more than 1 of these commands in succession will have no additional speed increase.

By setting the PWM load factor to be high. This high value is predefined.

MOVE_SLOW This command is to make Robot move slower. Giving more than 1 of these commands in succession will have no additional speed increase.

By setting the PWM load factor to be low. This low value is predefined.

MOVE_NORMAL This command is to make Robot move in ideal speed. This speed is the default speed of robot. After giving a move fast and move slow commands this command can be used to bring Robot back to normal state. When robot starts-up it moves with this normal speed.

Setting PWM load to be normal load. This is predefined.

ABOUT_TURN This command makes robot to reverse the direction of motion. Robot rotates fully over the track and when it finds line again it starts moving.

By rotating wheels in opposite direction. First we need to ensure that all the line sensors have left the white line and then keep rotating robot till the time any of the line sensors comes back over the white line.

TURN_LEFT This command makes robot to choose the left turn in the next bifurcation of tracks. The bifurcation should be within 5 cm of this command.

By disabling the right sensor for some time. This makes a bifurcation to appear as a simple left turn to Robot. The limitation of 5 cm is because if the distance is more then the robot can get deviated from the white line before a bifurcation is reached as there will be no input from Right sensor.

TURN_RIGHT This command makes robot to choose the left turn in the next bifurcation of tracks. The bifurcation should be within 5 cm of this command.

By disabling the left sensor for some time.

STOP This command brings robot to halt. By killing the PWM. Table 2: Commands and their implementation

Page 6: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

2.5 HW/SW Partitioning: Following figure gives an idea of different modules involved in the SW and their interaction with the HW. The important ones are

1) Drift control module: This module takes input from the Line Sensor module. The input is in the form of line sensor values by which the location of white line can be figured out. Depending upon the location of line this module takes decision whether the Robot has drifted or not. If Robot is drifted then it corrects the drift. The mechanism is given in flowchart 2. Also Drifting is shown in figure 7.

2) Command Execution Module: When a valid command is detected by Command Sensor Module it is required to take necessary action. It can be understood by FlowChart3.

3) PWM Control Module: This module utilizes the timer interrupt functionality of the 8051 microcontroller to generate the PWM. This module is important as the Speed of robot depends directly on the PWM load factor.

4) Status Display Module: This module is very important from debugging point of view. It gives the status of the different sensors, Command module etc. It has a set of LEDs, which can be seen in figure 8.

Figure 6 : Software Architecture and SW/HW interaction

Page 7: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

3 Design of circuit-

Page 8: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Flow Chart 1 : Main Control Flow Chart. The Boxes "Drift Adjust" and "Execute Command" are further explained later.

Figure 7: Drifting scenarios. The mechanism to handle the drifting is explained in Flow Chart 2

Page 9: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Flow Chart 2 : Drift Adjustment

Page 10: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Flow Chart 3 : Command Execution

Figure 8 : Status display LEDs

Page 11: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Figure 9 : White Line Track with Commands. Black sheet over which track is made is 2m X 1.5m.

Figure 10 : Robot Top View. It is kept over an A4 sized paper.

Page 12: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

Figure 11 : Robot Side View

5 Testing We tested the robot over a white line track as shown in the figure 9. The commands were also tested and Robot performed well. There were few hiccups described as below. Although these don’t happen always and are infrequent.

1) Robot left line in some of the places – This happened because of the stray command problem described in section 7.

2) Wrong command detection – Again due to stray commands problem mentioned in section 7. It also happened due to command strip width problem (mentioned in section 7).

There was no situation or command in which Robot failed consistently. 6 Problems Faced (and solutions)

1) L293D problem : This chip has two power supplies one for the chip’s own working which is 5V, other one is the supply to be given to motors which is generally 12V. After connecting the direction pins and the enable pin appropriately but without connecting the power supply for motors it was observed that chip started driving motor from chip supply only. Thus caused huge current to be drawn from 5V supply. Same problem was observed with other L293D chips also. It was found that the direction pins are drawing current which is getting supplied to motors. The problem was with the breakdown of an internal transistor.

Page 13: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

2) Ambient Light problem: The white line sensors are quite prone to ambient light especially if sunlight is present. This problem was rectified by putting a black cover around the sensor array.

3) Command strip width problem: We faced problem in command detection. It was figured out that the command strip width was not sufficient and when the width was increased the commands were detected correctly.

4) Command Strip gap problem: Similar to width problem there was another problem which we faced. The gap between the strips should not be less than 1 cm.

5) Stray commands problem: Due to this problem sometimes Robot recognizes a command even when it is not there. We figured out that it is due to the reflection by black surface. We used a black chart paper which was quite smooth and thus some regions are quiet reflective. We tried to rectify this problem algorithmically and were quite successful. We changed the sampling count for command (like bouncing in keypad). But still sometimes this problem does happen.

7 Conclusion and suggestions for further improvement We conclude this report by saying that this Robot gave us a lot of opportunity to learn and experiment with embedded design techniques. 7.1 Further Improvement

1) 4-Wheeled Line Follower and Command Reader: Instead of having three wheels a more sophisticated design can be with 4 wheels. In a three wheeled Robot the differential between the rear wheels was provided by two separate motors. In case of 4-Wheeled Robot this differential can be provided by a real mechanical differential arrangement and thus requires only one Motor. This saves us from trouble of having two same speed motors as in case of 3-wheeled Robot described in this report. We would require one more motor in 4-Wheeled Robot for controlling steering but that could be done by a low powered one with lesser cost. The advantage which we feel will be present in 4-wheeled robot is that it will be much more stable and steadier. Although the turning radius may not be as good as 3-wheeled Robot.

2) More Commands: Command bit length can easily be increased from current 3 bits. This will allow us to have many more commands rather than just 8.

3) Rotating one wheel in reverse direction while turning: Currently we turn our Robot by disabling one wheel and making other turn. It gives a decent turning radius. But if we use mechanism such that instead of just disabling a wheel we rotate it in opposite direction then the turning radius will be much smaller. Although we experimented with this approach but found it to be quite unstable. It requires more algorithmic enhancement but we feel it is doable.

Page 14: An External Command Reading White line Follower Robothome.iitk.ac.in/~badri/badripatro/project/mt/EE... · An External Command Reading White line Follower Robot . 09405009 Mayank

4) Using other Microcontroller than 8051: 8051 does not have a dedicated PWM generator. We used Timer interrupt mechanism to generate PWM in our project. This was certainly an overhead which limits the overall capability. There are other microcontrollers which have dedicated PWM generation and are much faster than 8051. Using them would result in a much faster and accurate Robot.

8 BOM of Robot