Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Dec50122 Embedded Robotics-Pw6

You are on page 1of 7

ELECTRICAL ENGINEERING DEPARTMENT

ACADEMIC SESSION: 1 2023/2024

DEC 50122 : EMBEDDED ROBOTICS

MOBILE ROBOT DESIGN: ANDROID BLUETOOTH


PRACTICAL WORK 6
ROBOT
PRACTICAL WORK
DATE :
LECTURER’S NAME:
GROUP NO. :
TOTAL
STUDENT ID & NAME : MARKS
(100%)

(1)

(2)

(3)

(4)

(5)

DATE SUBMIT : DATE RETURN :


1 LEARNING OUTCOMES (LO):

a. CLO3: manipulate the application of sensor and actuator, robot identification


and communication during practical work based on land mobile robot design
(P4, PLO5)

2 OBJECTIVE

By the end of this lab, students should be able to:

a. Describe the basic function of standard Arduino Microcontroller board

b. Configure the Arduino IDE to communicate with WIFI, Bluetooth and Radio
Frequency.

c. Write and execute the Arduino program

3 THEORY

Android controlled robot make use of an Android mobile phone for robotic control with
the help of Bluetooth technology. For this the android mobile user has to install an
application on her/his mobile. Then the user needs to turn on the Bluetooth in the
mobile. The wireless communication techniques used to control the robot is Bluetooth
technology. User can use various commands like move forward, reverse, stop move
left, and move right. These commands are sent from the Android mobile to the
Bluetooth receiver. Android based robot has a Bluetooth receiver unit which receives
the commands and give it to the microcontroller circuit to control the motors. The
microcontroller then transmits the signal to the motor driver IC’s to operate the
motors.

.
4 EQUIPMENT / TOOLS

a) Personal Computer / Laptop


b) Arduino Uno Board With Standard A/B Type - USB Cable
c) Bluetooth Module
d) DC Motor X 2
e) Motor Driver L298N
f) Android Phone
g) Wire kits

5 PROCEDURE

a) Construct the circuit as shown below:

b) Connect the board to the PC using the USB cable and open the Arduino IDE
program and then write the following code

int motor1Pin1 = 12;

int motor1Pin2 = 11;

int motor2Pin1 = 10;

int motor2Pin2 = 9;

int state;

int flag=0; //makes sure that the serial only prints once the state

int stateStop=0;

void setup() {
// sets the pins as outputs:

pinMode(motor1Pin1, OUTPUT);

pinMode(motor1Pin2, OUTPUT);

pinMode(motor2Pin1, OUTPUT);

pinMode(motor2Pin2, OUTPUT);

Serial.begin(9600);

void loop() {

//if some date is sent, reads it and saves in state

if(Serial.available() > 0){

state = Serial.read();

flag=0;

// if the state is '1' the DC motor will go forward

if (state == '1') {

digitalWrite(motor1Pin1, HIGH);

digitalWrite(motor1Pin2, LOW);

digitalWrite(motor2Pin1, LOW);

digitalWrite(motor2Pin2, HIGH);

if(flag == 0){

Serial.println("Go Forward!");

flag=1;

// if the state is '2' the motor will turn left

else if (state == '2') {


digitalWrite(motor1Pin1, HIGH);

digitalWrite(motor1Pin2, LOW);

digitalWrite(motor2Pin1, LOW);

digitalWrite(motor2Pin2, LOW);

if(flag == 0){

Serial.println("Turn LEFT");

flag=1;

delay(1500);

state=3;

stateStop=1;

// if the state is '3' the motor will Stop

else if (state == '3' || stateStop == 1) {

digitalWrite(motor1Pin1, LOW);

digitalWrite(motor1Pin2, LOW);

digitalWrite(motor2Pin1, LOW);

digitalWrite(motor2Pin2, LOW);

if(flag == 0){

Serial.println("STOP!");

flag=1;

stateStop=0;

// if the state is '4' the motor will turn right

else if (state == '4') {

digitalWrite(motor1Pin1, LOW);

digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);

digitalWrite(motor2Pin2, HIGH);

if(flag == 0){

Serial.println("Turn RIGHT");

flag=1;

delay(1500);

state=3;

stateStop=1;

// if the state is '5' the motor will Reverse

else if (state == '5') {

digitalWrite(motor1Pin1, LOW);

digitalWrite(motor1Pin2, HIGH);

digitalWrite(motor2Pin1, HIGH);

digitalWrite(motor2Pin2, LOW);

if(flag == 0){

Serial.println("Reverse!");

flag=1;

//For debugging purpose

//Serial.println(state);

c) Click in the Verify button to make sure there are no compile time errors in the
code. Then, Click on the Upload button on the IDE to upload the code . Please
make sure to disconnect the Bluetooth module before you upload the code.
d) Download apps Arduino Bluetooth Controller.
e) Reconnect Bluetooth Module, then pairing the module with Arduino Bluetooth
Controller
f) Then, setting the controller regarding the program
g) Observe and discuss the result.

6 RESULT

Make a screenshot for every task by using Proteus/TinkerCad


Take the photo for each sketch
Show all the code that you created.

7 DISCUSSION

Explain detail the operation of your Android Bluetooth Robot and state the limitation of
bluetooth communication.

8 CONCLUSION

By using your own words, make a conclusion to summarize the results obtained
from this practical activity. You may also specify any technical solutions to the
unexpected problems or errors which occurred during the process.

You might also like