LINE FOLLOWING MOBILE ROBOT

⊆ 11:15 AM by ahmad bendul | ˜ 0 comments »

First of all, these are a project tat i've done during my study.. anybody can use my article here as a reference.. however i do not encourage you to "copy and paste". Plagiarism are prohibited. PEACE NO WAR!!!

-->

INTRODUCTION
Formula 1 (F1) race is the highest class in the family of auto racing. The F1 car can easily achieve up to 380 km/h and the engine revving up to 19000 rpm. This is made possible due to the evolving advance technologies especially in the area of mechanical, electronic and mechatronic engineering. However, high speed alone cannot guarantee the victory of a F1 team. One of the most important strategies in winning F1 race is to have the shortest pit stop time. During this pit stop, the tires of the F1 cars are replaced while the fuel is filled before the driver cruises back in the race. Two most crucial tasks in this pit stop strategy are to cruise into the pit stop area at a certain pre-specified speed limit and to execute the pit stop activities at the fastest time possible.
Borrowing the spirit of F1 race, in the area of mobile robots, there are many mobile robot races have been organized by many institutions throughout the world. Depending on the scope of the race, mobile robots are designed and developed according to given specifications and the robots race in a predefined track where the winner is usually decided by timing, distance travelled or completion of the race. General guidelines and rules in designing and fabricating the robots are provided but the detail selections of the components are decided by the robot designers to plan the winning strategy. Specifically for this challenge, the pit stop strategy will be the main consideration.
OBJECTIVES
1. To build a mobile robot by implementing the line following method.
2. To program the robot so that it moves by following the line and stop at the pit stop area for a while before continuing the race.
-->
Figure 1
Figure 5
-->
Figure 6
-->
Mechanical Part
Mechanical part is one of the important parts when we want to design a robot. Figure 1 below show the design of the robot using we assemble all the necessary parts.
From the figure, it shows all the components that must be assemble to make a robot. All of the part must be assemble properly to make sure the robot can move smoothly and stable.
We have been given by Robotic Lab a DC twin gear motor (Tamiya Motor), because generally it high torque and have low speed. The Tamiya motor is a compact unit with two independent motors and gear trains. The motor have two different speed ratios, with a high-speed 58:1 gear ratio or with a slower 203:1 gear ratio. The motors provide plenty of power to drive any small robot [3].

We use Lithium Polymer battery for the robot. The battery was use for multiple users such as to drive motor and sensors. 9V battery also use for supporting microcontroller operation.
For the body and structure of the robot (Figure 5), we assemble the body of the robot layer by layer as shown in the figure below. The main purpose we assemble it layer by layer is it will be easy for our group to assemble it and easy to make the maintenance. PCB stand was use as supporting tools. It uses to support the layer.
Other than that, we use short PCB stand with screw as a front ‘wheel’. We use it because it easy for us to make sure the robot has same level between the base and the floor. So we can optimize the function of the sensors. The advantage is the PCB stand is cheaper and easy to install rather than we use caster but the disadvantage is the robot can’t move smoothly.
Indicators also important when we designing the robot. The main function of the indicator is we can indicate the existence of the input voltage, indicate the input from the sensors, and easy to identify when the circuit face some problems. If the indicator not functioning, it means some problems occurred in the circuit and we can know which circuit is not functioning.
-->
Figure 9

-->
Figure 8

-->
Figure 7
-->
Electrical Part
In this MER-F1 project, the electrical design is the crucial part of the project. The electrical circuits consist in this project were CPU circuit, motor driver circuit, IR sensors circuit and the comparator circuit.
CPU circuit is the most important part. This project used the ATTiny2313 microcontroller as the controller from ATMEL. This microcontroller is a 20-pin that most suitable microcontroller used for this project. Since the project has limited time to be done, ATMEL is suitable because this microcontroller is simple, friendly user, and not complicated to be understood and used. So the time used for connection and programming can be reduced. If MC68HC11 or PIC family microcontroller used for this project, time that will be used to complete this project will be prolonged. For this reason ATMEL ATTiny2313 was the perfect choices.
Figure show the schematic circuit of distributed ATTiny2313. In this circuit also show the connection of the voltage regulator, Serial Port cable connector, and other interface for the microcontroller. Regulated 5V is connected to ATTiny2313 at pin-20 as Vcc since the power supplied to the voltage regulator was 7.4V. Input signal from the comparator circuit was connected to PORTD0 (pin-1)PORTD1 (pin-3) PORTD2 (pin-6), PORTD6 (pin-11) PORTD4 (pin-8), PORTD5 (pin-9) since the comparator used for this project was 2 unit. PORTB3 (pin-15) and PORTB4 (pin-16) functions as the output that carried PWM signal to the motor driver. PORTB2 (pin-14), PORTB17 (pin-11), PORTB6 (pin-18) and PORTB7 (pin-19) used as the output signal to the motor driver.
Motor driver circuit is considered as the output of the microcontroller. Motor driver important as the chip that control the current into the motor. Motor driver used for this project is the L293 motor driver from ST® SGS THOMSON [4]. The L293 is an 16-pin integrated circuit motor driver that can be used for simultaneous, bi-directional control of two small motors. The L293 is limited to 600 mA, but in reality can only handle much small currents unless it has done some serious heat sinking to keep the case temperature down. If it gets too hot to touch, you can't use it with your motor [2]. It means, the L293 has been overheated and became damage. Since in this project we used 2 small DC motor for a pair of wheel, a single chip of L293 is enough to handle both motor.
Figure show the schematics diagram of the L293 motor driver. From the diagram can be easily understand how the connection of the motor driver with the microcontroller, motors and battery.
The configurations of the motor driver are as follow. Pin-4, pin-5, pin-12 and pin 13 are the GND. Pin-16 is the 5V Vcc that the source comes from the voltage regulator of the CPU circuit. Pin-1 and pin-9 of the L293 motor driver known as the enable pin. For this project these both pin was used for PWM signal from the microcontroller. Pin-2, pin-7, pin-10 and pin-15 are the IN port that receive the input signal from the microcontroller. OUT port, pin-3, pin-6, pin-11 and pin-14 will connected to the motor as the output of the motor driver.
Infrared (IR) sensors circuit is suitable to be explained with the comparator circuit since the comparator and IR circuit considered as the input source of the microcontroller. We used only 2 pieces of sensors but each sensor will use 1 comparator. The comparators used are 2 pieces of 14-pin LM324 comparator [5]. IR sensors will give varies voltage to the comparator depends of the colour of the IR sensors detect. Note that the IR was connected to 5V Vcc. So the highest value of voltage that the comparator will receive is 5V. For this project view, this comparator is easier to use since this project was dealing with 4 different colours which are black, yellow, blue and the floor colour.
Figure 9 is the schematic circuit of the IR sensors and comparator circuit. the concept of this design is based on single input multiple output (SIMO). The input from the receiver were connected to 4 comparator input pin and other 4 comparator input pin were connected to 4 potentiometers with different adjustment. This adjustment was due to the type of colours stated before.







-->
Software Part.
In this project we had used BASCOM AVR demo version compiler to compile the program and burn it into the ATtiny2313 microcontroller. On this compiler we had studied the basic programming that can be applied to the hardware.
In this project we are more focused on programming on how to make the robot moved within a black line which this is the basic application that we should obtained on this project. The extension of this program is the programming on how the robot can differ 4 different colours in term of the track line.
The programming started with some configuration I/O port of the microcontroller. Then we declare the port that involve with a term that we understand and easier to used it in the whole programming which is repeated. For example port B pin 2 we declare it with INPUT1 for motor driver (IN1). So the rest of the programming we only used IN1 term to indicate that we has give instruction to the port B pin 2.
After some declaration, we started the main program by making it looping so that the programming did not only run in one cycle only. We make it continuously running and recheck the condition that we had stated in the program. We also used calling function technique to minimize the memory usage of the program. Because of the compiler is in demo version so the space of bytes is limited into certain value so this technique is very ideal to apply besides can make the program more systematic.
In the main programming there is some task on getting information which means that the program ‘told’ the microcontroller to get the information from the sensor as input. Then the data that had been received was processed by the microcontroller to give the output in term of motor rotation. In this programming we also had defined the condition that the program should run and not in term of position of the detected sensor. If the left sensor detect the floor we program it to make some right adjustment so the robot can stick with the track. Same case for the right sensor we had program it to make some left adjustment. This type of programming will repeat and make the sensor recheck the floor detection continuously. We say this programming as the floor detection because the sensor was more sensitive to sense the floor than black track line. The full programming that we used in this project is attached in the appendix part of this report.
For the structure design we used Google Sketch Up software to design our robot. This software is very simple compare to other mechanical software such as Solid Works. In addition, the software can be easily downloaded from the internet. This software can design a 3D prototype of the mechanical structure.
Discussion

During the early stage of the robot-making progress, we faced some problems regarding the sensor circuit. We used four sensors at that time, but one sensor did not work as it should be. The receiver part of the sensor did not give any reading. Therefore, we decided to change the malfunctioning sensor with a new one. This settled the problem. After completing the hardware parts and troubleshoot the circuits, we moved on to the programming part. Here, we faced the problem in compiling the program and write it into the ATtiny 2313 microcontroller and tried several times to burn the program to the µC. After trying n discussing among us, we managed to solve the problem. This problem occurred due to the lack of knowledge in using the BASCOM AVR compiler, where this was the first time for all of us to use it. Then, we managed to make our line following robot move by following the black line.
In the middle stage, we focused more on how to move the robot to the pit stop area which requires the robot to follow the yellow line. Here, we consider many things such as using the analog to digital converter (ADC) to solve the problem. However, we could not proceed with the ADC due to the difficulties in understanding the matter that involves. Therefore, we thought of another idea where we need to change the formation of the sensors and increase the number of sensors. We decided to use six sensors instead of four to easier implement the color recognition by the sensors. Here, many problems occurred. The new sensor circuit gave us unsolved short-circuit problem. We could not find the source of problem where the sensors did not work. We spent many hours in continuing to settle the problem. Due to this problem, our voltage regulator burnt. Some components need to be changed due to this such as the sensors, voltage regulator and the 2-pin connectors.
Finally, in the final stage we decided to dramatically reduce the number of sensors we use to just two of them. This was due to the time constrained and the inability to solve the previous short-circuit problem. By using just two sensors, we decided that our robot could just follow the black line instead of entering the pit stop. In the end, our robot was able to follow the black line perfectly, but have difficulties in moving smoothly due to the use of PCB stand and screw as the supporting part

--> -->
Conclusion
From this robot project, we conclude that we able to design and build line following robot in the time given. Although we able to build this robot, we unable to make the robot follow all the specification needed in the challenge. We succeed to make the robot follow the black line but the robot can’t follow the yellow line and entering at the pit stop.
We learn how to make a good robot based on the mechanical part, electrical part and the software part. Good strategy and programming needed to make the robot move smoothly.