You are on page 1of 21

Semiconductor Devices

and Circuits

Project Report

By:
Visweshwar S 19BEE0123
Lokesh K 19BEE0118
Aim:
To make a two wheeled robot which can be Bluetooth controlled
using a specifically designated application on a Smartphone.

Apparatus:
Hardware:
1 X Arduino UNO

1 X HC-05 Bluetooth Module


1 X L298N H-Bridge Motor Driver

2 X DC Motors

2 X 9V Batteries
2 X Battery Connectors

10 X Jumper Wires

2 X Plastic Wheels
1 X Castor Wheel

1 X Metal Chassis

1 X Arduino USB 2.0 Cable Type A/B


Software:
Arduino Integrated Desktop Environment
Arduino Bluetooth Control Application
Block Diagram:

Arduino
Bluecontrol
Application

Inbuilt Bluetooth
transmitter of the
smartphone

Bluetooth Signals

HC-05 Bluetooth
module

Arduino UNO
Microcontroller

L298N H-bridge
Motor driver

DC Motors
Circuit Diagram:
The Robot:
• The Bluetooth controlled Arduino Robot
Arduino Code:

#define IN1 12

#define IN2 11

#define IN3 10

#define IN4 9

char data;

int btVal;

void setup() {

Serial.begin(38400);

pinMode(IN1, OUTPUT);

pinMode(IN2, OUTPUT);

pinMode(IN3, OUTPUT);

pinMode(IN4, OUTPUT);

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

void loop(){

while (Serial.available())

data = Serial.read();

Serial.println(data);

switch(data)

case '1':

forward();

break;
case '2':

reverse();

break;

case '3':

left();

break;

case '4':

right();

break;

case '5':

stoprobot();

break;

void forward(){

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, HIGH);

void reverse(){

digitalWrite(IN1, LOW);

digitalWrite(IN2, HIGH);

digitalWrite(IN3, HIGH);

digitalWrite(IN4, LOW);

void left(){

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);

void right(){

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

void stoprobot(){

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

Upload the above code onto the Arduino board using a USB 2.0 Cable
Type A/B.

Operation:
• First, we need to connect one 9-volt battery to the DC jack of
the Arduino to power it and positive and negative of the other
battery is connected to the 12 volt and ground pins of the
L298N Motor Driver so as to provide power for the DC Motors.

• After the connection of the batteries, the HC-05 Module is


powered up as its Vcc and ground pins are connected to the
respective 5-volt and ground pins of the Arduino. Now it will be
ready for paring with the smartphone.
• Now we enable the Bluetooth setting on the smartphone and
open the Arduino Bluecontrol Application, it will automatically
start scanning for nearby Bluetooth devices and you can select
the HC-05 Module from the available devices. Then you will
establish a connection with the module.

• After the pairing is done, we need to go to the arrow controls


to start controlling the robot. When we press the forward
button in the app the corresponding value which is ‘1’ is
relayed to the inbuilt Bluetooth module of the phone and it is
then transmitted, these Bluetooth signals are received by the
HC-05 Bluetooth module and then relayed using jumper wires,
they are connected to the Rx and Tx of the Arduino Board.

• After receiving the signal from the module, it is then


substituted into the code which has already been dumbed onto
the Arduino before the connection of the batteries in the robot.
So when we receive the value of ‘1’ it is compared with the
various values of the switch case and if any of the values of the
cases agree with the value we have then the respective
function is called in the code.

• The function which is called in our case is the forward function


and in its body we can see that the IN1 and IN4 pins of the
motor driver are given the high signal and the IN2 and IN3 pins
are given the low signal, due to these signals both motors move
forward as they are given the appropriate power from the
motor driver due the excitation of the corresponding pins.

• Correspondingly for the values of ‘2’, ‘3’, ‘4’ and ‘5’ received
respective functions of ‘reverse’, ‘left’, ‘right’ and ‘stop’ are
called from the switch case. In the bodies of each of these
functions the signals for the IN1, IN2, IN3 and IN4 are specified
and according to these signals provided the power to the
motors is given by the motor driver.

Precautions:
• Make sure all the connections are according the circuit diagram
and there are no bad components and loose connections.

• While uploading the code make sure to specify board (i.e.


Arduino UNO) and the port (e.g. COM 4, COM 7 etc) properly to
avoid uploading errors when uploading.

• Make sure the baud rate in the code is 38400 as the Bluetooth
module runs at this baud rate. If this is not done, then the
Arduino won’t be able recognize the signals it receives from the
Bluetooth module.

• When uploading the code to the Arduino make sure to remove


all connections to avoid any uploading errors and logic errors
with the Bluetooth module as it runs on 3.3-volt logic while the
Arduino runs on 5-volt logic.

• Connect the batteries after uploading the code and make sure
there is enough charge left in them as the Bluetooth module
needs optimal charge for proper functioning.

• Enable the Bluetooth on the smartphone before opening the


app and after connecting to the Bluetooth module go to the
settings of the controller to enter the proper values for the
corresponding buttons on the app (i.e. ‘1’ for forward, ‘2’ for
reverse, ‘3’ for left, ‘4’ for right and ‘5’ for stop )
The Smartphone Application:
• The Arduino Bluecontrol Application
• Arrow key controls for controlling the robot
• Configuration of the Controls
Application:
• Recognisance and Military operations
• Rescue and Relief operations
• Monitoring and Guidance operations
• Cleaning and Disinfection operations

There are many more uses for this robot and it can be modified
to cater the needs of the situation.

Conclusion:
Therefore, this is the Semiconductors Project using Arduino with the
integration of Bluetooth and Smartphone.

Reference:
• https://www.electronicshub.org/bluetooth-controlled-robot-
using-arduino/

• https://www.instructables.com/id/Arduino-Bluetooth-
Controlled-Robot-Car-1/

• https://www.arduino.cc/

You might also like