Practical Work 6
Practical Work 6
LECTURER : 2.
3.
GROUP MEMBERS NAME REGISTRATION NUMBER
STUDENT 1 1.
STUDENT 2 2.
STUDENT 3 3.
STUDENT 4 4.
80%
@Sesi 2:2022
B. LAB REPORT ASSESSMENT
SCORE
Excellent Good Average Weak Very Weak
SCALE SCORE
ASPECT 5 4 3 2 1
Able to write Able to write Able to write Write discussion Discussion was
discussion discussion with discussion with not related not written
clearly related clearly related to related to to practical work clearly and was X1
to practical work practical work practical work objective unrelated to
Discussion objective. Use objective objective the practical
good and work
appropriate objective.
language in
writing
Accurate Accurate A statement of A statement of No conclusion
statement of the statement of the the results of the the results of the included or
results of the lab results of the lab lab indicates lab indicates shows little X1
Conclusion indicates indicates whether results whether results effort and
whether results whether results support the support the reflection on
support the support the hypothesis hypothesis the lab
hypothesis hypothesis
Excellent. All- Almost of the Almost of the Some of the Incomplete/
important results have results have results are incorrect
trends have been correctly been correctly misinterpreted interpretation.
been interpreted and interpreted and and there is no Not answer
interpreted discussed. some correctly clear answer to the question
Question X2
correctly and Answer the answer the the question
discussed. question question
Answer the correctly
question
correctly.
20%
STUDENTS S1 S2 S3 S4
CLO3, P4
OUTCOMES : Upon completion the task, students should be able to:
i) Make Bluetooth HC-05 sensor to communicate with android and Arduino.
ii) Build Arduino program to control wireless mobile robot.
EQUIPMENTS / COMPONENTS:
ARDUINO UNO Board and DC motors, L298 motor driver, Bluetooth HC-05 sensor
and android smart phone.
The HC-05 Bluetooth module is the most economical and easiest way to go wireless (via Bluetooth).
This module makes it easy for you to wirelessly extend your serial interface, so you can control any
program running on your Laptop/android/hand phone with serial port interface.
Usually this Bluetooth module is used with the Arduino, but it can be used with others
microcontrollers devices. Here it’s how it’s wired with an Arduino:
3
Figure 1: Bluetooth Module Connection to Arduino Board
3
2
**Notes:
1. Disconnect power HC-05 power connection before uploading program to the Arduino board.
2. The LED on the HC-05 should blink at 2-second intervals. This shows that the HC-05 is in AT mode.
If the LED blinks rapidly try the following:
a. Disconnect and reconnect the 5V power connection to the HC-05.
b. Check the connection.
4
Part A: Build the Bluetooth Controller
1. If you are using Android smartphone, install this app, Arduino Bluetooth controller.
https://play.google.com/store/apps/details?id=com.giumig.apps.bluetoothserialmonitor&hl
=en or search Arduino Bluetooth Controller apps using play store
2. Install the apps.
3. Turn ON the Bluetooth module.
4. Find the Bluetooth name and pairing.
5. Open Arduino Bluetooth Controller application.
6. Setup the Arduino Bluetooth Controller application by referring Table1.
Table 1
KEY INDICATOR SYMBOL MOVEMENT
A FORWARD
B REVERSE
C RIGHT
D LEFT
E STOP
F SPIN CW
G SPIN CCW
5
Part B - Sketch A:
// Name:
//Registration No:
#include <SoftwareSerial.h>
char state;
void setup() {
pinMode(EN1, OUTPUT);
pinMode(EN2, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
void loop() {
if (BTSerial.available())
state = BTSerial.read();
Serial.print("received = ");
Serial.println(state);
if (state == 'A')
forward();
if (state == 'B')
reverse();
if (state == 'C')
turnLeft();
if (state == 'D')
turnRight();
if (state == 'E')
stopRobot();
if (state == 'F')
spinCW();
if (state == 'G')
spinCCW();
void forward()
Serial.println("Forward");
digitalWrite(IN2, LOW); //
digitalWrite(IN3, LOW); // left motor forward
digitalWrite(IN4, HIGH); //
void reverse()
Serial.println("reverse");
digitalWrite(IN2, HIGH); //
digitalWrite(IN4, LOW); //
void turnLeft()
Serial.println("Turn Left");
digitalWrite(IN2, LOW); //
digitalWrite(IN4, LOW); //
void turnRight()
Serial.println("Turn Right");
digitalWrite(IN4, HIGH); //
void stopRobot()
Serial.println("stop");
digitalWrite(IN2, LOW); //
digitalWrite(IN4, LOW); //
void spinCW()
Serial.println("spinCW");
digitalWrite(IN2, LOW); //
digitalWrite(IN4, HIGH); //
void spinCCW()
Serial.println("spinCCW");
analogWrite(EN1, 255); // Run in full speed
digitalWrite(IN2, HIGH); //
digitalWrite(IN4, LOW); //
Question:
1. Make the robot spinCW 10 times and spinCCW 5 times in full speed before Stop?
2. Make the robot spinCW 10 times full speed and move Forward before it Stop?
8