MPMC PRJ Report 108122090, 108122092

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

NATIONAL INSTITUTE OF TECHNOLOGY

Electronics and
Communications Engineering
ECLR13 MICROPROCESSOR AND MICROCONTROLLER
LABORATORY

LAB MINI PROJECT:


Bluetooth based robot by interfacing of Bluetooth
module HC-05 with microcontroller 8051

SUBMITTED BY: ROHIT GUNASEKARAN 108122092


RITESH KUMAR SINGH 108122090

SUBMITTED TO:

DR. SRINIVASULU JOGI


Problem Statement:

The objective of this project is to design a Bluetooth based robot by


interfacing of Bluetooth module HC-05 with microcontroller 8051

Theory -

Our project entails the development of a Bluetooth-controlled robot


that can be operated remotely via a mobile phone without the need for
a physical connection. The first step involves programming an interface
between an 8051 microcontroller and an LCD display. This interface will
facilitate the display of instructions being sent to the robot, ensuring
clarity and ease of operation.

To enable wireless control, we integrate a Bluetooth HC-05 module with


the 8051 microcontrollers. Through this module, data transmission
occurs wirelessly between the mobile device and the robot. Commands
such as "F" for forward, "B" for backward, "L" for left, "R" for right, and
"S" for stop are transmitted to the robot from the mobile device.

Additionally, to establish communication between two Bluetooth


modules without physical wiring, we utilize pairing software such as
Virtual Serial Port Emulator (VSPE). This software pairs the COM1 and
COM2 ports of the Bluetooth modules, enabling seamless data
exchange between them.
For the physical movement of the robot according to the received
instructions, a motor driver is employed. The output from the 8051
microcontroller provides continuous bidirectional direct current to the
motor driver, which in turn controls the motion of the robot based on
the instructions received from the virtual terminal.

By integrating these components and functionalities, our project aims


to create a versatile and user-friendly Bluetooth-controlled robot
capable of executing various commands wirelessly, enhancing its
usability and practicality in diverse applications.

Components:

1.Bluetooth module (HC-05):


The HC-05 is a widely used Bluetooth module that enables
wireless communication between electronic devices. It operates
on the Bluetooth 2.0 standard and is known for its simplicity and
reliability. The module supports various Bluetooth profiles,
including the Serial Port Profile (SPP), making it easy to establish
a serial communication link between a microcontroller or other
embedded system and a smartphone or computer.
Hardware Features
● Typical ‐80dBm sensitivity.
● Up to +4dBm RF transmit power.
● 3.3 to 5 V I/O.
● PIO(Programmable Input/Output) control.
● UART interface with programmable baud rate.
● With integrated antenna.
● With edge connector.
PIN CONFIGRATION 0F HC-05

2. 8051 Microcontroller: The 8051 microcontroller is a popular microcontroller


that is widely used in embedded systems. It is a low-power, high-performance
microcontroller that has a wide range of applications.

8051 is an 8 – bit Microcontroller i.e. the data bus of the 8051 Microcontroller
(both internal and external) is 8 – bit wide. It is a CISC based Microcontroller with
Harvard Architecture (separate program and data memory).

Since the basic layout of a microcontroller includes a CPU, ROM, RAM, etc. the
8051 microcontroller also has a similar layout. The following image shows a brief
layout of a typical 8051 Microcontroller.
8051 Microcontroller Features

● 8 – Bit ALU: ALU or Arithmetic Logic Unit is the heart of a microcontroller. It


performs arithmetic and bitwise operations on binary numbers. The ALU in
8051 is an 8 – Bit ALU i.e. it can perform operations on 8 – bit data.
● 8 – Bit Accumulator:The Accumulator is an important register associated
with the ALU. The accumulator in 8051 is an 8 – bit register.
● RAM: 8051 Microcontroller has 128 Bytes of RAM which includes SFRs and
Input / Output Port Registers.
● ROM: 8051 has 4 KB of on-chip ROM (Program Memory).
● I/O Ports: 8051 has four 8 – bit Input / Output Ports which are bit addressable
and bidirectional.
● Timers / Counters: 8051 has two 16 – bit Timers / Counters.
● Serial Port: 8051 supports full duplex UART Communication.
● External Memory: 8051Microcontroller can access two 16 – bit address lines
at once: one each for RAM and ROM. The total external memory that an
8051 Microcontroller can access for RAM and ROM is 64KB (216 for each
type).
● Additional Features: Interrupts, on-chip oscillator, Boolean Processor,
Power Down Mode, etc.
PIN DIAGRAM OF 8051-

3-L293D- L293d IC is known as a motor driver. It is a low voltage operating


device like other ICs. The other ICs could have the same functions like L293d but
they cannot provide the high voltage to the motor. L293d provides the continuous
bidirectional Direct Current to the Motor. The Polarity of current can change at any
time without affecting the whole IC or any other device in the circuit.
4-LM016L-16×2 LCD is named so because; it has 16 Columns and 2 Rows.
There are a lot of combinations available like, 8×1, 8×2, 10×2, 16×1, etc. but
the most used one is the 16×2 LCD. So, it will have (16×2=32) 32 characters
in total and each character will be made of 5×8 Pixel Dots.

PIN CONFIGURATION -

• 1-Pin1 (Ground/Source Pin): This is a GND pin of display, used to connect the GND
terminal of the microcontroller unit or power source.
• 2-Pin2 (VCC/Source Pin): This is the voltage supply pin of the display, used to
connect the supply pin of the power source.
• 3-Pin3 (V0/VEE/Control Pin): This pin regulates the difference of the display, used
to connect a changeable POT that can supply 0 to 5V.
• 4-Pin4 (Register Select/Control Pin): This pin toggles among the command or data
register, used to connect a microcontroller unit pin and obtains either 0 or 1(0 = data
mode, and 1 = command mode).
• 5-Pin5 (Read/Write/Control Pin): This pin toggles the display among the read or
writes operation, and it is connected to a microcontroller unit pin to get either 0 or 1
(0 = Write Operation, and 1 = Read Operation).
• 6-Pin 6 (Enable/Control Pin): This pin should be held high to execute the Read/Write
process, and it is connected to the microcontroller unit & constantly held high.
• 7-Pins 7-14 (Data Pins): These pins are used to send data to the display. These
pins are connected in two-wire modes like 4-wire mode and 8-wire mode. In 4-wire
mode, only four pins are connected to the microcontroller unit like 0 to 3, whereas
in 8-wire mode, 8-pins are connected to microcontroller unit like 0 to 7.
• 8-Pin15 (+ve pin of the LED): This pin is connected to +5V
• 9-Pin 16 (-ve pin of the LED): This pin is connected to GND.
Circuit Diagram:

➢ Software used for coding-keil uvision5


➢ Software used for circuit design-Proteus 8
➢ Language used for coding- Embedded C

Embedded C Program
//CODE of lcd interfacing with 8051 microcontroller

#include<reg51.h> lcd_str(" Robot FORWARD ");


void delay(unsigned int i); }
void lcd_cmd(unsigned char a); else if(x == 'B')
void lcd_data(unsigned char b); {
void lcd_init(void); m11=0;
void lcd_str(unsigned char *str); m12=1;
void sendser_char(unsigned char b); m21=0;
void sendser_str(unsigned char *str); m22=1;
sbit rs=P2^0; lcd_cmd(0xc0);
sbit en=P2^1; lcd_str(" Robot BACKWARD ");
sbit m11=P2^2; }
sbit m12=P2^3; else if(x== 'L')
sbit m21=P2^4; {
sbit m22=P2^5; m11=0;
sfr ldata=0x90;//port1 m12=1;
unsigned char x; m21=1;
void main() m22=0;
{ lcd_cmd(0xc0);
TMOD=0x20;//timer1 mode2 -auto reload mode lcd_str(" Robot LEFT ");
TH1=0xfd;//9600 baud rate
SCON=0x50;//8bit data ,1start bit,1stop bit
TR1=1; }
lcd_init(); else if(x=='R')
lcd_str(" WELCOME TO "); {
lcd_cmd(0xc0); m11=1;
lcd_str(" MY PROJECT "); m12=0;
delay(65000); m21=0;
lcd_cmd(0x01); m22=1;
lcd_cmd(0x80); lcd_cmd(0xc0);
lcd_str(" NITT ECE "); lcd_str(" Robot RIGHT ");
lcd_cmd(0xc0);
lcd_str(" MPMC ");
delay(65000); }
lcd_cmd(0x01); else if(x=='S')
lcd_cmd(0x80); {
lcd_str(" BT ROBOT "); m11=1;
sendser_str("Enter KEY"); m12=1;
while(1) m21=1;
{ m22=1;
while(RI==0);//F,B,L,R lcd_cmd(0xc0);
RI=0; lcd_str(" Robot STOP ");
x=SBUF; }else{
if(x == 'F') }}}
{ void lcd_init()
m11=1; {lcd_cmd(0x38);
m12=0; lcd_cmd(0x0c);
m21=1; lcd_cmd(0x01);
m22=0; lcd_cmd(0x80);}
lcd_cmd(0xc0); void delay(unsigned int i)
{ }
unsigned int j; void lcd_str(unsigned char *str)
for(j=0;j<i;j++); {
} while(*str)
void lcd_cmd(unsigned char a){ {
rs=0;//cmd lcd_data(*str++);
ldata=a; }}
en=1; void sendser_char(unsigned char b)
delay(5); {
en=0; SBUF=b;
delay(5); while(TI==0);
} TI=0;
void lcd_data(unsigned char b) }
{ void sendser_str(unsigned char *str)
rs=1;//data {
ldata=b; while(*str)
en=1; {
delay(5); sendser_char(*str++);
en=0; }}
delay(5);

RESULT -

➢ BLUETOOTH ROBOT -
➢ MOVING FORWARD –

➢ MOVING BACKWARD-
➢ MOVING LEFT -

➢ MOVING RIGHT -
➢ STOP

Hence the Bluetooth module has been successfully interfaced


with 8051 microcontroller.

Working video of our simulation is attached below:


https://drive.google.com/file/d/163kU3jo6k8MemWUUTHvf-
darr_PZeO23/view?usp=drive_link
THANK
YOU

You might also like