0% found this document useful (0 votes)
28 views9 pages

Description of The Assignment

The document reports on a student's 4wd obstacle avoidance robot car project. The student built a 4wd robot car that can move and respond to its surroundings using ultrasonic and infrared sensors. The robot's mechanical assembly consists of four modules: an infrared detection module, main control module, motor drive module, and ultrasonic sensor module. An Arduino UNO microcontroller is used to program and control the robot to avoid obstacles by changing direction or backing up when objects are detected within a certain distance range.

Uploaded by

Mlungisi Mankani
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)
28 views9 pages

Description of The Assignment

The document reports on a student's 4wd obstacle avoidance robot car project. The student built a 4wd robot car that can move and respond to its surroundings using ultrasonic and infrared sensors. The robot's mechanical assembly consists of four modules: an infrared detection module, main control module, motor drive module, and ultrasonic sensor module. An Arduino UNO microcontroller is used to program and control the robot to avoid obstacles by changing direction or backing up when objects are detected within a certain distance range.

Uploaded by

Mlungisi Mankani
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/ 9

ROBOTICS PROJECT: REPORT

Student Name Mlungisi Mankani


Student Number 70077005
Chinese Name 曼卡尼
Title 4wd obstacle avoidance robot car

Introduction
In this project I demonstrate the basics of building the 4wd obstacle avoidance car. The 4wd (four wheel drive)
obstacle avoidance car can move and respond to its surroundings. I will start by the basics of its mechanical
assembly and give explanation on some of the operations of some of the components of the 4wd robot. On the
software part of the 4wd robot the programming was accomplished using the Arduino IDE. Arduino UNO is used
as a central component to which all other components are interfaced. Arduino UNO is an open source hardware
development board. The board is furnished with a mix of input-output pins, both analog and digital. The pins are
utilized to interface the Arduino board with different shields and circuit boards. The board comprises of 14 digital
pins and 6 analog pins and it is programmable with an intergrated development system called Arduino IDE with the
assistance of a B type USB link. I powered it with two 3.7volts batteries in spite of the fact that it acknowledges
voltages in the scope of 7 to 20 volts. The 4wd robot consists of other major components such as 4 motors
that enable its motion and the ultrasonic, infra red sensors which are essential for the responses it exhibits to its
environment. I chose a four wheeled platform because four wheel drive makes it easier to roam over the rougher
surfaces compared to the two wheel platform.

Objectives
Building a 4wd obstacle avoidance robot car, enabling the robot to see the ground and detect the edge by the use
of IR sensors and measuring the distance of a target object to be able to avoid collision with the object and to
change its direction to avoid these objects.

How the 4wd Robot Move


The 4wd obstacle avoidance robot car moves forward,back,left and right much like a conventional car. Robot
moves forward as the left and right wheels turn forward due to the power transmitted from the motors which act
as the actuators in the 4wd robot car. If the wheels on one side are not driven or are driven more slowly than the
other side the robot will turn. Unlike a car but a little like a tank the 4wd robot can also rotate in place by driving
the wheels on each side in different directions. If the wheels are on each side are spinning in opposite directions,
the robot will rotate.

Mechanical Assembly
The mechanical structure is simple and easy to install. There are mainly four modules:

• Infrared signal detection module

• Main control module

• Motor drive module

• Ultrasonic sensor module

The installation design was welding free. The components are fixed by copper pillars and screws. The circuit
connection between each module is connected by Du Pont wire, which is simple and and convenient.

1
Hardware Required
• 2× 3.7volts 18650 2500mah lithium batteries

• 2× 4-wheel trolley floor

• CH340 Uno R3 with USB development board (with data cable)

• L298N motor drive module

• Ultrasonic sensor module

• Four-way tracking module

• 4× 5volts DC gear motor (with wheels)

• Ultrasonic bracket

• 8× Motor fixing bracket (acrylic transparent)

• 4× Speed Code Disc (Black)

• 18650 battery box with switch

• 3× M3*50 copper pillar

• 8× M3*30 copper pillar

• 2× M3*15+6 copper pillar

• 17× M3 nuts

• 33× M3*8 round head screw

• 8× M3*30 round head screws

• 3× M2 nut

• 2× M2*8 round head screws

• 4× M1.6*8 round head screws

• 4× M1.6 nut

• 1× Male to female Dupont wire 300mm

• 15× Male to female Dupont line 200mm

• 8× Male to male Dupont line 200mm

• 4× Male to female Dupont wire 100mm

• 2× Male to male Dupont line 100mm

Specifications:
• Power supply: 2 removable 3.7volts lithium batteries

• Input: infrared sensors (four channel) ultrasonic module (HC-SR04)

• Motor: DC geared motor

• Motor drive: L298N module

• Microprocessor: UNO R3 controller

2
Component Description
L298N Module

• Input voltage of logic part: 6 7V

• Input voltage of drive part vs: 4.8 to 46v

• Working current of logic part is: less than 37mah

• Working current of driving part is: less than 3A

• Maximum dissipation power: 25W (t = 75o C)

• Control signal input level: high level: 2.3v to VIN vs low level:-0.3V¡=VIN¡=1.5v

• Working temperature:-25o C +130o C

• Driving mode: double channel high power H-bridge drive.

L298N module works by:

State ENA
Stop 0
Break 1
Forward 1
Back 1
Left 1
Right 1

HC-SR04 Module

• Electrical parameters - HC-SR04 Ultrasonic module

• Working voltage - DC-5V

• Working current - 15mA

• Working frequency -40KHz

3
• Maximum range - 4m

• Minimum range - 2cm

• Measuring angle - 15o

• Input trigger signal - 10 US TTL pulse

• Output echo signal- Output TTL level signal, proportional to the range.

• Size - 45*20*15

Ultrasonic obstacle avoidance work by:

1. Transmitter sends signal: high-frequency sound.

2. When a signal finds an object, it is reflected.

3. Receiver (echo pin): Receives the signal reflected back from it.

The HC-SR04 ultrasonic sensor detects how far ahead obstacle has appeared. If there is an obstacle in your
specified detention range, the car can make corresponding actions. For example, forward, back, turn left or turn
right.

Four channel tracking module

Description Value
Electrical parameters Four channel tracking module
Working voltage DC 3.3V 5V
Working current 1A
Working temperature -10o C 50o C
Mounting aperture M3
Detect distance 1mm 600mm
Size 42×38mm
Output signal TTL level

Four channel tracking module works by:


The sensor belongs to infrared reflection detection, so the reflectivity and shape of the target is the key to the
detection range. Among them, the black detection distance is the shortest and the white detection distance is the
longest. Small area object distance is short, large area object distance is long. Infrared detection method is the
use of infra red light in various colours of the object surface has different reflection intensity characteristics.

Arduino Program
Arduino Code

4
Listing 1: Code.ino
/∗
#i n c l u d e <AFMotor . h>
#d e f i n e T r i g 12
#d e f i n e Echo 13
#d e f i n e ENA 5
#d e f i n e ENB 6
#d e f i n e IN1 3
#d e f i n e IN2 4
#d e f i n e IN3 2
#d e f i n e IN4 7
f l o a t cm ; // D i s t a n c e v a r i a b l e
f l o a t temp ; //

void setup () {
S e r i a l . begin (9600);
pinMode ( T r i g , OUTPUT ) ;
pinMode ( Echo , INPUT ) ;

pinMode ( IN1 , OUTPUT ) ;


pinMode ( IN2 , OUTPUT ) ;
pinMode ( IN3 , OUTPUT ) ;
pinMode ( IN4 , OUTPUT ) ;

pinMode (ENA , OUTPUT ) ;


pinMode (ENB , OUTPUT ) ;
}

void loop () {
d i g i t a l W r i t e ( Trig , LOW) ;
delayMicroseconds (2);
d i g i t a l W r i t e ( Trig , HIGH ) ;
delayMicroseconds (10);
d i g i t a l W r i t e ( Trig , LOW) ;

temp = f l o a t ( p u l s e I n ( Echo , HIGH ) ) ;


cm = ( temp ∗ 17 ) / 1 0 0 0 ;
i f ( cm < 30 && cm > 1 0 )
{
back ( ) ;
delay (500);
Left ();
delay (200);
}
i f ( cm >= 3 0 )
{
forward ( ) ;
delay (100);
}

i f ( cm < 1 0 )
{
STOP ( ) ;
}
S e r i a l . p r i n t ( ” Echo = ” ) ;
S e r i a l . p r i n t ( temp ) ;
S e r i a l . p r i n t (” | | D i s t a n c e = ” ) ;

5
S e r i a l . p r i n t ( cm ) ;
S e r i a l . p r i n t l n ( ” cm ” ) ;
delay (100);
}

void forward () {
a n a l o g W r i t e (ENA , 2 2 0 ) ;
a n a l o g W r i t e (ENB , 2 2 0 ) ;

d i g i t a l W r i t e ( IN1 , HIGH ) ;
d i g i t a l W r i t e ( IN2 , LOW) ;
d i g i t a l W r i t e ( IN3 , LOW) ;
d i g i t a l W r i t e ( IN4 , HIGH ) ;
S e r i a l . p r i n t l n (” Forward ” ) ;
}

v o i d back ( ) {
a n a l o g W r i t e (ENA , 2 2 0 ) ;
a n a l o g W r i t e (ENB , 2 2 0 ) ;
d i g i t a l W r i t e ( IN1 , LOW) ;
d i g i t a l W r i t e ( IN2 , HIGH ) ;
d i g i t a l W r i t e ( IN3 , HIGH ) ;
d i g i t a l W r i t e ( IN4 , LOW) ;
S e r i a l . p r i n t l n ( ” Back ” ) ;
}

void Left () {
a n a l o g W r i t e (ENA , 2 2 0 ) ;
a n a l o g W r i t e (ENB , 2 2 0 ) ;
d i g i t a l W r i t e ( IN1 , LOW) ;
d i g i t a l W r i t e ( IN2 , HIGH ) ;
d i g i t a l W r i t e ( IN3 , LOW) ;
d i g i t a l W r i t e ( IN4 , HIGH ) ;
S e r i a l . p r i n t l n (” L e f t ” ) ;
}

void Right () {
a n a l o g W r i t e (ENA , 2 2 0 ) ;
a n a l o g W r i t e (ENB , 2 2 0 ) ;
d i g i t a l W r i t e ( IN1 , HIGH ) ;
d i g i t a l W r i t e ( IN2 , LOW) ;
d i g i t a l W r i t e ( IN3 , HIGH ) ;
d i g i t a l W r i t e ( IN4 , LOW) ;
S e r i a l . p r i n t l n (” Righ t ” ) ;
}

v o i d STOP ( ) {
d i g i t a l W r i t e (ENA , LOW) ;
d i g i t a l W r i t e (ENB , LOW) ;
d i g i t a l W r i t e ( IN1 , LOW) ;
d i g i t a l W r i t e ( IN2 , LOW) ;
d i g i t a l W r i t e ( IN3 , LOW) ;
d i g i t a l W r i t e ( IN4 , LOW) ;
S e r i a l . p r i n t l n ( ”STOP ” ) ;
}
}

6
Code Explanation
When the transmitting pin of the ultrasonic module detects an obstacle in front, the reflected pin will receive the
signal and transmit it to the MCU through IO pin. After the SIGNAL is received, the MCU will drive the L298N
module to realize the corresponding action of the motor. For example, if an obstacle is detected in the front range
less than 30cm and larger than 10cm, the MCU will control the car to retreat successively and then turn left; while
in the front range less than 10cm, the car will stop, while in the front range greater than 30cm, the car will move
forward without any obstacle detected.

Conclusion
In this Project, the field of Robotics is investigated and a robotic car which has potential to be equipped with
many functionalities is proposed. The designed model detects any obstacle encountered in front of it. During the
project, complete working of Arduino UNO is and sensors is understood and executed. The project gives profound
knowledge into Arduino IDE and gives good exposure to coding. Below is the circuit diagram and images that were
taken during the assembly of the 4wd robot car.

Circuit Diagram

7
Images

8
9

You might also like