0% found this document useful (0 votes)
14 views22 pages

Grouping Project Electronic

Uploaded by

Farah Regina
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)
14 views22 pages

Grouping Project Electronic

Uploaded by

Farah Regina
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/ 22

VRT3043

VRT3043: ELECTRONIC TECHNOLOGY


Group B

Grouping Project: Electronic Devices

PREPARED BY:

STUDENTS’ NAME MATRIC PHOTOS

Mohamad Noor Fahmi Bin Abd Majid D20202096368

Muhammad Afham Bin Johari D20202096359

Muhammad Fikri Bin Ismail D20202096375

LECTURER Dr Siti Faizzatul Aqmal Bt Mohamad Mohsin

DATE 1 June 2024

1
VRT3043

Table of Contents

Bil Contents Pages


1 Introduction 3
2 Circuit Diagram 4
3 Circuit Operating Process 5-6
4 Functions of Components in Circuits 7-10
5 Assembly Process 11-16
6 Code 17-21
7 Conclusion 22

2
VRT3043

1.0 INTRODUCTION

This project entails building and testing a 2WD Smart Robot Car with the "Arduino 2WD
Smart Robot Car Set DIY," which was obtained from an online retailer. The kit is intended to
provide a low-cost and hands-on approach to learning about robotics, electronics, and
programming, making it an excellent educational resource for students, hobbyists, and
educators. It contains essential components such as an Arduino Uno board, a motor driver,
DC geared motors, wheels, a micro servo, an ultrasonic sensor, and all mounting hardware.

The primary goal of this project is to design and programme a robotic vehicle capable
of autonomous navigation. To detect obstacles, the robot uses an ultrasonic sensor, and the
motor driver controls the wheels using sensor input processed by the Arduino Uno board.
This integration of components enables the robot to move, detect obstacles, and adjust its
path as needed. The project includes a variety of control systems, including:

1. Mechanical System: This includes structural elements such as the acrylic chassis,
wheels, and hammer caster that are necessary for the robot's movement and stability.
2. Electronic System: This system is centred on the Arduino Uno board and includes
the L298 motor driver and sensor shield, which enable communication between
sensors and actuators.
3. Electric System: This system, which is made up of the battery box and wiring,
ensures a consistent power supply to all components.
4. Control System: The ultrasonic sensor and microservo work together to detect
obstacles and adjust the robot's direction, demonstrating the robot's autonomous
operation.

This project provides invaluable insights into the integration and operation of various
robotic systems. Assembling and programming the 2WD Smart Robot Car provides hands-on
experience that highlights the practical applications of robotics and automation technologies,
emphasising their interdisciplinary nature and importance in today's world.

3
VRT3043

2.0 CIRCUIT DIAGRAM

The circuit diagram illustrates the interconnections and constituent parts used in the
electronic system of the 2WD Smart Robot Car. The following is an elaborate circuit diagram
that illustrates the arrangement of electrical components in the circuit:

4
VRT3043

3.0 CIRCUIT OPERATING PROCESS

The circuit operating process elucidates the manner in which the electronic components
collaborate and operate in unison, facilitating the 2WD Smart Robot Car's efficient
navigation and obstacle avoidance. The following is a detailed explanation of the operating
process:

1. Activating:
● When the battery box is connected to the robot car, power is supplied to the
Arduino Uno board and other electronic components, which start the system.
2. Sensor Initialization:
● The HC-SR04 ultrasonic sensor is activated and prepared to detect obstacles in
the robot's path as soon as power is supplied.
3. Obstacle Detection:
● The ultrasonic sensor emits sound waves with a high frequency and measures
the time it takes for the waves to return after colliding with an obstacle.
● The sensor uses the time it takes for sound waves to return to calculate the
distance to the obstacle in front of the robot.
4. Data Processing:
● The Arduino Uno board receives the distance measurements from the
ultrasonic sensor and performs computations on this data.
● The Arduino uses predefined threshold values to compare the measured
distance and ascertain whether an obstacle is within a critical range.
5. Decision Making:
● When the measured distance indicates that an obstacle is within the critical
range, the Arduino activates the navigation algorithm to circumvent the
obstacle.
● The navigation algorithm computes the motor control signals by considering
the obstacle's position in relation to the robot.
6. Motor Control:
● The Arduino transmits control signals to the L298 motor driver board in order
to regulate the velocity and orientation of the DC geared motors.
● The motor driver interprets the signals and adjusts the motor outputs
accordingly, enabling the robot to manoeuvre around the obstacle.

5
VRT3043

7. Servo Adjustment:
● The micro servo SG90 is used to adjust the position of the ultrasonic sensor in
order to scan for obstacles over a wider range simultaneously. This calibration
guarantees that the robot is capable of detecting obstacles not only directly in
front of it but also in its vicinity.
8. Continuous operation:
● The robot's obstacle detection, data processing, decision making, motor
control, and servo adjustment processes occur continuously and repeatedly as
the robot moves, guaranteeing uninterrupted navigation and avoidance of
obstacles.

Because of its circuit operating process, the 2WD Smart Robot Car is capable of
autonomously navigating and avoiding obstacles in its environment. The robot car can
effectively function in different situations by incorporating sensor data processing,
decision-making algorithms, and motor control mechanisms. Understanding the operational
procedure is essential for programming and improving the robot's behavior to achieve desired
navigation results.

6
VRT3043

4.0 FUNCTIONS OF COMPONENTS IN CIRCUITS

Mechanical Systems

No. Components Functions

1 Acrylic Chassis Acts as the main structural base for mounting all the
components, providing stability and support for the
entire robot.

2 Wheels Allow the robot to move by converting rotational


motion from the motors into linear motion.

3 Hammer Caster Provides additional stability and balance to the


robot, allowing it to turn smoothly.

7
VRT3043

Electronic system

No. Components Functions

1 Arduino Uno Box Serves as the central microcontroller, processing


input from sensors and executing control algorithms
to drive the motors and other actuators.

2 L298 Motor Driver Controls the speed and direction of the DC motors
by receiving control signals from the Arduino and
providing the necessary current and voltage to the
motors.

3 Sensor Shield Provides an easy interface for connecting various


sensors and actuators to the Arduino, simplifying
wiring and improving reliability.

8
VRT3043

Electric System

No. Components Functions

1 Battery Box Supplies electrical power to the entire robot,


ensuring all components receive a consistent and
adequate power supply.

2 Wiring Connects all electrical components, enabling the


transfer of power and signals between the Arduino,
sensors, motor driver, and motors.

Control System

No. Component Function

1 Ultrasonic Sensor Measures the distance to obstacles in front of the


robot by emitting ultrasonic waves and receiving the
reflected signals. This information is used to detect
and avoid obstacles.

2 Micro Servo Rotates the ultrasonic sensor to scan the


environment, allowing the robot to detect obstacles

9
VRT3043

in different directions and adjust its path


accordingly.

Integration and Operation

No. Component Functions

1 DC Geared Motors Provide the necessary torque and speed to drive the
wheels, enabling the robot's movement.

Summary of Component Functions

● Arduino Uno Board: Central control unit for processing inputs and executing control
commands.
● L298 Motor Driver: Manages motor speed and direction based on Arduino signals.
● Ultrasonic Sensor: Detects obstacles by measuring distance through ultrasonic waves.
● Wheels: Facilitate movement.
● Hammer Caster: Enhances stability and balance.
● Micro Servo: Rotates the ultrasonic sensor for environmental scanning.
● Battery Box: Supplies power to all components.
● Wiring: Ensures electrical connectivity and signal transmission.
● Acrylic Chassis: Provides structural support.

10
VRT3043

5.0 ASSEMBLY PROCESS (AFHAM)

Step 1 – Assemble DC gear motor

1. Position the DC gear motor as shown in the diagram.


2. Secure it using the provided screws.
3. Ensure the motor is firmly attached to the car base.

11
VRT3043

Step 2: Assemble the On/Off Switch

1. Identify the location for the On/Off switch.


2. Insert the switch into the designated slot.
3. Fix it in place with screws.

12
VRT3043

Step 3: Assemble the Battery Box

1. Place the battery box at the specified location.


2. Attach it using screws from the bottom view.
3. Ensure the battery box is securely fastened.

Step 4: Assemble the Castor and Stand-Off

1. Locate the positions for the castor and stand-off.


2. Attach the castor to the bottom of the car.
3. Fix the stand-off as shown in the top view.

13
VRT3043

Step 5: Assemble the Servo and Ultrasonic Sensor

1. Attach the servo to the designated spot.


2. Fix the ultrasonic sensor in place as indicated in the diagram.

14
VRT3043

Step 6: Assemble the Motor Driver Board and Arduino Uno Board

1. Position the Motor Driver Board on the car base.


2. Secure it with screws.
3. Place the Arduino Uno Board next to the Motor Driver Board.
4. Fix it in place using screws.

Step 7: Assemble the Arduino Sensor Shield

1. Attach the Arduino Sensor Shield to the Arduino Uno Board.


2. Ensure all pins are properly connected.

15
VRT3043

Step 8: Wiring (Refer to Circuit Diagram)

1. Connect the left gear motor to the Motor Driver Board.


2. Connect the right gear motor similarly.
3. Attach the on/off switch wires as shown.
4. Connect the sensor shield wires (-5V Red, Ground Brown).
5. Ensure the battery box black wire is connected as indicated.

16
VRT3043

6.0 CODE

/*
2WD Demo code by https://www.gie.com.my

Using
- Arduino Uno Compatible
- Arduino Sensor Shield
- L298 Motor Driver Module
- Ultrasnic Sensor
- Servo SG90s
*/

#include <Servo.h>

Servo myservo;

//for L298 Motor driver


const int Left_A = 10; // left motor A
const int Left_B = 11; // left motor B
const int SpeedA = 6; // speed control for left motor
const int Right_A = 12; // right motor A
const int Right_B = 13; // right motor B
const int SpeedB = 5; // speed control for right motor

//for Ultrasonic sensor


const int trigPin = 2; // Ultrasonic Trigger Pin (output)
const int echoPin = 7; // Ultrasonic Echo Pin (input)

const int STEPS = 100; // milli second(ms) per step

void setup() {

pinMode(Left_A, OUTPUT);
pinMode(Left_B, OUTPUT);
pinMode(SpeedA, OUTPUT);
pinMode(Right_A, OUTPUT);
pinMode(Right_B, OUTPUT);
pinMode(SpeedB, OUTPUT);
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input

//set initial value


digitalWrite(Left_A, HIGH);
digitalWrite(Left_B, HIGH);
digitalWrite(Right_A, HIGH);
digitalWrite(Right_B, HIGH);

myservo.attach(9); // attaches the servo on pin 9 to the servo object

17
VRT3043

myservo.write(90);
delay(500);
servoDemo();
delay(500);
myservo.write(90);
delay(500);

setSpeed(150);

forward();
delay(5000); //moving forward for 5 second

stopmoving(); //stop moving


delay(1000);

backward();
delay(5000); //moving backward for 5 second
stopmoving(); //stop moving
delay(1000);

turnleft();
delay(5000); //turn left for 5 second
stopmoving(); //stop moving
delay(1000);

turnright();
delay(5000); //turn right for 5 second
stopmoving(); //stop moving
delay(1000);

void servoDemo() {
int pos = 0;
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}

for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
}

void setSpeed(int value) {

18
VRT3043

analogWrite(SpeedA, value);
analogWrite(SpeedB, value+40);
}

void stopmoving() {
digitalWrite(Left_A, HIGH);
digitalWrite(Left_B, HIGH);
digitalWrite(Right_A, HIGH);
digitalWrite(Right_B, HIGH);
}

void backward() {
digitalWrite(Left_A, HIGH);
digitalWrite(Left_B, LOW);
digitalWrite(Right_A, HIGH);
digitalWrite(Right_B, LOW);
delay(STEPS);
}

void forward() {
digitalWrite(Left_A, LOW);
digitalWrite(Left_B, HIGH);
digitalWrite(Right_A, LOW);
digitalWrite(Right_B, HIGH);
delay(STEPS);
}

void turnleft() {
digitalWrite(Left_A, HIGH);
digitalWrite(Left_B, HIGH);
digitalWrite(Right_A, LOW);
digitalWrite(Right_B, HIGH);
delay(STEPS);
}

void turnright() {
digitalWrite(Left_A, LOW);
digitalWrite(Left_B, HIGH);
digitalWrite(Right_A, HIGH);
digitalWrite(Right_B, HIGH);
delay(STEPS);
}

//true = turn left


//false = turn right
//by using servo
bool checkObstacle() {
long cm150, cm30;

stopmoving();

19
VRT3043

myservo.write(150);
delay(300);
cm150 = getDistance();

myservo.write(30);
delay(300);
cm30 = getDistance();
delay(300);

myservo.write(90);
delay(50);

if (cm150 >= cm30)


return true;
else
return false;

void rightCircle() {
digitalWrite(Left_A, LOW);
digitalWrite(Left_B, HIGH);
digitalWrite(Right_A, HIGH);
digitalWrite(Right_B, LOW);
}

void leftCircle() {
digitalWrite(Left_A, HIGH);
digitalWrite(Left_B, LOW);
digitalWrite(Right_A, LOW);
digitalWrite(Right_B, HIGH);
}

long microsecondsToCentimeters(long microseconds) {


// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the object we
// take half of the distance travelled.
return microseconds / 29 / 2;
}

long getDistance() {
long cm, duration;

// Sets the trigPin on HIGH state for 10 micro seconds


digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

20
VRT3043

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
cm = microsecondsToCentimeters(duration);

return cm;
}

void loop(){

long cm1, cm2;


bool leftOrRight;
while (1) {
forward();
delay(30);
cm1 = getDistance();

if (cm1 < 20) {


leftOrRight = checkObstacle();
backward();
delay(400);

if (leftOrRight == true) {
turnleft();
delay(500);
stopmoving();
}
else {
turnright();
delay(500);
stopmoving();
}
}
}

21
VRT3043

7.0 CONCLUSION

The integration and functionality of a variety of control systems to achieve autonomous


navigation and obstacle avoidance are effectively demonstrated by the 2WD Smart Robot Car
project. Mechanical, electronic, electric, and control systems were successfully integrated
during the robot car's assembly with the kit provided. This project enhanced the
comprehension of robotics and control systems by providing practical experience in circuit
design, programming, and troubleshooting. The significance of practical problem-solving
skills and interdisciplinary knowledge was underscored. Future opportunities for
development include the integration of advanced navigation algorithms, additional sensors,
and wireless control. In general, the project established a strong foundation in robotics,
providing practical skills and valuable insights that are applicable to future endeavours in the
field.

22

You might also like