drawing mobile robot

21
DRAWING MOBILE ROBOT Course: Advance Mechatronics Prepared By: Tejas Shanbhag (N10046848) Nisarg Patel (N12847809) Mansoor Musleh 1

Upload: others

Post on 19-Apr-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DRAWING MOBILE ROBOT

DRAWING MOBILE ROBOT

Course: Advance Mechatronics

Prepared By: Tejas Shanbhag (N10046848)

Nisarg Patel (N12847809)

Mansoor Musleh

1

Page 2: DRAWING MOBILE ROBOT

INDEX Sr No. Title Page Number

1. Abstract 3

2. Introduction (Theory) 3

3. Hardware Architecture for Robot Assembly 9

4. Software Architecture for Robot Assembly 11

5. Bill Of Material 12

6. Methods Of Driving 13

7. Applications of Robot 13

8. Codes for the Controllers 14

9. Conclusion 25

2

Page 3: DRAWING MOBILE ROBOT

ABSTRACT The Drawing Mobile Robot will be working on Arduino and Bluetooth module. The robot will take voice string from mobile or tablet and the controller will take the voice string and convert it into command. For example if we give command “1 feet forward” it will convert the “1” string value in integer valve and that value will be given to the delay in the code and the robot will move according to that delay and direction. We have incorporated four basic command i.e. Forward, Back, Right and Left.

Introduction

The project uses Bluetooth module and microcontroller.

1. Arduino UNO

2. Bluetooth Module (HC-05)

1 Arduino UNO Arduino Uno is a microcontroller board based on the ATmega328P . It has 14

digital input/output pins (of which 6 can be used as PWM outputs), 6 analog

inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header

and a reset button. It contains everything needed to support the microcontroller;

simply connect it to a computer with a USB cable or power it with a AC-to-DC

adapter or battery to get started.

1.1 Hardware Power Requirement: The Arduino Uno board can be powered via the USB

connection or with an external power supply. The power source is selected

automatically. The board can operate on an external supply from 6 to 20 volts. If

supplied with less than 7V, however, the 5V pin may supply less than five volts

and the board may become unstable. If using more than 12V, the voltage

regulator may overheat and damage the board. The recommended range is 7 to

12 volts.

Memory: The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It

also has 2 KB of SRAM (static random access memory) and 1 KB of EEPROM.

Input and output: Each of the 14 digital pins on the Uno can be used as an input

or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or

receive 20 mA as recommended operating condition and has an internal pull-up

resistor (disconnected by default) of 20-50k ohm. A maximum of 40mA is the

value that must not be exceeded on any I/O pin to avoid permanent damage to

the microcontroller.

3

Page 4: DRAWING MOBILE ROBOT

1.2 Software A program for Arduino may be written in any programming language with

compilers that produce binary machine code for the target processor. Atmel

provides a development environment for their microcontrollers, AVR Studio and

the newer Atmel Studio.

Mostly the programming is been done in C and C++ languages for easy human

computer interface.

1.3 Specification

Microcontroller ATmega328

Operating Voltage

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

DC Current per I/O Pin 40mA

DC Current for 3.3V Pin 50mA

Flash Memory 32 KB

SRAM 2KB

EEPROM 1 KB

Clock Speed 16 MHz

4

Page 5: DRAWING MOBILE ROBOT

1.1 Pin Diagram

2 Bluetooth 2.1 HC-05

The HC-05 Bluetooth Module has 6 pins- Vcc, GND, TX, RX, Key, and LED. It comes pre-programmed as a slave, so there is no need to connect the Key pin, unless you need it change it to Master Mode. The major difference between Master and Slave modes is that, in Slave mode the Bluetooth module cannot initiate a connection, it can however accept incoming connections. After the connection is established the Bluetooth module can transmit and receive data regardless of the mode it is running in. If you are using a phone to connect to the Bluetooth module, you can simply use it in the Slave mode. The default data transmission rate is 9600kbps.

2.2 Hardware Features o Typical -80dBm sensitivity. o Up to +4dBm RF transmit power. o to 5 V I/O. o PIO(Programmable Input/Output) control. o UART interface with programmable baud rate. o With integrated antenna. o With edge connector.

5

Page 6: DRAWING MOBILE ROBOT

2.3 Software Features

o Slave default Baud rate: 9600, Data bits:8, Stop bit:1,Parity:No parity. o Auto-connect to the last device on power as default. o Permit pairing device to connect as default.

o Auto-pairing PINCODE:”1234” as default

2.4 Pin Diagram

6

Page 7: DRAWING MOBILE ROBOT

HARDWARE ARCHITECTURE For Robot Assembly

7

Page 8: DRAWING MOBILE ROBOT

8

Page 9: DRAWING MOBILE ROBOT

SOFTWARE ARCHITECTURE For Robot

9

Page 10: DRAWING MOBILE ROBOT

• BILL OF MATERIALS

Sl. No Materials Quantity Amount($)

1. 12 V DC geared motor 4(200 rpm) 7

2. Arduino 1 26.72

3. Bluetooth (HC-05) 1 10.00

4. Metal boards for casing 1 14.55

5. 9 V DC battery 1 1.5

6. L298 MOTOR DIVER 1 6.89

7. Status LED ‘S 2 1.00

8. Fasteners 20 1.50

Method of Driving the Robot

Bluetooth Command Mode:

In these mode the Bluetooth module used will take the command from the user and will move according to that direction. The command given will be in the form of Forward, backward, right and left.

10

Page 11: DRAWING MOBILE ROBOT

Applications of the Robot

1.Technical drawing

2.Construction Sites

Technical drawing : we can use the robot for draw the technical drawing by giving the command from any of the android app.

Construction Sites : with the help of drawing robot we can mark on the site for further construction.

CODES FOR THE CONTROLLER

Bluetooth Mode

#include <SoftwareSerial.h>

#include<stdio.h>

#include<Servo.h>

#define IN1 2 //IN1

#define IN2 3 //IN2

#define E1 6 //ENA

#define E2 11 //ENB

#define IN3 4 //IN3

#define IN4 5

String up = "forward";

String down = "back";

String lef = "left";

String rig = "right";

String rec = "Square";

int a;

int b;

11

Page 12: DRAWING MOBILE ROBOT

int e;

SoftwareSerial BT(0,1); //TX, RX respetively

String readvoice;

Servo myservo;

void setup() {

BT.begin(9600);

Serial.begin(9600);

pinMode(2, OUTPUT);

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

pinMode(5, OUTPUT);

pinMode(E1, OUTPUT);

pinMode(E2, OUTPUT);

myservo.attach(8);

}

//-----------------------------------------------------------------------//

void loop() {

while (BT.available()){ //Check if there is an available byte to read

delay(10); //Delay added to make thing stable

char c = BT.read(); //Conduct a serial read

readvoice += c; //build the string- "forward", "reverse", "left" and "right"

}

if (readvoice.length() > 0) {

Serial.println(readvoice);

String command=readvoice;

12

Page 13: DRAWING MOBILE ROBOT

if(command[1] == 32){

a = command[0]-48;}

else{

a = (command[0] - 48)*10 + (command[1]-48);

}

Serial.println(a);

if(readvoice.endsWith(up))

{

servou();

delay(1000);

forward();

delay(650*a);

stopp();

servod();

readvoice=="";

}

else if(readvoice.endsWith(down))

{

servou();

delay(1000);

back();

delay(650*a);

stopp();

servod();

readvoice=="";

}

13

Page 14: DRAWING MOBILE ROBOT

else if (readvoice.endsWith(rig))

{

right();

delay(950);

stopp();

servou();

delay(1000);

forward();

delay(650*a);

stopp();

servod();

readvoice=="";

}

else if (readvoice.endsWith(lef))

{

left();

delay(950);

stopp();

servou();

delay(1000);

forward();

delay(700*a);

stopp();

servod();

14

Page 15: DRAWING MOBILE ROBOT

readvoice=="";

}

else if (readvoice=="stop")

{

stopp();

}

else if (readvoice.endsWith(rec)){

b = command[0]-48;

servou();

delay(1000);

forward();

delay(700*b);

stopp();

servod();

rectt(b);

rectt(b);

rectt(b);

readvoice=="";

}

readvoice="";}}

void forward(){ //move the robot forward

15

Page 16: DRAWING MOBILE ROBOT

analogWrite(E1, 120);

analogWrite(E2, 120);

digitalWrite(2, HIGH);

digitalWrite (3, LOW);

digitalWrite(4,HIGH);

digitalWrite(5,LOW);

delay(100);

}

void stopp(){ //stop the robot

digitalWrite (2, LOW);

digitalWrite (3, LOW);

digitalWrite (4, LOW);

digitalWrite (5, LOW);

delay (100);

}

void back(){ //move the robot back

analogWrite(E1, 120);

analogWrite(E2, 120);

digitalWrite(2, LOW);

digitalWrite(3, HIGH);

digitalWrite(4, LOW);

digitalWrite(5,HIGH);

delay(100);

16

Page 17: DRAWING MOBILE ROBOT

}

void right(){ //move the robot to the left

analogWrite(E1, 120);

analogWrite(E2, 120);

digitalWrite (2,HIGH);

digitalWrite (3,LOW);

digitalWrite (4,LOW);

digitalWrite (5,HIGH);

delay (100);

}

void left(){ //move the robot to the right

analogWrite(E1, 120);

analogWrite(E2, 120);

digitalWrite (2, LOW);

digitalWrite (3, HIGH);

digitalWrite (4, HIGH);

digitalWrite (5, LOW);

delay (100);

}

void servod(){

myservo.write(120); // moves the servo to 90 degree.

delay(700);

}

17

Page 18: DRAWING MOBILE ROBOT

void servou(){

myservo.write(20); // moves the servo to 90 degree.

delay(700);

}

void rectt(int e){

left();

delay(950);

stopp();

servou();

delay(1000);

forward();

delay(700*e);

stopp();

servod();

readvoice=="";

}

18

Page 19: DRAWING MOBILE ROBOT

}

19

Page 20: DRAWING MOBILE ROBOT

20

Page 21: DRAWING MOBILE ROBOT

Conclusion

With the help of Drawing Mobile Robot one can use the robot in multiple ways to perform the task. Robot can be given the command to move in any of the direction and it will move according to the command integer value in terms of feet . these robot can be used at construction sites, technical drawing and many more.

21