ROBOT MOTION

15
ROBOT MOTION SUBMITTED BY : Y.NAVYA VANI (NIT DURGAPUR)

Transcript of ROBOT MOTION

Page 1: ROBOT    MOTION

ROBOT MOTION

SUBMITTED BY :

Y.NAVYA VANI

(NIT DURGAPUR)

ROBOT MOTION

Page 2: ROBOT    MOTION

AIM:

To control the motions of a robot using a wireless communication (Bluetooth) device.

INTRODUCTION:

By using a Bluetooth we can control the actions of a robot by asking it to move forward , or backward or even reverse by giving certain user defined commands to it. But a small drawback of using this Bluetooth device is we cannot communicate if the distance is too long.

BLOCK DIAGRAM:

COMPONENTS REQUIRED:

Micro controller 8051

Lcd(liquid crystal display)

Bluetooth(represented as virtual terminal in circuit diagram)

L293D

Battery of 9v

2 Motors

DESCRIPTION:

MICRO-CONTROLLER: A micro controller is a single chip VLSI unit which , although having limited computational capabilities possess enhanced input/output capability and a number of on chip functional units. They are particularly used in embedded systems for real time control applications with on chip program memory and devices.

LCD: LCD is used display numbers , characters, and some special symbols also. Using its data lines we can send our required data which has to be displayed. It consists of 16-pins.

LCD

LCD

L293DM

1

M

2

Page 3: ROBOT    MOTION

Bluetooth: It’s a communication technology . It acts as major role in embedded systems for wireless communication.

CIRCUIT DIAGRAM:

WORKING:

Actually we need app named ARDUINO BLUETOOTH ( in the form of app in mobile phone)inorder to control the actions of a robot by asking it to move forward ,or backward or even reverse by giving certain user defined commands to it. First of all, we allot the user defined commands to that device which we define in our code. As in the given code we gave the instruction for that particular symbol for movement of motors. Here in the lcd we can visualize the motion of the robot on the form of motors.

RESULT:

Here we can see different kind of motion of a robot using motors.

Forward motion of a robot can be done by giving a command *f# (as we have pre mentioned in the program)

Page 4: ROBOT    MOTION

To make the robot to move backward we shall give command*b#( as we have pre-mentioned in the program)

To make the robot to rotate right we shall give a command as *r#(as a message)(we have pre-mentioned it in the program)

Page 5: ROBOT    MOTION

To make the robot to rotate to its left side we can send a message *l#(as we have pre-mentioned in the program ).

To stop the robot motion we have to send a message *s#(as we have pre-mentioned it in kthe program).

Page 6: ROBOT    MOTION

CONCLUSION:

By using the wireless communication, we can control the movements of robot. There is no need of any switches, ……. and so on to operate the robot.

PROGRAM:

#include<reg51.h>

#define lcd P2

sbit m1a=P1^0;

sbit m1b=P1^1;

sbit m2a=P1^2;

sbit m2b=P1^3;

sbit sw1=P1^4;

sbit RS=P2^0;

sbit EN=P2^1;

void lcdcmd(unsigned int x);

void lcddata(unsigned char y);

void display(unsigned char b[]);

void delay(unsigned int time);

Page 7: ROBOT    MOTION

void init()

{

lcdcmd(0x30);

delay(5);

lcdcmd(0x30);

delay(5);

lcdcmd(0x30);

delay(5);

lcdcmd(0x02);

delay(5);

lcdcmd(0x28);

delay(5);

lcdcmd(0x0E);

delay(5);

lcdcmd(0x06);

delay(5);

lcdcmd(0x01);

delay(5);

}

void lcdcmd(unsigned int x)

{

lcd=x;

RS=0;

delay(5);

EN=1;

delay(5);

EN=0;

Page 8: ROBOT    MOTION

delay(5);

lcd=x<<4;

RS=0;

delay(5);

EN=1;

delay(5);

EN=0;

delay(5);

}

void lcddata(unsigned char y)

{

lcd=y;

RS=1;

delay(5);

EN=1;

delay(5);

EN=0;

delay(5);

lcd=y<<4;

RS=1;

delay(5);

EN=1;

delay(5);

EN=0;

delay(5);

}

void display(unsigned char b[])

Page 9: ROBOT    MOTION

{

int i=0;

for(i=0;b[i]!='\0';i++)

{

lcddata(b[i]);

}

}

void delay(unsigned int time)

{

unsigned int i,j;

for(i=0;i<=time;i++);

for(j=0;j<=1275;j++);

}

unsigned char receive();

void serinit()

{

SCON=0x50;

TMOD=0x20;

TH1=0xFD;

TR1=1;

}

/*void sertx(unsigned char *TX)

{

for( ;*TX!='\0';*TX++)

{

SBUF=*TX;

while(TI==0);

Page 10: ROBOT    MOTION

TI=0;

}} */

/*void ssertx(unsigned char t)

{SBUF=t;

while(TI==0);

TI=0;

} */

unsigned char receive()

{

unsigned char rx;

while (RI==0);

rx=SBUF;

RI=0;

return rx;

}

/*void okcheck()

{

unsigned char Rx;

do

{

Rx=receive();

}while(Rx!='K');

}

void func()

{

unsigned char Rx;

sertx("AT");

Page 11: ROBOT    MOTION

okcheck();

sertx("AT+CMGD=1");

okcheck();

sertx("AT+CNMI=1,2,0,0");

okcheck();

sertx("AT+CMGS=\"9490660968\"");

do

{

Rx=receive();

}while(Rx!='>');

} */

void main()

{

unsigned char ry[3];

int i;

P1=0x00;

init();

serinit();

lcdcmd(0x01);

lcdcmd(0x80);

display("welcome");

while(1)

{

do

Page 12: ROBOT    MOTION

{

ry[0]=receive();

}while(ry[0]!='*');

for(i=1;i<3;i++)

{

ry[i]=receive();

}

if(ry[1]=='f')

{

m1a=1;m1b=0;m2a=0;m2b=1;

lcdcmd(0x01);

lcdcmd(0x80);

display("forward");

}

else

if(ry[1]=='b')

{

m1a=0;m1b=1;m2a=1;m2b=0;

lcdcmd(0x01);

lcdcmd(0x80);

display("backward");}

else

if(ry[1]=='r')

{

m1a=0;m1b=0;m2a=0;m2b=1;

lcdcmd(0x01);

Page 13: ROBOT    MOTION

lcdcmd(0x80);

display("right");

}

else

if(ry[1]=='l')

{

m1a=1;m1b=0;m2a=0;m2b=0;

lcdcmd(0x01);

lcdcmd(0x80);

display("left");

}

else

if(ry[1]=='s')

{

m1a=0;m1b=0;m2a=0;m2b=0;

lcdcmd(0x01);

lcdcmd(0x80);

display("stop");

}

} }