0% found this document useful (0 votes)
23 views16 pages

Robo-Lab 2

The document is a lab report detailing three experiments involving Arduino-based robotic projects. The first experiment focuses on a Bluetooth-controlled robotic car, the second on an automated line-following robot using IR sensors, and the third on an obstacle avoidance robot utilizing an ultrasonic sensor. Each experiment outlines objectives, required components, circuit diagrams, methodologies, and results, demonstrating practical applications of embedded systems and robotics.

Uploaded by

tahasina.bu1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views16 pages

Robo-Lab 2

The document is a lab report detailing three experiments involving Arduino-based robotic projects. The first experiment focuses on a Bluetooth-controlled robotic car, the second on an automated line-following robot using IR sensors, and the third on an obstacle avoidance robot utilizing an ultrasonic sensor. Each experiment outlines objectives, required components, circuit diagrams, methodologies, and results, demonstrating practical applications of embedded systems and robotics.

Uploaded by

tahasina.bu1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Lab Report

Submitted To : Dr. Rahat Hossain Faisal


Associate Professor
Department of Computer Science & Engineering
University of Barishal

Submitted By : Tahasina Alam Tuli


Class Roll : 20CSE010
Session : 2019-20
Year : 4th
Semester : 1st
Submission Date: 20/07/2025
Experiment No.: 01
Experiment Name: Bluetooth-Controlled Robotic Car Using Arduino

 Objectives:
An Arduino Bluetooth car project is to design and build a remotely controlled vehicle that can be
steered using a smartphone or other device via Bluetooth. This typically involves using an
Arduino microcontroller, a Bluetooth module (like HC-05), a motor driver, and DC motors to
control the car's movement. The project aims to provide a practical example of wireless control
and robotics, often serving as an introductory project for beginners in electronics and
programming.

 To design and implement a robotic car controlled via Bluetooth using an Android smartphone.
 To understand interfacing of Arduino UNO with the HC-05 Bluetooth module and L298N motor
driver.
 To control robot movement wirelessly through basic commands (Forward, Backward, Left,
Right, Stop).
 To gain practical experience in embedded systems and wireless communication.

 Components Required:

Component Quantity
Arduino UNO 1
HC-05 Bluetooth Module 1
L298N Motor Driver Module 1
DC Gear Motors 2 or 4
Robot Chassis 1
Wheels 2 or 4
9V/12V Battery or Battery Pack 1
Jumper Wires As required
Smartphone (Android) 1
Bluetooth Control App (e.g., Arduino Bluetooth Controller, BT Car) 1
 Circuit Diagram:

 HC-05 Module:
 TX → Arduino RX
 RX → Arduino TX (via voltage divider)
 VCC → 5V
 GND → GND
 L298N Motor Driver:
 IN1–IN4 → Arduino digital pins
 Motor outputs → Left and right motors
 12V or 9V battery to motor driver
 ENA and ENB tied HIGH or to PWM pins for speed control

 Flowchart:

Start

Initialize Bluetooth and Motors

Wait for Bluetooth Commands

┌────────┬────────┬────────┬────────┐
↓ ↓ ↓ ↓ ↓
Forward Backward Left Right Stop
↓ ↓ ↓ ↓ ↓
Move Move Turn Turn Stop

Repeat
 Algorithm:
 Start the system and initialize Arduino and Serial communication.
 Set up motor control pins (IN1, IN2, IN3, IN4) as OUTPUT.
 Establish serial communication with the Bluetooth module (e.g., Serial.begin(9600);).
 Continuously check for incoming data from the Bluetooth module (Serial.available()).
 Read the incoming character or string command from Bluetooth (Serial.read() or
Serial.readString()).
 Compare the command:
 If command is "F" or "forward" → Move Forward.
 If command is "B" or "backward" → Move Backward.
 If command is "L" or "left" → Turn Left.
 If command is "R" or "right" → Turn Right.
 If command is "S" or "stop" → Stop all motors.
 Execute the corresponding motor logic using digitalWrite() or PWM as needed.
 Repeat steps 4–7 to keep listening and responding to new commands.
 End (runs in a loop until powered off or reset).

 Methodology:

 Hardware Setup:
 Chassis Assembly:
 Mount two or four DC motors on the robot chassis.
 Attach wheels to the motors.
 Fix the caster wheel (if used) for balance.
 Place the Arduino UNO and L298N motor driver securely on top of the chassis.
 Motor Driver (L298N) Connections:
 Connect Motor A terminals (IN1, IN2) and Motor B terminals (IN3, IN4) to Arduino digital pins
(e.g., D7, D6, D5, D4).
 Connect the ENA and ENB pins to 5V (for full speed) or PWM pins (e.g., D9, D10) for speed
control.
 Bluetooth Module (HC-05) Connections:
 TX of HC-05 → RX of Arduino (via voltage divider if needed).
 RX of HC-05 → TX of Arduino.
 VCC → 5V.
 GND → GND.
 Power Supply:
 Use a 9V or 12V battery pack to power the motor driver and Arduino.
 Connect the positive terminal of the battery to the 12V input of the L298N module, and the
ground to GND.
 Software Setup:

 Arduino IDE Configuration:


 Open the Arduino IDE on your computer.
 Choose the correct board (Arduino UNO) and port under the "Tools" menu.
 Programming the Arduino:
 Write or paste the code that:
 Initializes the motor control pins.
 Reads Bluetooth serial input.
 Controls motor direction based on received commands.
 Upload the code to the Arduino UNO using the USB cable.
 Smartphone App Installation:
 Install a Bluetooth controller app on your Android phone, such as:
 ―Arduino Bluetooth Controller‖
 ―BT Car‖
 ―Bluetooth RC Controller‖
 Pair the phone with the HC-05 Bluetooth module using the default passcode (usually 1234 or
0000).

 Testing Procedure:
 Power the system by turning on the battery pack.
 Open the Bluetooth control app on your smartphone and connect it to the HC-05 module.
 Use directional buttons ("Forward", "Backward", "Left", "Right", "Stop") in the app.
 Observe the robot's response to each command:
 It should move in the correct direction as per the input.
 Adjust or troubleshoot wiring or code if the robot does not move as expected.

 Output:
When powered on:
 The robot receives commands wirelessly via Bluetooth and responds by moving forward,
backward, turning left/right, or stopping.
 Commands are issued using a mobile app interface.

 Results:
 The robotic car responds efficiently to real-time Bluetooth commands.
 The wireless range and control are stable within 10–15 meters.
 The car's speed and direction are accurately controlled through the app.
 Conclusion:
The Bluetooth-controlled robotic car is a practical and low-cost embedded systems project. It
demonstrates the integration of wireless communication with robotics using Arduino. This type
of robot can be extended for automation, surveillance, or smart control systems in the future.

Experiment No.: 02
Experiment Name: Automated Line Following Robot using Arduino and IR Sensors

Objectives
i. To design and implement a robot that can follow a predefined path marked by a black line.
ii. To develop an autonomous system using Arduino UNO, IR sensors, and L298N motor driver
module.
iii. To understand sensor-based automation in robotics and real-time decision-making based on
sensor input.

Components Used
Component Quantity Description
Arduino UNO 1 Microcontroller board to
control sensors and motors
IR Sensors 2 Detect black line on white
surface
L298N Motor Driver 1 Controls the direction and
Module speed of two DC motors
2WD Car Chassis 1 Includes wheels and motors
to build the robot base
DC Motors 2 Drive the wheels
7–12V DC Battery (2S LiPo) 1 Powers the Arduino and
motors
Jumper Wires As required For connections
For connections
Double-Sided Tape / Glue As required To fix
Gun components on
chassis
Black Electrical Tape As required Used to draw the line path
on the surface
Circuit Diagram

Figure-01: Circuit Diagram


Description of the Circuit Diagram
The circuit of the automated line-following robot consists of three main modules:
1. Sensor Module (IR Sensors)
2. Control Unit (Arduino UNO)
3. Actuator Module (Motors with L298N Motor Driver)
1. IR Sensor Connections
 Two IR sensor modules are used to detect the black line on a white surface.
 Each sensor has three pins: VCC, GND, and OUT.
 VCC → connected to 5V of Arduino.
 GND → connected to Arduino GND.
 Right sensor output connected to digital pin 11.
 Left sensor output connected to digital pin 12.
2. Arduino UNO
 Acts as the brain of the robot.
 Reads IR sensor input and processes logic to control motor direction and speed.
 Controls motors using PWM output signals through the L298N motor driver.
3. L298N Motor Driver Module
Controls two DC motors independently (used for 2WD robot chassis).
Arduino controls motor direction using:
 IN1 and IN2 → Right motor direction (connected to pins 7 and 8).
 N3 and IN4 → Left motor direction (connected to pins 9 and 10).
Enable pins (ENA and ENB) control motor speed using PWM:
 ENA (Right motor) → Arduino pin 6
 ENB (Left motor) → Arduino pin 5
Power supply:
o 7–12V LiPo battery is connected to the 12V input terminal of L298N.
o GND of battery, L298N, and Arduino are all connected together to form a common ground.
4. Power Supply
 A 2S Li-Po battery (7.4V) is used to power the motors and Arduino.
 The L298N module also provides 5V output, which can optionally power the Arduino via the
5V pin (not recommended for high current motors—use Vin instead).

Flowchart / Algorithm
Algorithm:
1. Initialize pins and set PWM frequency.
2. Continuously read IR sensor data.
3. If both sensors detect white surface → Move Forward.
4. If left sensor detects black line → Turn Left.
5. If right sensor detects black line → Turn Right.
6. If both sensors detect black line → Stop (end of line or junction).
7. Repeat loop.
Algorithm Explanation with Code
1. Initialize Pins and Set PWM Frequency
TCCR0B = TCCR0B & B11111000 | B00000010; Sets PWM frequency of pins 5 and 6 to
~7812.5 Hz for smoother motor control.
pinMode(IR_SENSOR_RIGHT, INPUT); pinMode(IR_SENSOR_LEFT, INPUT); Initializes IR
sensors as input.
Continuously Read IR Sensor Data
int rightIRSensorValue = digitalRead(IR_SENSOR_RIGHT);
int leftIRSensorValue = digitalRead(IR_SENSOR_LEFT); Reads current state of left and right
IR sensors.
Move Forward if Both Sensors See White
if (rightIRSensorValue == LOW && leftIRSensorValue == LOW)
{rotateMotor(MOTOR_SPEED, MOTOR_SPEED);} Both sensors on white → move both
motors forward.
4. Turn Right if Right Sensor Sees Black
else if (rightIRSensorValue == HIGH && leftIRSensorValue == LOW)
{rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);} Right on black, left on white → rotate
clockwise (right motor backward, left forward).
Turn Left if Left Sensor Sees Black
else if (rightIRSensorValue == LOW && leftIRSensorValue == HIGH)
{rotateMotor(MOTOR_SPEED, -MOTOR_SPEED);} Left on black, right on white → rotate
counterclockwise.
Stop if Both Sensors See Black
Else {rotateMotor(0, 0);} Robot stops (likely at junction or end of line).
Flowchart:

Figure-02: Flowchart
Methodology
The methodology of this project is divided into the following phases:
. Sensor Integration:
IR sensors detect black lines (which absorb IR light and reflect less) and white surfaces (which
reflect IR light). The sensor outputs digital HIGH/LOW values which are interpreted by
Arduino.
Motor Control:
The L298N motor driver module controls the two DC motors. Direction is managed using logic
pins (IN1, IN2, IN3, IN4) while speed is controlled using PWM on ENA/ENB.
Logic and Decision Making:
Sensor values are processed in Arduino to determine the robot’s next move. The robot adjusts its
direction in real time by turning left/right or moving forward depending on sensor values.
Code Optimization:
The PWM frequency is modified in the Arduino setup to ensure smooth control at higher PWM
values, which is essential for TT gear motors that don’t operate well at low PWM.
Output
 The robot starts moving along the black line as soon as power is supplied.
 It is able to detect curves, turn at corners, and stop at intersections (where both sensors detect
black).
 Smooth and responsive motion was observed due to PWM frequency adjustment.
Result
 The robot demonstrated accurate and real-time line following using IR sensors.
 It could navigate through paths drawn with black electrical tape and respond to curves with
acceptable accuracy.
 The logic was successfully implemented with minimal hardware and cost-effectiveness.

Conclusion
The Automated Line Following Robot using Arduino UNO and IR sensors effectively
performs autonomous navigation using real-time feedback. This project showcases the potential
of embedded systems and control logic in real-world automation tasks. Its modular structure
makes it ideal for future upgrades like obstacle detection, intersection handling, or
Bluetooth/Wi-Fi control.

Experiment No. : 03
Experiment Name: Arduino-Based Obstacle Avoidance Robot

Objectives:
 To design and build an autonomous robot that can detect and avoid obstacles using an ultrasonic
sensor.
 To understand sensor-based navigation using real-time distance measurement.
 To implement obstacle avoidance logic using Arduino and motor driver circuits.
 To develop hands-on skills in embedded systems and basic robotics.

Components Used:
Component Quantity

Arduino UNO 1

HC-SR04 Ultrasonic Sensor 1

L298N Motor Driver Module 1

DC Gear Motors 2

Robot Chassis 1

Wheels 2

Caster Wheel (optional) 1

Battery Pack (9V or 12V) 1

Jumper Wires As needed

Breadboard (optional) 1

Block Diagram / Circuit Diagram:

[Ultrasonic Sensor]

[Arduino UNO]

┌───────────────┐
↓ ↓
[L298N Motor Driver] → [Motors]

[Battery Supply]

Circuit Description:
 Ultrasonic Sensor (HC-SR04):
o VCC → 5V
o GND → GND
o Trig → Arduino Digital Pin (e.g., D9)
o Echo → Arduino Digital Pin (e.g., D10)
 L298N Motor Driver:
o IN1, IN2, IN3, IN4 → Arduino Digital Pins (e.g., D2–D5)
o Motor outputs → Motors
o ENA/ENB → 5V or PWM pins
o Power → Battery connected to 12V terminal

Flowchart / Algorithm:
Flowchart:
pgsql
CopyEdit
Start

Initialize components

Measure distance using
Ultrasonic Sensor

Is distance < Threshold?
↓ ↓
Yes No
↓ ↓
Stop → Turn Move Forward
↓ ↓
Repeat
Algorithm:
1. Start and initialize the ultrasonic sensor and motor driver pins.
2. Continuously measure the distance from the ultrasonic sensor.
3. If the measured distance is less than 15 cm:
o Stop the robot.
o Turn right or left (based on available space).
4. If the path is clear:
o Move forward.
5. Repeat this loop.

Methodology:
A. Hardware Setup:
 Assemble the chassis, mount motors and wheels.
 Connect the motors to the L298N motor driver module.
 Attach the ultrasonic sensor at the front of the robot.
 Connect the sensor and motor driver to the Arduino UNO as per circuit.
 Use a battery pack to power motors and Arduino.
Software Setup:
 Use Arduino IDE to write and upload the control code.
 Use digitalWrite() and pulseIn() to interact with motors and the ultrasonic sensor.
 Implement logic that stops or turns the robot when an obstacle is detected.
Testing Procedure:
 Power the robot.
 Place it in an area with obstacles.
 Observe its ability to detect and avoid obstacles.
 Tune the threshold distance for better response.

Output:
 The robot:
o Moves forward in a straight line.
o Detects objects in front using the ultrasonic sensor.
o Stops and turns to avoid collisions.
 Fully autonomous without any manual control.

Result:
 The robot successfully avoids obstacles in real time.
 It performs intelligent navigation using only a distance sensor and basic logic.
 The design meets its intended goal of autonomous movement and obstacle avoidance.

Conclusion:
The Obstacle Avoidance Robot is a foundational example of autonomous robotic systems. Using
the HC-SR04 ultrasonic sensor with Arduino, the robot senses and responds to its environment,
showcasing the real-world application of sensors, actuators, and control logic. This project
enhances understanding of embedded programming, real-time systems, and robot intelligence.

Experiment No. : 04
Experiment Name: Arduino Voice-Controlled Robot

Objectives:
 To design and build a robot that can be controlled using voice commands.
 To understand the interfacing of Arduino with a voice recognition module or mobile voice
control system.
 To implement wireless control and movement of the robot using basic voice commands like
―forward‖, ―backward‖, ―left‖, ―right‖, and ―stop‖.
 To integrate electronics, programming, and speech interface into a robotics application.
Components Used:
Component Quantity

Arduino UNO 1

HC-05 Bluetooth Module 1

L298N Motor Driver Module 1

DC Gear Motors 2

Robot Chassis 1

Wheels 2

Battery (Li-ion or 9V) 1

Android Smartphone (for voice app) 1

Jumper Wires As required

Smartphone App (e.g., ―Arduino Voice Control‖ or ―BT Voice Control‖) 1

Circuit Diagram:

Circuit Diagram Description:


 HC-05 Bluetooth Module:
o VCC → 5V on Arduino
o GND → GND
o TX → Arduino RX (D0 or SoftwareSerial)
o RX → Arduino TX (D1 or SoftwareSerial)
 L298N Motor Driver:
o IN1, IN2, IN3, IN4 → Arduino digital pins (e.g., D7–D10)
o ENA and ENB → Connect to 5V (or PWM pins for speed control)
o Motors connected to output terminals
o Power connected to battery

Flowchart / Algorithm:
Flowchart:
mathematica
CopyEdit
Start

Initialize Arduino

Connect to Bluetooth Module

Receive Voice Command via App

┌────────────┬─────────────┬─────────────┬────────────┐
↓ ↓ ↓ ↓ ↓
Forward Backward Left Turn Right Turn Stop
↓ ↓ ↓ ↓ ↓
Move in that direction ←←←←←←←←←←←←←←←←←←←←

Repeat
Algorithm:
1. Start Bluetooth communication.
2. Wait for a command (e.g., "forward", "left", etc.).
3. Compare received string and map it to motion instructions.
4. Activate motor directions via the motor driver accordingly.
5. Loop and wait for the next command.

Methodology:
 Step 1: Assemble the robot chassis, attach wheels, motors, and connect to the L298N motor
driver.
 Step 2: Connect the L298N module to the Arduino UNO.
 Step 3: Connect the HC-05 Bluetooth module to the Arduino using TX/RX pins.
 Step 4: Install a voice control app on a smartphone that sends commands via Bluetooth.
 Step 5: Write and upload Arduino code to receive serial input and trigger motor actions.
 Step 6: Power the circuit using a battery pack.
 Step 7: Pair HC-05 module with the smartphone via Bluetooth and test with voice commands.
Output:
 The robot responds to the following voice commands:
o “Forward” → Moves forward
o “Backward” → Moves backward
o “Left” → Turns left
o “Right” → Turns right
o “Stop” → Stops
The movements are smooth and controlled via the user’s voice through a smartphone app.

Result:
 The Arduino voice-controlled robot successfully receives and responds to real-time voice
commands through Bluetooth.
 The robot performs desired movements correctly based on the interpreted voice instructions.
 The communication between the smartphone and HC-05 Bluetooth module is stable and
effective.

Conclusion:
The voice-controlled robot project demonstrates the integration of voice recognition technology
with embedded systems for wireless robotic control. Using a Bluetooth interface and
smartphone, real-time commands are interpreted and translated into motion through Arduino
programming and motor driver logic. This project showcases the potential of smart voice-based
interfaces in robotics and automation applications.

You might also like