Thursday, 19 December 2013

Line + Obstacle avoidance Robot using microcontroller (AT89C51)


      In most college fest the common competition's are line following robot, obstacle detector/avoidance robot or maze solving robot so i need a robot which can perform such operations hence i made this. it operates on two modes 1st line following mode or 2nd is obstacle detecting/avoiding mode. mode can be selected by SPDT switch.

circuit diagram:



         in mode 1 the sensor circuit detect black line and follow it. the sensor circuit placed in board. in mode 2 the circuit detect obstacle the sensor for detecting obstacle is placed front side of robot. for obstacle detection you need IR module(you can easily buy from store)  or you can use any distance sensor. connect the sensor module the jumper J4 & J5 (see in circuit diagram)


 working of circuit


1. LM324 OP-AMP comparator


    
        It compare the output of sensor to the reference voltage. reference voltage can be change by preset. after comparing it generates square signal which act as input to micro-controller. with the help of LM324 you can change the sensitivity of the circuit.....

2. Motor Drive L293D



       Motor drive is use to provide power and control the motor. it has 4 input at pin 2,7,10,15. motor connected between pin 2&7 and 2nd motor between 15&10. when the pin 2 is high motor rotates clockwise and when pin 7 is high it rotate anti-clockwise. same for motor 2 pin 15 = clockwise, pin 10= anti-clockwise.


3. Micro-Controller AT89C51


      
     AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (PEROM) and 128 bytes of RAM. It can be erased and program to a maximum of 1000 times.
      In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports are 8-bit bi-directional ports, i.e., they can be used as both input and output ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-ups. When 1s are written to these port pins, they are pulled high by the internal pull-ups and can be used as inputs. These ports are also bit addressable and so their bits can also be accessed individually. 
Port P0 and P2 are also used to provide low byte and high byte addresses, respectively, when connected to an external memory. Port 3 has multiplexed pins for special functions like serial communication, hardware interrupts, timer inputs and read/write operation from external memory. AT89C51 has an inbuilt UART for serial communication. It can be programmed to operate at different baud rates. Including two timers & hardware interrupts, it has a total of six interrupts. 



Program for Micro-Controller in Assemble language using RIDE51 Compiler.


$MOD51
                                  ORG 0000H
                                  LJMP MAIN
                                  ORG 0030H
MAIN:                          SETB P3.0 ;Input for left sensor
                                  SETB P3.1 ;Input for right sensor
AGAIN:                         JNB P3.0,NEXT
                                  JNB P3.1,GO
                                  CLR P2.0
                                  SETB P2.1
                                  CLR P2.2
                                  SETB P2.3
                                  SJMP AGAIN
GO:                             CLR P2.0
                                  SETB P2.1
                                  CLR P2.2
                                  CLR P2.3
                                  SJMP AGAIN
NEXT:                          JNB P3.1,GO1                              
                                  CLR P2.0
                                  CLR P2.1
                                  CLR P2.2
                                  SETB P2.3
                                  SJMP AGAIN
GO1:                           CLR P2.0
                                  CLR P2.1
                                  CLR P2.2
                                  CLR P2.3
                                  SJMP AGAIN
HERE:                          SJMP HERE
                                   END


PCB layout 




REAL PCB 3D MODEL 




1 comment: