You are on page 1of 18

MICRO CEA

MICROPROCESSOR AND MICROCONTROLLER

DEPARTMENT OF ELECTRICAL ENGINEERING


AIR UNIVERSITY, ISLAMABAD

COMPLEX ENGINEERING ACTIVITY


GROUP MEMBERS
MUHAMMAD AHMED (180660)

AFAQ GUL WASEEM (180616)

MOEENA JAMAL (181807) (SUBMITTED BY)

SUBMITTED TO
MAM ANUM ZULQARNAIN

SECTION
BEET 5B

DATE
12/25/2020

1|P ag e
MICRO CEA

TASK STATEMENT

A maze solving robot is designed to move in a maze and escape through it by following different
paths. A maze solving robot is quite similar to a line follower. Like a line follower has to follow
black strip lines, a maze follower finds a path and starts following it until it finds an escape route.

INTRODUCTION

A Robot is any machine which is completely automatic, i.e. it starts on its own, decides its own
way of work and stops on its own. It is actually a replica of human being, which has been designed
to ease human burden. It can be controlled pneumatically or using hydraulic ways or using the
simple electronic control ways. Robots can be fixed robots or mobile robots. Mobile Robots are
robots with a mobile base which makes the robot move freely in the environment. One of the
advanced mobile robots is the Line Follower Robot. It is basically a robot which follows a
particular path or trajectory and decides its own course of action which interacts with obstacle.
The path can be a black line on the white floor (visible) or a magnetic field (invisible). Its
applications start from basic domestic uses to industrial uses, etc. The present condition in industry
is they are carrying the parcels or materials one place to another place using the crane system.
Sometimes lifting of big weights at that time may cause the breakage of lifting materials and will
be cause damage to the parcels also. The line following robots is commonly used for carry children
through shopping malls, homes, entertainment places, industries. The use of line following robotic
vehicle is transport the materials from one place to another place in the industries. This robot
movement completely depends on the track. The robot can do anything you set them to do. Like
in factories all they have to do with making their products is make the robot.

However, a line following robot is a robot which follows a certain path controlled by a feedback
mechanism. Basically, line follower robot is a mobile machine that can detect and follow the line
drawn on the floor. Generally, the path is predefined and can be either visible like a black line on
a white surface with a high contrasted color or it can be invisible like a magnetic field. Definitely,
this kind of robot should sense the line with its infrared ray (IR) sensors that installed under the

2|P ag e
MICRO CEA

robot. After that, the data is transmitted to the processor by specific transition buses. Hence, the
processor is going to decide the proper commends and then it sends them to the driver and thus
the path will be followed by the line follower robot. Building a basic Line Follower Robot involves
the following steps.

 Designing the mechanical part or the body of the robot


 Defining the kinematics of the robots
 Designing the control of the robot

For our CEP, we only need to understand the control of the robot. The control of the robot is the
most important aspect of its working. Here the term control refers to the robot motion control,
i.e. controlling the movement of the wheels. A basic line follower robot follows certain path and
the motion of the robot along this path is controlled by controlling the rotation of wheels, which
are placed on the shafts of the two motors. So, the basic control is achieved by controlling the
motors. The control circuitry involves the use of sensors to sense the path and the microcontroller
or any other device to control the motor operation through the motor drivers, based on the sensor
output. However, there are two ways of controlling a line following robot

1. Without using Microcontrollers


2. With using Microcontrollers

As per our course and complex engineering problem, we are concerned with the control using
microcontrollers.

3|P ag e
MICRO CEA

APPLICATIONS

• Industrial Applications:
These robots can be used as automated equipment carriers in industries replacing traditional
conveyer belts.

• Automobile applications:
These robots can also be used as automatic cars running on roads with embedded magnets.

• Domestic applications:
These can also be used at homes for domestic purposes like floor cleaning etc.

• Guidance applications:
These can be used in public places like shopping malls, museums etc to provide path
guidance.

DESIGN
This circuit mainly consists of 8051 microcontroller, 4 IR sensors, 2 motors and motor driver IC
(l298N module). The line follower robot needs mechanical arrangement of the chassis. we have
used a 2WD Acrylic chassis. Four IR sensors are mounted on the front of the robot facing towards
Earth.
When robot is placed on the fixed path, it follows the path by detecting the line. The robot
direction of motion depends on the sensors outputs. When the middle two sensors are on the line
of path and corner sensors are on white surface, robot moves forward. If the left corner sensor
gives zero (i.e. there is left turn), robot moves towards left. Similarly, If the right corner sensor
gives zero (i.e. there is right turn), robot moves towards right. But we are giving left turn priority
i.e. whenever left and right or left and straight paths come, robot will turn left.

4|P ag e
MICRO CEA

Line Follower Robot Circuit Diagram and 8051 Code:


As we are using four IR sensor module that we connect on the port1 4pins and the remaining
four pins are ground using bit masking and the command use for this purpose is anl command
in the software and we take four output from the port 2 which is connected to motor driver IC
L298 which provide two motors sufficent current to drive as micro-controller only provide
minimum value of current.

Motor Driver IC L298:


As we know that micro-controller supply small amount of current which in not sufficient to drive
these two motor so we have to take the help of the motor driver IC L298 which has two H-bridge
which supply enough amount of current to the motor to turn it on both side forward as well as
backward.

5|P ag e
MICRO CEA

The table according to which we control the speed of our motor according to our design.

6|P ag e
MICRO CEA

LINE FOLLOWER
Programming Code:
#include<reg52.h>

sbit s1=P2^1; \\ Address to bit addressable special function register for pin 2.1

sbit s2=P2^2; \\ Address to bit addressable special function register for pin 2.2

sbit MP_1 = P3^0; \\ Address to bit addressable special function register for pin 3.0

sbit MP_2 = P3^1; \\ for pin 3.1

sbit MP_3 = P3^2; \\ for pin 3.2

sbit MP_4 = P3^3; \\ for pin 3.3

void main ()

s1=0; \\0 value at s1 register

s2=0; \\0 value at s2 register

P3=0x00;

while(1) \\while-loop execution until conditions meet

if((s1==0)&(s2==0)) \\ if condition when pin 2.1 work, and pin2.2 not work

{ \\ if these conditions are met, then the car moves straight

MP_1 = 1;

MP_2 = 0;

MP_3 = 1;

MP_4 = 0;

7|P ag e
MICRO CEA

else if((s1==0)&(s2==1))

{ \\ If these conditions are met, then robot moves left

MP_1 = 1;

MP_2 = 0;

MP_3 = 0;

MP_4 = 0;

else if((s1==1)&(s2==0))

{ \\ If these conditions are met, the robot moves right

MP_1 = 0;

MP_2 = 0;

MP_3 = 1;

MP_4 = 0;

else if((s1==1)&(s2==1))

{ \\ if these conditions are met, the robot moves straight

MP_1 = 0;

MP_2 = 0;

MP_3 = 0;

MP_4 = 0;

8|P ag e
MICRO CEA

SCREENSHOTS

9|P ag e
MICRO CEA

PROTEUS CIRCUIT

10 | P a g e
MICRO CEA

MAZE FOLLOWER
Programming Code:

org 00h

main:

mov p1,#0ffh \\ move 0ff hexadecimal to register p1

mov p2,#0h \\ move 0h hexadecimal to register p2

mov A,0fh \\ move 0ffh to a register A

anl A,P2 \\ anl instruction to read from output latch for p2

cjne A,#0,a1 \\ first compare, then jump if not equal for A and a1

jmp left \\ Jumps the program to left label

a1:

cjne A,#01,a2 \\ first compare, then jump if not equal for A and a2

jmp left \\ again, jump to ‘left’ label

a2:

cjne A,#02,a3 \\ first compare, then jump if not equal for A and a3

jmp left \\ jump to ‘left’ label

a3:

cjne A,#03,a4 \\ first compare, then jump if not equal for A and a4

jmp left \\ jump to ‘left’ label

a4:

cjne A,#04,a5 \\ first compare, then jump if not equal for A and a5

jmp left \\ Jump to ‘left’ label

a5:

11 | P a g e
MICRO CEA

cjne A,#05,a6 \\ first compare, then jump if not equal for A and a6

jmp left \\ Jump to ‘left’ label

a6:

cjne A,#06,a7 \\ first compare, then jump if not equal for A and a7

jmp left \\ jump to ‘left’ label

a7:

cjne A,#07,a8 \\ first compare, then jump if not equal for A and a8

jmp left \\ jump to ‘left’ label

a8:

cjne A,#15,a15 \\ first compare, then jump if not equal for A and a15

jmp left \\ Jump to ‘left’ label

a15:

cjne A,#8,a9 \\ first compare, then jump if not equal for A and a9

jmp right \\ Jump to ‘right’ label

a9:

cjne A,#9,a10 \\ first compare, then jump if not equal for A and a10

jmp straight \\ Jump to ‘straight’ label

a10:

cjne A,#10,a11 \\ first compare, then jump if not equal for A and a11

jmp right \\ Jump to ‘right’ label

a11:

cjne A,#11,a12 \\ first compare, then jump if not equal for A and a12

jmp straight \\ Jump to ‘straight’ label

a12:

cjne A,#12,a13 \\ first compare, then jump if not equal for A and a13

12 | P a g e
MICRO CEA

jmp right \\ Jump to ‘right’ label

a13:

cjne A,#13,a14 \\ first compare, then jump if not equal for A and a14

jmp straight Jump to ‘straight’ label

a14:

cjne A,#14,a15 \\ first compare, then jump if not equal for A and a1

jmp straight \\ Jump tp straight label

jmp main \\ Jump to main

left: \\ Label ‘left’

mov p2,#01h

call delay \\ Delay

call delay \\ Delay

mov p2,#0

call delay

jmp main \\ Jump to ‘main’ label

right: \\ label ‘right’

mov p2,#04h

call delay \\ delay

call delay

mov p2,#0

call delay

jmp main \\ jump to ‘main’ label

straight: \\ label ‘straight’

13 | P a g e
MICRO CEA

mov p2,#0Ah

call delay \\delay

call delay

mov p2,#0

call delay

jmp main \\ jump to main

delay:

mov r2,#5

loop3:

mov r0,#250 \\ move 250 hexadecmial tp register r0

loop1:

mov r1,#250

loop2:

djnz r1,loop2 \\ decrement and jump to loop2 if not zero

djnz r0,loop1 \\ decrement and jump to loop1 if not zero

djnz r2,loop3 \\ decrement and jump to loop3 if not zero

ret

14 | P a g e
MICRO CEA

SCREENSHOTS

15 | P a g e
MICRO CEA

16 | P a g e
MICRO CEA

PROTEUS CIRCUIT

CONCLUSION
In this CEP, we learnt

 How to use micro-controller to control the speed of the motor as well as direction of robot
car.
 We learnt to use assembly language in micro-controller to perform different tasks such as
made a maze solving robot in this task.
 Also we can perform verity of tasks using AT89C51 (8051) microcontroller.
 The construction of the maze solving robot was simple in terms of paper and pencil.
However, simulation was far more difficult than anticipated before we started the project,
but we managed to construct it and reach our goal. The resulted measured data supports
our expected result. We successfully construct maze solving robot with the help of
assembly language. Our data could have been improved if we had an on campus facility
for accommodation. But we hope that, for this robot, a new experiment will be added to
laboratory. We are happy that finally we able to fulfill the demand of the students.

17 | P a g e
MICRO CEA

18 | P a g e

You might also like