Soccer Robot 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 60

SOCCER ROBOT

Session (2019 - 2023)


Bachelor of Studies in Computer Science

Submitted By
Muhammad Faizan 57089
Waqar Ahmad 57158

Supervised By
Prof. Zulfiqar Ahmed
Assistant Professor, Department of CS & IT

Hazara University, Mansehra


Approval Certificate

This is certifying that we have read the project report titled “SOCCER ROBOT” submitted by
following students of BSCS Hazara University Mansehra.

Name Roll No.


Muhammad Faizan 57089
Waqar Ahmad 57158

It is our judgment that this project report is of sufficient standard to warrant its acceptance by the
Department of Information Technology, Hazara University Mansehra.

COMMITTEE

1. Supervisor _________________________________

2. Head of Department _________________________________

3. External Examiner _________________________________

SOCCER ROBOT ii
Declaration

It is hereby declared that this project, neither as a whole nor as a part has been copied out from any
source. It is further declared that we developed this software and this report entirely on the basis
of my personal efforts made under the sincere guidance of my project Supervisor.
If any part of this software is proved to be copied or found to be a report of some other, we
standby the consequences. No portion of the work presented in this report has been submitted in
support of any application from any other degree of qualification of any other university or institute
of learning. We further declare that this software and all associated documents, reports and records
are submitted as partial requirement for the degree of BSSE (Bachelor of Studies in Software
Engineering). We therefore understand and transfer copyrights for these materials to Hazara
University Mansehra.

. .

Muhammad Faizan Waqar Ahmad


.

SOCCER ROBOT iii


Acknowledgements

I would like to express my special thanks and gratitude to my teachers as well my supervisors who
gave me the golden opportunity to do this wonderful project on the topic SOCCER ROBOT,
which also helped me in doing a lot of research and we came to know about so many new things.
Also my first thanks also goes to Hazara University Mansehra for designing such a worthy
syllabus and making me do this project. Secondly we are thankful to the faculty of the CS&IT
department without whom my project would have been impossible. Especially my heartfelt thanks
goes to Prof. Zulfiqar Ahmed, my project supervisor who constantly supervised me throughout
the project time period.

SOCCER ROBOT iv
Dedication
This Thesis report we dedicated to
Our Beloved Parents
And Respected Teachers

SOCCER ROBOT v
Project In Brief

Project Title : SOCCER ROBOT


Developed By : Muhammad Faizan and Waqar Ahmad
Supervised By : Prof. Zulfiqar Ahmed
Tools Used : Arduino IDE and Arduino UNO With all Hardware
Component
System Used : Haier core i7, 8 GB RAM
Operating System : Microsoft Windows 10
Starting Date : April 2023
Completion Date : June 2023

SOCCER ROBOT vi
Table of Content

1.1 Introduction ........................................................................................................................... 1


1.2 Background of the Project .................................................................................................... 1
1.3 Scope of the Project .............................................................................................................. 2
1.4 Feasibility Report of the Project ........................................................................................... 2
1.4.1 Technical Feasibility .................................................................................................................... 2
1.4.2 Economic Feasibility.................................................................................................................... 2
1.5 Future Movement of the Project ........................................................................................... 3
1.6 Introduction of the Tool used in the Project ......................................................................... 3
1.6.1 NodeMCU .................................................................................................................................... 3
1.6.2 L293D Motor Drive ..................................................................................................................... 4
1.6.3 3.7v Lithium battery..................................................................................................................... 5
1.6.4 Smart Car kit ................................................................................................................................ 5
1.6.5 Connecting Wire .......................................................................................................................... 6
1.7 MIT App Inventor ................................................................................................................. 6
1.8 Report Introduction ............................................................................................................... 7

2.1 Introduction ........................................................................................................................... 9


2.2 Existing Soccer Robotic Game ........................................................................................... 10
2.3 Soccer Playing Robot Working .......................................................................................... 10
2.4 Why we need this soccer gaming robots Project ................................................................ 11

3.1 Overview of the Proposed System ...................................................................................... 12


3.2 Block Diagram .................................................................................................................... 13
3.3 Activity Diagram ................................................................................................................ 14
3.4 System Design approach ..................................................................................................... 15
3.4.1 Hardware Prototype ................................................................................................................... 15

SOCCER ROBOT vii


3.4.2 Controller side ............................................................................................................................ 18

4. 1 Testing................................................................................................................................ 19
4.2 Black Box Testing............................................................................................................... 20
4.3 Test Cases Scenario ............................................................................................................ 20
4.3.1 NodeMCU individual Test ......................................................................................................... 20
4.3.2 Android Application test ............................................................................................................ 21
4.3.3 Overall Developed Project Test with Working .......................................................................... 21
4.3.4 Android Application Button test ................................................................................................ 22
4.3.5 Car Circuit Test .......................................................................................................................... 22
4.4 Branch testing ............................................................................................................................... 23

5.1 General View of Project...................................................................................................... 24


5.2 Hardware Prototype Image ................................................................................................. 25
5.3 Smartphone Application Screenshot ................................................................................... 28

6.1 Training Manual.................................................................................................................. 29


6.2 Coding ................................................................................................................................. 33

SOCCER ROBOT viii


List of Figures

FIGURE 1.1 : ROBOTS LOOK LIKE A HUMANS ....................................................................................................1

FIGURE 1.2 : ECONOMIC FEASIBILITY GRAPH ...................................................................................................2

FIGURE 1.3: NODE MCU............................................................................................................................................3

FIGURE 1.4 : L293D MOTOR DRIVE ........................................................................................................................ 4

FIGURE 1.5: 3.7 VOLT CELL .....................................................................................................................................5

FIGURE 1.6: CAR KIT .................................................................................................................................................5

FIGURE 1.7: JUMPER WIRES ....................................................................................................................................6

FIGURE 1.8 : MIT APP INVENTOR ........................................................................................................................... 7

FIGURE 2.1 : SPORT ROBOT IDEA .......................................................................................................................... 9

FIGURE 2.2 : SOCCER PLAYING ROBOT ............................................................................................................. 10

FIGURE 3.1: SYSTEM ARCHITECTURE ................................................................................................................ 12

FIGURE 3.2 : BLOCK DIAGRAM ............................................................................................................................ 13

FIGURE 3.3 : ACTIVITY DIAGRAM ....................................................................................................................... 14

FIGURE 3.4 : HARDWARE PROTOTYPE FROM SIDE ......................................................................................... 15

FIGURE 3.5 : HARDWARE PROTOTYPE FROM TOP .......................................................................................... 16

FIGURE 5.4 : HARDWARE PROTOTYPE IMAGE ................................................................................................. 17

FIGURE 5.5 : HARDWARE PROTOTYPE IMAGE ................................................................................................. 17

FIGURE 3.6 : SMARTPHONE APPLICATION SCREENSHOT ............................................................................. 18

FIGURE 4.1 : GENERAL TESTING.......................................................................................................................... 19

FIGURE 5.1 : GENERAL VIEW OF PROJECT ........................................................................................................ 24

FIGURE 5.2: HARDWARE PROTOTYPE IMAGE .................................................................................................. 25

FIGURE 5.3 : HARDWARE PROTOTYPE IMAGE ................................................................................................. 26

FIGURE 5.4 : HARDWARE PROTOTYPE IMAGE ................................................................................................. 26

FIGURE 5.5 : HARDWARE PROTOTYPE IMAGE ................................................................................................. 27

FIGURE 5.6 : SMARTPHONE APPLICATION SCREENSHOT ............................................................................. 28

FIGURE 6.1: ARDUINO IDE ..................................................................................................................................... 29

SOCCER ROBOT ix
FIGURE 6.2 : CONNECTION OF NODEMCU TO LAPTOP .................................................................................. 30

FIGURE 6.3 : MIT INVENTOR FRONT INTERFACE DURING CONSTRUCTION ............................................ 31

FIGURE 6.4 : BLOCK CODE OF MIT APP INVENTOR ........................................................................................ 32

SOCCER ROBOT x
List of Tables

TABLE 1: NODEMCU INDIVIDUAL TEST ............................................................................................................ 20

TABLE 2 : ANDROID APPLICATION TEST .......................................................................................................... 21

TABLE 3 : OVERALL DEVELOPED PROJECT TEST WITH WORKING ........................................................... 21

TABLE 4 : ANDROID APPLICATION BUTTON TEST ......................................................................................... 22

TABLE 5 : CAR CIRCUIT TEST ............................................................................................................................... 22

SOCCER ROBOT xi
List of Abbreviations

IoT Internet of Things


PCB Printed circuit boards
MB Mega byte
KB Kilo Byte
UIDs unique identifiers
DIO Digital I/O Pins
ADC Analog Input Pins
IDE Integrated development environment

SOCCER ROBOT xii


Introduction
1.1 Introduction
Internet of Things (IoT) is a network of physical objects or people called “things” that are
embedded with software, electronics, network, and sensors that allow these objects to collect and
exchange data. The goal of IoT is to extend to internet connectivity from standard devices like
computer, mobile, tablet to relatively dumb devices like a toaster.
The internet of things, or IoT, is a system of interrelated computing devices, mechanical and digital
machines, objects, animals or people that are provided with unique identifiers (UIDs) and the
ability to transfer data over a network without requiring human-to-human or human-to-computer
interaction. [1]
1.2 Background of the Project
With the development in the field of robotics, human intrusion has become less and robots are
being widely used for safety purpose.
On the other hand, one technology that grows at this moment is the Robotic technology. Robots
can help people performing certain jobs, especially in the field that requires a high degree of
precision, high-risk, or a job that requires a great power. In general, the robot can be defined as a
mechanical device capable of performing human tasks or behave like humans

Figure 1.1 : Robots look like a humans

SOCCER ROBOT 1
1.3 Scope of the Project
Robotics, the design, construction and use of machines (robots) to perform tasks traditionally
performed by humans. Robots are widely used in industries such as automobile manufacturing to
perform simple and repetitive tasks, and industries that must work in environments that are harmful
to humans.
In gaming robots, robots can be used to create realistic environments or to provide haptic feedback
that makes the game feel more real.

1.4 Feasibility Report of the Project


1.4.1 Technical Feasibility
Today everyone is familiar with the use of smartphone and soccer game. There is no need of any
special skills required to play this game. So, the project is technically feasible too.
1.4.2 Economic Feasibility
Soccer robots is an economically feasible project. For the first time, user just need to purchase the
some pre build hardware (mentioned in the tools sections). All the project hardware are easily
available in the market and cheaper.

Figure 1.2 : Economic Feasibility Graph

SOCCER ROBOT 2
1.5 Future Movement of the Project
The future scope of this project is that we could build a team of soccer robots in future. Also if we
move forward in future more we could make such robots which play with human as human play
in teams.

1.6 Introduction of the Tool used in the Project


Following are the tool used in this project:
1.6.1 NodeMCU
NodeMCU is an open-source Lua based firmware and development board specially targeted for
IoT based Applications. [2]
Since NodeMCU is an open-source platform, its hardware design is open for edit/modify/build.
NodeMCU Dev Kit/board consist of ESP8266 wifi enabled chip. The ESP8266 is a low-cost Wi-
Fi chip developed by Espressif Systems with TCP/IP protocol. For more information about
ESP8266, you can refer to the ESP8266 WiFi Module.
There is Version2 (V2) available for NodeMCU Dev Kit i.e. NodeMCU Development Board v1.0
(Version2), which usually comes in black colored PCB. [3]

Figure 1.3: Node MCU

SOCCER ROBOT 3
NodeMCU ESP8266 Specifications & Features
 Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106
 Operating Voltage: 3.3V
 Input Voltage: 7-12V
 Digital I/O Pins (DIO): 16
 Analog Input Pins (ADC): 1
 UARTs: 1
 SPIs: 1
 I2Cs: 1
 Flash Memory: 4 MB
 SRAM: 64 KB
 Clock Speed: 80 MHz
 USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
 PCB Antenna
 Small Sized module to fit smartly inside your IoT projects

1.6.2 L293D Motor Drive


The L293D is a popular 16-Pin Motor Driver IC. As the name suggests it is mainly used to drive
motors. A single L293D IC is capable of running two DC motors at the same time; also the
direction of these two motors can be controlled independently. So if you have motors which has
operating voltage less than 36V and operating current less than 600mA, which are to be controlled
by digital circuits like Op-Amp, 555 timers, digital gates or even Microcontrollers like Arduino,
PIC, ARM etc.. This IC will be the right choice for you. [4]

Figure 1.4 : L293D Motor Drive

SOCCER ROBOT 4
1.6.3 3.7v Lithium battery
 3.7V 18650 sizes Cylindrical Li-Ion Cell
 No memory effect and longer storage life than NiMH Batteries
 Lighter weight and higher energy density than any other rechargeable battery
 It is excellent to use as standard for text battery analyzer, used in DIY projects and power
banks.
 Nominal Voltage: Average 3.7V
 Nominal Capacity: 800mAh
 Max. Charging current 2.6A max.
 Max. Discharging current: 5.2A max.

Figure 1.5: 3.7 Volt Cell


1.6.4 Smart Car kit
The Arduino car kit provides you with everything you need to give your robot a fast four-wheel-
drive platform with plenty of room for expansion to add various sensors and controllers. Just add
your electronics - Arduino/Raspberry Pi and Motor Driver and you can start programming your
robot. [5]

Figure 1.6: Car Kit

SOCCER ROBOT 5
1.6.5 Connecting Wire
A jumper wire is an electric wire that connects remote electric circuits used for printed circuit
boards. By attaching a jumper wire on the circuit, it can be short-circuited and short-cut (jump) to
the electric circuit. [6]

Figure 1.7: Jumper Wires

1.7 MIT App Inventor


MIT App Inventor is a web application integrated development environment originally provided
by Google, and now maintained by the Massachusetts Institute of Technology (MIT). It allows
newcomers to computer programming to create application software (apps) for two operating
systems (OS): Android and iOS, which, as of 20 January 2023, is in final beta testing. It is free and
open-source software released under dual licensing: a Creative Commons Attribution ShareAlike
3.0 Unported license and an Apache License 2.0 for the source code.
It uses a graphical user interface (GUI) very similar to the programming languages Scratch
(programming language) and StarLogo, which allows users to drag and drop visual objects to
create an application that can be tested on Android and iOS devices and built to run as an Android
app. It uses a companion mobile app that allows for instant live testing and debugging. In creating
App Inventor, Google drew upon significant prior research in educational computing, and work
done within Google on online development environments.
App Inventor and the other projects are based on and informed by constructionist learning theories,
which emphasize that programming can be a vehicle for engaging powerful ideas through active
learning. As such, it is part of an ongoing movement in computers and education that began with

SOCCER ROBOT 6
the work of Seymour Papert and the MIT Logo Group in the 1960s, and has also manifested itself
with Mitchel Resnick's work on Lego Mindstorms and StarLogo. [7]
App Inventor also supports the use of cloud data via its CloudDB component.

Figure 1.8 : MIT App inventor

1.8 Report Introduction


This thesis report consist of six chapters:
i. Chapter1: Introduction
This Chapter include only introduction which provides a brief introduction of the project,
future scope, tools used in the project and background of the project as mentioned previous.

ii. Chapter 2: Present system


The second chapter will include the basic discussion about Existing system.

SOCCER ROBOT 7
iii. Chapter 3 : Design of the Proposed System
This is the most important chapter of the project that contains all the diagrammatically
approaches and Software design approaches of the system.

iv. Chapter 4: Testing


This Chapter include the testing discussion of the project with each module test.

v. Chapter 5: Result and Project Screenshot


The second last chapter will include Hardware pictures.

vi. Chapter 6: Training manual and Reference

This is last chapter of my project report. This chapter will include training manual part and
content references.

SOCCER ROBOT 8
Requirement Specification
2.1 Introduction
Different innovations; building robots, began already ages ago until this present time. In fact, some
countries were already using robots as a useful machine for industry purposes and other innovative
projects. If we imagine how the world could be seeing robots scattered in different places with
different functions then life would be much easier. Somehow, disadvantages and crisis in making
and using those machines always have its way beneath everything. [8]
Soccer or football is a one type of sport played between two teams, where each team on the soccer
consist of 11 players and plays with a spherical ball. Soccer is the world’s most famous sport
played over 150 countries. Soccer game is played on a rectangular field with a goal at each end.
The main concept of this sport is to score by getting the spherical ball into the opposite goal. The
goal keepers stops the ball with their arms from the outfield players. When the team gets more
score at the end of the match, then that match will be declared as a win. But, at present robot
technology offering many services in the field of robotic vehicles, intelligent systems, soccer
playing robots, etc.

Figure 2.1 : Sport Robot Idea

SOCCER ROBOT 9
2.2 Existing Soccer Robotic Game
Every year Soccer playing robot participates in the competition held annually. The main concept
of this competition is to promote robotics in every field. A soccer robot is a one kind of mobile or
autonomous robot, used to play soccer with variants. Every year there are many tournaments are
organized like FIRA, Robocop. At present, the Robocop contest has various soccer leagues like
Simulation, Small Size, Middle Size, Four Legged and Humanoid. [9]

Figure 2.2 : Soccer Playing Robot

2.3 Soccer Playing Robot Working


The Soccer playing robot is high competition for industries, universities and research institutes.
Every year there are many tournaments are conducted and the biggest tournament was the German
Open RoboCup. Worldwide, there are more than 80 teams are expected to contest at the Hannover
Messe. In a soccer playing robot matches, a series of many leagues will be placing the latest
technologies on the display. [10]

SOCCER ROBOT 10
For a robot, playing of soccer is a highly complex attempt. The Robot must be able to constantly
identify the ball. There is a high tech equipment is arranged to scan the robot’s surroundings.
Internal processors of the robot can change the data to define game policies and strategies of
defense.

2.4 Why we need this soccer gaming robots Project


Robots eliminate various jobs for humans because they are capable of working in every field and
hazardous environments. They can handle lifting heavy loads, toxic substances and repetitive
tasks. This has helped companies to prevent many accidents, also saving time and money. After
the details discussion of the Soccer robots, Soccer robotic game is an interesting game and gamer
will enjoy to play this game.

SOCCER ROBOT 11
Design of the Proposed System
3.1 Overview of the Proposed System
Playing soccer is fun, but playing soccer with robots is awesome! The soccer
playing robot is one of the most popular robotics projects among children and is
also pretty simple to make.
Simply a Soccer Bot is a type of robot that can play Soccer. This type of robot
basically design in such a way that can remotely and autonomously play football.
It has some unique features and this robot is also can move very fast.
This soccer robot can move forward, left, right, and reverse with the help of an
Android phone. The robot also kicks ball when the user will click the left, right,
forward and reverse button from android application respectively.
The circuit uses three 3.7 volt batteries cell also one for the NodeMCU board and
the car kit is used. Android application is used on the user side to send the
command to NodeMCU. After receiving the command, soccer robot will move left,
right, forward and reverse respectively.

Figure 3.1: System Architecture

SOCCER ROBOT 12
3.2 Block Diagram
A block diagram is a diagram of a system in which the principal parts or functions are represented
by blocks connected by lines that show the relationships of the blocks. They are heavily used in
engineering in hardware design, electronic design, software design, and process flow diagrams.
The Block diagram of the Soccer Robots project are as under:

Figure 3.2 : Block Diagram

SOCCER ROBOT 13
3.3 Activity Diagram
An activity diagram visually presents a series of actions or flow of control in a system similar to a
flowchart or a data flow diagram. Activity diagrams are often used in business process modeling.
The Activity diagram of the Soccer Robots project are as under:

Figure 3.3 : Activity Diagram

SOCCER ROBOT 14
3.4 System Design approach
Project has been programmed using Node MCU. Node MCU is open source software which is
easily available for use and its modifications. It consists of a programmable circuit board and
software, IDE (Integrated Development Environment). With the connection of Node MCU board,
all mentioned hardware are used to move the soccer robots. For better understanding we can split
the project into two part that are:

3.4.1 Hardware Prototype


The hardware prototype picture of the project are as under:

Figure 3.4 : Hardware Prototype from side

SOCCER ROBOT 15
Figure 3.5 : Hardware Prototype from top

SOCCER ROBOT 16
Figure 3.6 : Hardware Prototype Image

Figure 3.7 : Hardware Prototype Image

SOCCER ROBOT 17
3.4.2 Controller side
User will send the move command to the soccer robots from the developed android application.
There are four button on the android application left, right, forward and reverse as shown in the
below screenshot.

th
Figure 3.8 : Smartphone Application Screenshot

SOCCER ROBOT 18
Testing
4. 1 Testing
Software Testing is an empirical investigation conducted to provide stakeholders with information
about the quality of the product or service under test, with respect to the context in which it is
intended to operate. Software Testing, depending on the testing method employed, can be
implemented at any time in the development process, however the most test effort is employed
after the requirements have been defined and coding process has been completed.
Moreover after developing the proposed Project named “SOCCER ROBOT”, I have covered all
the software testing steps to check whether my project meet with the expected requirements or not.
So my project have no bugs, no error and also hardware working properly in all tested steps.

Figure 4.1 : General Testing

SOCCER ROBOT 19
4.2 Black Box Testing
A strategy in which a software component is treated like an opaque box. This tests designers’ focus
on determining how well the component conforms to the published requirements for the
component, instead of worrying about the implementation details. Black box testing focuses on
the functional requirement of the software. Black box testing is not an alternative to white box
testing. Rather, it is a complementary approach that is likely to uncover a different class of errors
than white box testing method. So I also have used Black box testing used to find following errors
 Incorrect or missing functions.
 Interface errors.
 Performance errors.
 Initializing and termination errors

Now there is no major error found in Soccer Robots Project.

4.3 Test Cases Scenario


Following are the test cases which I have used to find the bug or error:

4.3.1 NodeMCU individual Test

Test Case Title NodeMCU individual Test


Use Case Id 01
Description Microcontroller individual Test

 It is verify that NodeMCU Working Properly


Cases
before the all connection

Test Results:
Successfully

Tested By Muhammad Faizan and Waqar Ahmad

Table 1: NodeMCU individual Test

SOCCER ROBOT 20
4.3.2 Android Application test
Test Case Title Developed Android Application Test with Working

Use Case Id 02

Description Project whole Working Test

 It is verify that android application working


Cases
properly.

Test Results:
Successfully

Tested By Muhammad Faizan and Waqar Ahmad

Table 2 : Android Application test

4.3.3 Overall Developed Project Test with Working

Test Case Title Developed Test with Working

Use Case Id 03

Description Developed Test with whole Working

Cases  It is verify that all the project working properly.

Test Results:
Successfully

Tested By Muhammad Faizan and Waqar Ahmad

Table 3 : Overall Developed Project Test with Working

SOCCER ROBOT 21
4.3.4 Android Application Button test
Test Case Title Android Application Button test

Use Case Id 4

Description Android Application Button test

 It is verify that android app button working


Cases
perfectly

Test Results:
Successfully

Tested By Muhammad Faizan and Waqar Ahmad

Table 4 : Android Application Button test


4.3.5 Car Circuit Test
Test Case Title Car Circuit Test
Use Case Id 5
Description Car Circuit Test
 It is verify that the circuit of the car working

Cases properly and there is no issue are coming from car


circuit.

Test Results:
Successfully

Tested By Muhammad Faizan and Waqar Ahmad

Table 5 : Car Circuit Test

SOCCER ROBOT 22
4.4 Branch testing
Branch Testing is defined as a testing method, which has the main goal to ensure that each one
of the possible branches from each decision point is executed at least once and thereby ensuring
that all reachable code is executed.
In the branch testing, each outcome from a code module is tested as if the outcomes are binary,
you need to test both True and False outcomes. My Project Advanced Soccer Robots Project
pass the branch test.
Branch testing also provides a method to measure the fraction of independent code segments and
also helps you to find out which is sections of code don’t have any branches.

SOCCER ROBOT 23
Results or Screen Shots
5.1 General View of Project
The general view of the project are under below. In the general view we can see the two sided of
the project. One side is smartphone application and second side is robot car as shown.

Figure 5.1 : General View of Project

SOCCER ROBOT 24
5.2 Hardware Prototype Image
The hardware prototype of the project are as under. In this project, we have used nodeMCU, battery
cell. Car kit, serve motor as shown in the below prototype

Figure 5.2: Hardware Prototype Image

SOCCER ROBOT 25
Figure 5.3 : Hardware Prototype Image

Figure 5.4 : Hardware Prototype Image

SOCCER ROBOT 26
Figure 5.5 : Hardware Prototype Image

SOCCER ROBOT 27
5.3 Smartphone Application Screenshot
User will send the move command to the soccer robots from the developed android application.
There are four button on the android application left, right, forward and reverse as shown in the
below screenshot.

Figure 5.6 : Smartphone Application Screenshot

SOCCER ROBOT 28
Reference Manual or Training Manual
6.1 Training Manual
Project is based on the advance Internet of Thing technology. I programmed the NodeMCU
microcontroller using Arduino IDE. The Arduino IDE uses C++ but of course the physical
environment is limited so not all C/C++ features can be used and the Arduino environment has
helper functions to enable you to use the hardware easily and the Serial monitor for input/output.
Arduino IDE is open source platform.

Figure 6.1: Arduino IDE

SOCCER ROBOT 29
For the system to work, first I have to connect the Computer system with NodeMCU to upload
source code

Figure 6.2 : Connection of NodeMCU to Laptop

SOCCER ROBOT 30
For the development of Smartphone application I have used MIT app Inventor. Using MIT App
inventor Application easily built and will have a perfect interface.
The construction mode of the application screenshot in MIT app Inventor are under below:

Figure 6.3 : MIT inventor Front Interface during Construction

SOCCER ROBOT 31
The Block Code of Smartphone Application are below:

Figure 6.4 : Block Code of MIT app Inventor

SOCCER ROBOT 32
6.2 Coding
#define ENA 14 // Enable/speed motors Right GPIO14(D5)

#define ENB 12 // Enable/speed motors Left GPIO12(D6)

#define IN_1 15 // L298N in1 motors Rightx GPIO15(D8)

#define IN_2 13 // L298N in2 motors Right GPIO13(D7)

#define IN_3 2 // L298N in3 motors Left GPIO2(D4)

#define IN_4 0 // L298N in4 motors Left GPIO0(D3)

#include <ESP8266WiFi.h>

#include <WiFiClient.h>

#include <ESP8266WebServer.h>

String command; //String to store app command state.

int speedCar = 800; // 400 - 1023.

int speed_Coeff = 3;

const char* ssid = "FYP By Waqar & Faizan";

ESP8266WebServer server(80);

void setup() {

pinMode(ENA, OUTPUT);

pinMode(ENB, OUTPUT);

SOCCER ROBOT 33
pinMode(IN_1, OUTPUT);

pinMode(IN_2, OUTPUT);

pinMode(IN_3, OUTPUT);

pinMode(IN_4, OUTPUT);

Serial.begin(115200);

// Connecting WiFi

WiFi.mode(WIFI_AP);

WiFi.softAP(ssid);

IPAddress myIP = WiFi.softAPIP();

Serial.print("AP IP address: ");

Serial.println(myIP);

// Starting WEB-server

server.on ( "/", HTTP_handleRoot );

server.onNotFound ( HTTP_handleRoot );

server.begin();

void goAhead(){

SOCCER ROBOT 34
digitalWrite(IN_1, LOW);

digitalWrite(IN_2, HIGH);

analogWrite(ENA, speedCar);

digitalWrite(IN_3, LOW);

digitalWrite(IN_4, HIGH);

analogWrite(ENB, speedCar);

void goBack(){

digitalWrite(IN_1, HIGH);

digitalWrite(IN_2, LOW);

analogWrite(ENA, speedCar);

digitalWrite(IN_3, HIGH);

digitalWrite(IN_4, LOW);

analogWrite(ENB, speedCar);

void goRight(){

SOCCER ROBOT 35
digitalWrite(IN_1, HIGH);

digitalWrite(IN_2, LOW);

analogWrite(ENA, speedCar);

digitalWrite(IN_3, LOW);

digitalWrite(IN_4, HIGH);

analogWrite(ENB, speedCar);

void goLeft(){

digitalWrite(IN_1, LOW);

digitalWrite(IN_2, HIGH);

analogWrite(ENA, speedCar);

digitalWrite(IN_3, HIGH);

digitalWrite(IN_4, LOW);

analogWrite(ENB, speedCar);

void goAheadRight(){

digitalWrite(IN_1, LOW);

SOCCER ROBOT 36
digitalWrite(IN_2, HIGH);

analogWrite(ENA, speedCar/speed_Coeff);

digitalWrite(IN_3, LOW);

digitalWrite(IN_4, HIGH);

analogWrite(ENB, speedCar);

void goAheadLeft(){

digitalWrite(IN_1, LOW);

digitalWrite(IN_2, HIGH);

analogWrite(ENA, speedCar);

digitalWrite(IN_3, LOW);

digitalWrite(IN_4, HIGH);

analogWrite(ENB, speedCar/speed_Coeff);

void goBackRight(){

digitalWrite(IN_1, HIGH);

digitalWrite(IN_2, LOW);

SOCCER ROBOT 37
analogWrite(ENA, speedCar/speed_Coeff);

digitalWrite(IN_3, HIGH);

digitalWrite(IN_4, LOW);

analogWrite(ENB, speedCar);

void goBackLeft(){

digitalWrite(IN_1, HIGH);

digitalWrite(IN_2, LOW);

analogWrite(ENA, speedCar);

digitalWrite(IN_3, HIGH);

digitalWrite(IN_4, LOW);

analogWrite(ENB, speedCar/speed_Coeff);

void stopRobot(){

digitalWrite(IN_1, LOW);

digitalWrite(IN_2, LOW);

analogWrite(ENA, speedCar);

SOCCER ROBOT 38
digitalWrite(IN_3, LOW);

digitalWrite(IN_4, LOW);

analogWrite(ENB, speedCar);

void loop() {

server.handleClient();

command = server.arg("State");

if (command == "F") goAhead();

else if (command == "B") goBack();

else if (command == "L") goLeft();

else if (command == "R") goRight();

else if (command == "I") goAheadRight();

else if (command == "G") goAheadLeft();

else if (command == "J") goBackRight();

else if (command == "H") goBackLeft();

else if (command == "0") speedCar = 400;

else if (command == "1") speedCar = 470;

else if (command == "2") speedCar = 540;

else if (command == "3") speedCar = 610;

else if (command == "4") speedCar = 680;

SOCCER ROBOT 39
else if (command == "5") speedCar = 750;

else if (command == "6") speedCar = 820;

else if (command == "7") speedCar = 890;

else if (command == "8") speedCar = 960;

else if (command == "9") speedCar = 1023;

else if (command == "S") stopRobot();

void HTTP_handleRoot(void) {

if( server.hasArg("State") ){

Serial.println(server.arg("State"));

server.send ( 200, "text/html", "" );

delay(1);

SOCCER ROBOT 40
References

[1] "techtarget," [Online]. Available:

https://www.techtarget.com/iotagenda/definition/Internet-of-Things-IoT. [Accessed 05

2023].

[2] "components101," [Online]. Available: https://components101.com/development-

boards/nodemcu-esp8266-pinout-features-and-datasheet. [Accessed 05 2023].

[3] "electronicwings," [Online]. Available:

https://www.electronicwings.com/nodemcu/introduction-to-nodemcu. [Accessed 05

2023].

[4] "components101," [Online]. Available: https://components101.com/ics/l293d-pinout-

features-datasheet. [Accessed 05 2022].

[5] "hallroad," [Online]. Available: https://hallroad.org/4wd-smart-robot-car-chassis-kit-

for-arduino-in-

pakistan.html#:~:text=The%20Arduino%20chassis%20kit%20provides,can%20start%

20programming%20your%20robot.. [Accessed 05 2022].

[6] "showa," [Online]. Available: https://www.showa-seisen.co.jp/english/jumper-wire/.

[Accessed 05 2022].

[7] [Online]. Available: https://en.wikipedia.org/wiki/MIT_App_Inventor. [Accessed 05

2023].

[8] [Online]. Available: https://steemit.com/technology/@morbyjohn/soccer-robot-

automation-using-bluetooth-module-arduino-projects. [Accessed 05 2023].

SOCCER ROBOT 41
[9] "techtarget," [Online]. Available:

https://www.techtarget.com/iotagenda/definition/Internet-of-Things-IoT. [Accessed

2022].

[10] "elprocus," [Online]. Available: https://www.elprocus.com/soccer-playing-robot-

working-with-rules/. [Accessed 05 2023].

SOCCER ROBOT 42

You might also like