Вы находитесь на странице: 1из 8

Line Following Robot Tutorial:

What is a Line Follower?


An autonomous robot that follows a line of particular color and intensity is known as a line follower. It basically involves electronic concepts and programming. The components required to make a basic line following robot are as follows: Using Logic Gates: Infra-Red Sensors Comparator LM324 Logic Gates to implement the logic H-Bridge L293D Passive components Voltage Regulator IC7805 Voltage Regulator IC7805: Using Microcontroller Programming: Infra-Red Sensors Comparator LM324 (optional) Microcontroller ATMEGA-16 H-Bridge L293D Passive components Voltage Regulator IC7805

It converts the given input voltage to an output voltage of 5 volts (Input vol tage > 5 volts). It has three terminals namely: 1. Input voltage terminal 2. Ground (negative terminal of DC Voltage Source) 3. Output voltage terminal A voltage of 5 volts is required to activate any IC (Vcc). Infra-Red Sensors: An Infra-Red sensor detects Infra-Red light/white light from a particular object/line and then converts light energy to electrical energy. An IR sensor pair consists of an emitter and a detector. The emitter is blue in color and the detector can be grey, black or white in color.

TX Emitter

RX - Detector

IR Emitter: An infra-red emitter is a Light Emitting Diode (LED) made from Gallium Arsenide. It detects IR energy at a wavelength of 880nm and emits the same. IR Detector: An infra-red detector is a photo detector. It detects IR energy emitted by the emitter and converts it into electrical energy. The main principle involved in the conversion of light energy to electrical energy is PHOTOELECTRIC EFFECT. IR sensor circuit to detect a black line on white background:

The output of the IR sensor is taken at the negative terminal of the detector. From the detector, the output is sent to the comparator to convert the analogue value of output to digital value. Comparator LM324: It is a 14 pin IC which converts an analogue input value to a digital output value. It compares the analogue value with a reference value (set by trimpot) and gives the digital output. The pin diagram of LM324 is as follows:

The activation voltage for IC LM324 is 5V. The reference voltage is given at the terminal in and is set using a trimpot. The output of the IR sensor is given to +in. The output of LM324 is given to logic gates. Logic Gates: The logic required to crack the problem statement is written in terms of variables and the functions are obtained. These functions are simplified using K-maps. For example: Consider a line follower having 3 sensors (indicated in blue) and has to trace the following path. When the middle sensor senses and the other two sensors gives a zero output, then the robot needs to move straight. The left and the right motors need to move forward. Similarly, the robot needs to move right (the left motor should move forward and the right motor should not rotate) when only the right sensor senses and the other two sensors give a zero output. Even two other cases are included.

Logic: L1 1 1 1 R1 0 0 0 L2 1 0 1 R2 0 0 0 A 0 0 0 B 1 0 0 C 0 1 0

Where L1 and L2 are the two terminals of the left motor, R1 and R2 are the terminals of the right motor, A is the left sensor, B is the middle sensor, C is the right sensor. K-map implementation for L1: A^, B^, c^ are the compliments of A, B, C.

B^C ^ A A^
0 1 0 1

B^C
0 0

BC
0 1

BC^

The output function would be A^B^C^+A^B^C+A^BC^. It can be simplified using K-Map reduction technique. Using K-Map reduction technique, 2 adjacent 1s can be mapped. So 1s present in A^B^C^ and A^B^C can be mapped together, A^B^C^ and A^BC^ can be combined together. So, the simplified function would be A^B^+A^C^ = A^ (B^+C^). This function obtained is easy to be implemented using logic gates when compared to the original function. We can make use of the following gates to implement the functions: 1. NAND Gate (7400) 2. OR Gate (7432) 3. AND Gate (7408) The above mentioned logic gates are considered as primary logic gates. The other logic gates that can be used are XOR, NOT, NOR. Pin Diagram 74XX series:

The output of the Comparator LM-324 is given to the input gate of 74XX series and the output is taken from output gate. Accordingly, the logic is implemented and the output is obtained. The output obtained is given to the input pin of H-Bridge L293D and the output of the H-Bridge is given to the motors of the line following Robot. H-Bridge L293D pin diagram: EN Enable = 5V DIR = input from gates Vs = 12-32V MOT = output to motors

Microcontrollers: The logic can also be implemented by making use of a Microcontroller. Microcontroller is a device which can take in data, process and manipulate the same and give a desired output as per the code. The microcontrollers commonly used are ATMEGA 8/16/32/64 and PIC microcontrollers. A microcontroller has an inbuilt processor, RAM and Flash memory. The Flash needs to be programmed. The coding can be done using the following software: 1. AVR Studio 2. MikroC PRO for AVR

There are several ports in order to give in input and take the output from the microcontroller. The basic header files that are to be included in AVR STUDIO are #include<avr/io.h> and #include<util/delay.h> The basic registers used for programming the microcontroller are DATA DIRECTION REGISTER (DDR), ADCSRA, ADMUX, ADCH, ADCL to name a few. Pin diagram of ATMEGA-16/32:

The output of the sensors is given as the input to the Microcontroller and the output of the Microcontroller is given to the motor driver (H-Bridge L293D). The flash of the Microcontroller is programmed accordingly.

The Passive Elements include resistors, capacitors and connecting wires. They are to be used accordingly.

Вам также может понравиться