Lab Report (Robotics)
Lab Report (Robotics)
Submitted by:
Session: 2018-19
4th Year, 1st Semester.
Computer Science and Engineering
University of Barishal, Barishal
Submitted to:
1
Name of the Experiment: Arduino Line Follower Car
Objective
The project's goal is to create a Line Follower Robot (LFR) that can track
black lines on contrasting surfaces on its own by using an Arduino Uno
and infrared sensors. The goal is to develop a flexible LFR that can adjust
to various line-following situations by utilizing accurate sensor input and
strong Arduino-based control systems. The goal of this project is to
develop a dependable and effective line-tracking system, demonstrating
the practical uses of Arduino-based robots.
Required Components
1. Arduino UNO
2. Motor Driver Shield
3. IR Sensor (2x)
4. TT Gear Motor (4x)
5. 18650 Li-on Battery (2x)
6. 18650 Battery Holder
7. Jumper Wires
8. Acrylic Sheet
9. DC Power Switch
10. Wheels (4x)
➢ Arduino UNO: The brains of the line follower automobile are found on
this popular microcontroller board. It uses preprogrammed commands
to control different parts.
➢ Motor Driver Shield: An expansion board called the Motor Driver Shield
2
➢ communicates with the Arduino UNO to control motor movement.
H-bridge circuits are usually included to drive motors in both directions.
Wheels (4x): Components providing traction and enabling movement in
different directions.
➢ IR Sensor (2x): The contrast between the black line and the
surrounding surface is picked up by these infrared sensors. By giving
the Arduino UNO feedback, they allow autonomous path following.
➢ Acrylic Sheet: This material, which is used to build the chassis, offers
a strong, lightweight framework that holds components together.
➢ Wheels: They give the robot traction and allow it to move. They aid in
surface motion and are usually fastened to the TT Gear Motors' shafts.
Circuit Design
3
Implementation:
Part 1 - Theoretical
4
Part 2-Coding:
Code
[Link](200);
//line detected by both sensors
[Link](200);
if(analogRead(lefts) <= 400 && analogRead(rights)
<= 400){ //declaring pin types
[Link](RELEASE); pinMode(rights,INPUT);
[Link](RELEASE); [Link](9600);
[Link](RELEASE); }
//defining motors
void setup() {
}
[Link](200);
//turn right }
[Link](FORWARD); }
[Link](BACKWARD);
[Link](FORWARD);
#include <AFMotor.h>
#define lefts A4
#define rights A5
#define frontLeftMotor 1
#define frontRightMotor 2
#define rearLeftMotor 3
#define rearRightMotor 4
6
Results
Input
Output
Objective
This project's goal is to create and put into place an RFID door lock system that can
authorize access using radio frequency identification (RFID). Our goal is to develop a
safe and practical door-locking system that improves access control and does away
with conventional keys by employing RFID technology.
7
Description of The Experiment
➢ Security: It is crucial to guarantee the security of the RFID door lock system
to stop unwanted access. To protect against potential risks like cloning or
RFID signal interception, precautions including encryption of RFID data, the
use of access control lists, and frequent security audits must be taken.
➢ Reliability and Maintenance: Strong and dependable, the RFID door lock
system should be able to withstand a variety of environmental factors and
manage a large number of access requests. Establishing routine maintenance
and troubleshooting methods can help to quickly address any hardware or
software issues.
Required Components
1. Arduino UNO
2. Arduino Power Supply
3. Breadboard & Jumpers
4. RC522 RFID Sensor
5. Micro Servo
6. LEDs
7. Resistors
8. 3D Printer & Filament
8
Description Of Components
❖ Arduino Power Supply: Provides a stable power source for Arduino UNO and
connected components.
❖ Breadboard & Jumpers: Prototyping tools for creating temporary circuits and
connecting electronic components.
❖ RC522 RFID Sensor: RFID module for reading and authenticating RFID tags or
cards.
❖ Micro Servo: Small motor for controlling the locking mechanism of the door.
❖ LEDs: Light-emitting diodes used for indicating system status or providing visual
feedback.
❖ 3D Printer & Filament: Tools for fabricating custom parts or enclosures for the
RFID door lock system.
Circuit Design
9
Implementation:
Part 1 - Theoretical
The RFID door lock system operates on the principle of RFID technology, where each
authorized user is assigned a unique identifier stored on an RFID card. The RC522
RFID sensor reads these identifiers and, upon verification, triggers the Micro Servo
to unlock the door. LEDs provide visual indicators of the door's status, enhancing
user feedback.
Experimental Setup
● Connect RFID sensor, LEDs, and Micro Servo to Arduino UNO via jumpers and
breadboard.
● Program Arduino to read RFID card data and manage Micro Servo.
Procedure
Operation
10
Part 2:
digitalWrite(redLEDPin, LOW);
delay(200);
Code digitalWrite(greenLEDPin, LOW);
#include <SPI.h>
[Link](3);
#include <RFID.h>
#include <Servo.h>
11
//Green LED sequence
void checkAccess (String temp) delay(200);
//Function to check if an identified tag is digitalWrite(greenLEDPin, LOW);
registered to allow access delay(200);
{ digitalWrite(greenLEDPin, HIGH);
boolean granted = false; delay(200);
for (int i=0; i <= (accessGrantedSize-1); digitalWrite(greenLEDPin, LOW);
i++) //Runs through all tag ID numbers delay(200);
registered in the array
{
if(accessGranted[i] == temp)
}
//If a tag is found then open/close the
}
lock
if (granted == false) //If the tag is not
{
found
[Link] ("Access Granted");
{
granted = true;
[Link] ("Access Denied");
if (locked == true) //If the lock is
digitalWrite(redLEDPin, HIGH);
closed then open it
//Red LED sequence
{
delay(200);
[Link](unlockPos);
digitalWrite(redLEDPin, LOW);
locked = false;
} delay(200);
digitalWrite(redLEDPin, HIGH);
else if (locked == false) //If the lock
is open then close it delay(200);
digitalWrite(redLEDPin, LOW);
{
delay(200);
[Link](lockPos); locked
= true; }
} }
digitalWrite(greenLEDPin, HIGH);
Results:
Part 1 - Input
The RFID Door Lock system operates by detecting RFID tags near the
RFID reader. Upon initialization, the Arduino board waits for a tag to be
detected. When a tag is found, its ID number is compared against a list
of permitted access tags. If a match is found, the door lock mechanism
is activated to either lock or unlock the door, based on its current
state. This process ensures that only authorized individuals can gain
access to the locked area.
Part 2 - Output
The RFID Door Lock system utilizes an Arduino board to manage RFID tag detection
12
and access control. It communicates the status of the RFID detection process
through the serial monitor. When an allowed access tag is detected, the door lock
mechanism is activated accordingly, either locking or unlocking the door. LED
indicators provide visual feedback, with a green LED sequence indicating access
granted and a red LED sequence for access denied. Additionally, the door lock servo
moves to the appropriate position based on the detected tag's access status. Finally,
status messages indicating "Access Granted" or "Access Denied" are printed to the
serial monitor, reflecting the outcome of the RFID tag check. This comprehensive
system ensures secure access control with both visual and serial feedback
mechanisms.
Objective
Create and build a robotic vehicle that can navigate itself and avoid obstacles. Use
sensor-based navigation algorithms to ensure safety. Analyze and experiment with
systems to determine their performance, providing useful information for robotics
and sensor technology applications.
Integrating sensors like ultrasonic or infrared with a mobile robotic platform enables
autonomous obstacle detection and navigation, surpassing limitations of predefined
paths or manual intervention in conventional systems.
13
of obstacles and environmental conditions.
Required Component
1. Arduino UNO
2. Motor Driver Shield
3. Wheels (4x)
4. TT Gear Motor (4x)
5. Servo Motor
6. Ultrasonic Sensor
7. 18650 Li-on Battery (2x)
8. 18650 Battery Holder
9. Male and Female Jumper Wire
10. Acrylic Sheet
11. DC Power Switch
14
Circuit Design:
Implementation:
Part 1 - Theoretical
The Obstacle Avoiding Car utilizes ultrasonic sensing and motor control
Experimental Setup:
15
2. Connect the Ultrasonic Sensor, Servo Motor, and TT Gear Motors to
Procedure:
scanning.
Motors.
Operation:
1. The Servo Motor rotates, enabling the Ultrasonic Sensor to scan for
obstacles.
obstacle avoidance.
Part 2 - Coding
16
[Link]
NewPing//
//Servo Library
delay(100);
}
[Link]
libraries/[Link] // void loop() {
// To Install the libraries, go to int distanceR = 0;
sketch >> Include Library >> Add .ZIP int distanceL = 0;
File >> Select the Downloaded ZIP files delay(40);
From the Above links //
if(distance<=15)
{
#include <AFMotor.h> moveStop();
#include <NewPing.h> delay(100);
#include <Servo.h> moveBackward();
delay(300);
#define TRIG_PIN A0 moveStop();
#define ECHO_PIN A1 delay(200);
#define MAX_DISTANCE 200 distanceR = lookRight(); delay(200);
#define MAX_SPEED 190 // sets speed of distanceL = lookLeft(); delay(200);
DC motors
#define MAX_SPEED_OFFSET 20 if(distanceR>=distanceL) {
turnRight();
NewPing sonar(TRIG_PIN, ECHO_PIN, moveStop();
MAX_DISTANCE); }else
{
AF_DCMotor motor1(1, MOTOR12_1KHZ); turnLeft();
AF_DCMotor motor2(2, MOTOR12_1KHZ); moveStop();
AF_DCMotor motor3(3, MOTOR34_1KHZ); }
AF_DCMotor motor4(4, MOTOR34_1KHZ);
}else
Servo myservo;
{
moveForward();
boolean goesForward=false;
}
distance = readPing();
int distance = 100;
}
int speedSet = 0;
int lookRight()
void setup() {
{
[Link](50); delay(500);
[Link](10);
int distance = readPing(); delay(100);
[Link](115);
[Link](115); return distance;
delay(2000);
}
distance = readPing();
delay(100);
int lookLeft()
distance = readPing();
{
delay(100);
[Link](170); delay(500);
distance = readPing();
int distance = readPing(); delay(100);
delay(100);
distance = readPing();
[Link](115);
return distance; int readPing() {
delay(100); delay(70);
} int cm = sonar.ping_cm();
if(cm==0)
17
{ [Link](BACKWARD);
cm = 250; [Link](BACKWARD);
} [Link](BACKWARD);
return cm; [Link](BACKWARD);
} for (speedSet = 0; speedSet < MAX_SPEED;
speedSet +=2) // slowly bring the speed up
void moveStop() { to avoid loading down the batteries too
[Link](RELEASE); quickly
[Link](RELEASE); {
[Link](RELEASE); [Link](speedSet);
[Link](RELEASE); [Link](speedSet);
} [Link](speedSet);
[Link](speedSet);
void moveForward() { delay(5);
}
if(!goesForward) }
{
goesForward=true; void turnRight() {
[Link](FORWARD); [Link](FORWARD);
[Link](FORWARD); [Link](FORWARD);
[Link](FORWARD); [Link](BACKWARD);
[Link](FORWARD); [Link](BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; delay(500);
speedSet +=2) // slowly bring the speed up [Link](FORWARD);
to avoid loading down the batteries too [Link](FORWARD);
quickly [Link](FORWARD);
{ [Link](FORWARD);
[Link](speedSet); }
[Link](speedSet);
[Link](speedSet); void turnLeft() {
[Link](speedSet); [Link](BACKWARD);
delay(5); [Link](BACKWARD);
} [Link](FORWARD);
} [Link](FORWARD);
} delay(500);
[Link](FORWARD);
[Link](FORWARD);
[Link](FORWARD);
[Link](FORWARD);
void moveBackward() {
}
goesForward=false;
Results:
Part 1 - Input
18
connected to an Arduino to measure distances. This sensor emits
sound waves that bounce off obstacles and calculates the distance by
measuring the time it takes for the waves to return. This information is
then used to enable the car to navigate and avoid obstacles effectively.
Part 2 - Output
The "Obstacle Avoiding Car" code controls the movement of the car by
less, the car stops, moves backward, and then turns either left or right
detected within 15 cm, the car continues moving forward. The output
Objective
19
Key aspects of the problem include:
Required Components
1. Arduino UNO
2. Arduino Bluetooth Module HC-05
3. 6V DC Geared Motor 180 RPM Dual Shaft (4 pcs)
4. L298N H-Bridge Dual Motor Driver, Stepper Motor Driver
5. Yellow Plastic Mag Wheel Soft Tire (4 pcs)
6. 18650 Li-ion Rechargeable Battery (2 pcs)
7. Battery Holder 2s for 18650 Battery
8. Male and Female Jumper Wires (40 pcs)
9. 6 Inch X 6 Inch Acrylic Sheet
10. On / Off Switch (Mini)
20
traction and stability.
➢ 18650 Li-ion Rechargeable Battery: Power source for the robotic car, ensuring
portability and longevity.
➢ Battery Holder 2s for 18650 Battery: Holder for securing and connecting the
Li-ion batteries.
➢ Male and Female Jumper Wires: Connectors for establishing electrical
connections between components.
➢ 6 Inch X 6 Inch Acrylic Sheet: Structural material for building the chassis and
body of the robotic car.
➢ On / Off Switch (Mini): Switch for manually controlling the power supply to
the robotic car.
.
Circuit Design
21
Implementation:
Part 1 - Theoretical
Experimental Setup:
Procedure:
Operation:
22
Part 2-Coding
digitalWrite(10,HIGH);
Code
char t;
void setup() {
pinMode(13,OUTPUT); //left motors
forward
}
pinMode(12,OUTPUT); //left motors reverse
pinMode(11,OUTPUT); //right motors
else if(t == 'L'){ //turn right (left
side motors rotate in forward direction,
right side motors doesn't rotate)
digitalWrite(11,HIGH);
}
forward
pinMode(10,OUTPUT); //right motors
else if(t == 'R'){ //turn left (right side
reverse
motors rotate in forward direction, left
pinMode(9,OUTPUT); //Led
side motors doesn't rotate)
[Link](9600);
digitalWrite(13,HIGH);
}
}
else if(t == 'W'){ //turn led on or
void loop() {
off)
if([Link]()){
digitalWrite(9,HIGH);
t = [Link]();
}
[Link](t); else if(t == 'w'){
} digitalWrite(9,LOW);
}
if(t == 'F'){ //move
forward(all motors rotate in forward
else if(t == 'S'){ //STOP (all motors
direction) stop)
digitalWrite(13,HIGH); digitalWrite(13,LOW);
digitalWrite(11,HIGH); digitalWrite(12,LOW);
} digitalWrite(11,LOW);
digitalWrite(10,LOW);
else if(t == 'B'){ //move reverse (all
}
motors rotate in reverse direction)
delay(100);
digitalWrite(12,HIGH);
}
Results:
23
Part 1 - Input
The input for this code is received through the serial communication from a
connected device (like a computer or smartphone) via Bluetooth or USB. The
following are the recognized input characters and their corresponding actions:
L: Turn right (left-side motors rotate forward, right-side motors do not rotate).
R: Turn left (right-side motors rotate forward, left-side motors do not rotate).
Part 2 - Output
The output of the code controls the motors and LED of the robot car based on the
received commands like Left motors rotate forward (for command 'F'), Left motors
rotate reverse(for command 'B'), Right motors rotate forward (for command 'L'),
Right motors rotate reverse (for command 'R'), Stop all motors (for command 'S').
The Bluetooth Robot Car successfully demonstrated wireless control and movement
in response to commands from the paired Bluetooth-enabled device. The integration
of components, including the Arduino UNO, Bluetooth Module, and DC Geared
Motors, provided an effective and responsive robotic system.
24