You are on page 1of 26

Republic of Iraq

Ministry of Higher Education


& Scientific Research
University of Mosul \ College of Engineering

Blockly Programming with IoT Using Cisco Packet Tracer

Master Report
Electrical Engineering - Electronics and Communication

By
Amna Saleh Mahmoud
Noor Mohammed Qassim

Supervisor
Mohammed Younis

2022-2023
Table of Contents

Chapter 1
1.1 Introduction .......................................................... 3
1.2 Applications of IoT ………………………….…………………4

Chapter 2
2.1 Cisco Packet Tracer Overview ........................................... 5
2.2 Cisco Packet Tracer Interface .......................................... 5,6
2.3 Protocols supported by Packet Tracer................................. 7
2.4 Features of Cisco Packet Tracer ....................................... 8

Chapter 3
3.1 Implementation and Result................................................. 9
Part 1: Open Packet Tracer and Examine Blockly Program
Part 2: Control a RGB LED ,Door,Light With sensor using Blockly
3.2 Conclusion:.................................................................. 25

Reference .......................................................................... 26

2
Chapter 1
1.1 Introduction:
Internet of Things(IOT)and Internet of Everything(IOE) are two words that
commonly refers to the new trend to have small, cheap and always-connected
devices used to send data to a backend cloud based applications. This opens
up a new set of possibilities and products that companies are developing and
selling in both industrial and consumer markets. In 2018 Metropolia University
of Applied Science started a new study course, called Internet of Things. The
study course includes first an overall Introduction of IoT, followed by a
development of an IoT business case and finally over a practical IoT
simulation.This thesis work was aiming to build practical cases where students
could experience, through an IoT simulator, the various IoT sensor-based
components,network landscapes where all the devices are connected and
backend intelligence where logic and analysis of sensor-based data can be
gathered and analyzed.The tool chosen for the simulations is Cisco Packet
Tracer, this tool has been used for many years to train students on Cisco
networking.Main strength of the tool is the offering of a variety of network
components that simulate a real network, devices would then need to be
interconnected and configured in order to create a network. In the last version
of the tool Cisco introduced IoT functionalities, and now it is possible to add to
the network smart devices, components, sensors, actuators and also devices
that simulate microcontrollers such as Arudino or Raspberry Pi. All the IoT
devices can be run on standard programs or can be customized by
programming them with Java, Phyton or Blockly.This makes Cisco Packet
Tracer an ideal tool for building IoT practical simulations.[1]

Figure(1): Internet of Things IOT .

3
1.2 Applications of IoT :

Smart Energy: Energy plays a key role in achieving the desired economic growth
of a country. The entire fabric of developmental goals is webbed around a
successful energy strategy. Energy is vital for the creation of wealth and
improvement of social welfare. Smart Energy Monitors (SEM) is a technology
introduced to help people to conserve energy and to use electricity efficiently when
needed. Smart energy monitor helps individuals to identify their home's energy-
hungry habits, where they can have an automated IoT monitor device that allows
users to see how much energy they are consuming whenever an appliance is switch
on and cost of power consumption.
Smart Health: An important application of IoT is smart health where special
monitors are used to observe patients in a hospital and take care of them. These
devices are used to monitor and evaluate the health condition of patients.
Sportsmen can also use sensor devices to monitor their blood pressure, heartbeat
and temperature when they are engaged in sporting activities. A patient monitor
system can also be used to take care of patients at homes with chronic health
conditions or special needs.
Smart Manufacturing: The application of IoT for manufacturing has some
significance where an automated system can be use to restock raw materials in a
manufacturing warehouse. A special control system is used to alert when raw
materials are running out at a warehouse and trigger the process of replacing the
raw materials to continue the production cycle. This is important to ensure raw
materials are always available for production at a warehouse.
Smart living: Another important application of IoT is to help people to life a smart
live within their vicinity. People at a shopping mall can get tips of their favorite
groceries at the mall, where a sensor monitors can alert shoppers when a
particular grocery is due to expire and also warn them of allergy components in
some food. The use of sensors in some products will allow users to scan the
barcode components to see when the products are due for expiring, some
components in product that may pose as an allergy to users and information
about the manufacturers of the product.
These are the few applications of IoT that have significant advantages. [2]

4
Chapter 2
2.1 Cisco Packet Tracer Overview:
Cisco Packet Tracer is a longstanding simulation environment that provides a
wide variety of features and functions which allows both students and educators
to create and test complex and wideranging networking scenarios. It allows the
opportunity for educators to promote independent active learning, while not
being overly onerous for students. Packet Tracer has an interactive graphic
user interface where users can simply ‘drag and drop’ networking devices (e.g.
routers, switches, workstations, servers, IOT devices), connect devices via
networking cables (e.g. coaxial, copper straight-through, etc ), while also
providing a command line interface for configuring the network devices where
users can enter IOS commands .[3]

Figure(2) : Cisco Packet Tracer Icon .

2.2 Cisco Packet Tracer Interface :


As shown below in figure(3) elements of interface are : [4]

Figure(3): Interface of Packet Tracer .

5
1 Menu Bar This bar provides the File, Edit, Options, View, Tools, Extensions, and Help
menus. You will find basic commands such as Open, Save, Print, and
Preferences in these menus. You will also be able to access the Activity
Wizard from the Extensions menu.
2 Main Tool Bar This bar provides shortcut icons to the File and Edit menu commands. This
bar also provides buttons for Zoom, the drawing Palette, and the Device
Template Manager. On the right, you will also find the Network Information
button, which you can use to enter a description for the current network (or
any text you wish to include).
3 Common Tools This bar provides access to these commonly used workspace tools: Select,
Bar Move Layout, Place Note, Delete, Inspect, Add Simple PDU, and Add
Complex PDU. See "Workspace Basics" for more information.
4 Logical/Physical You can toggle between the Physical Workspace and the Logical
Workspace and Workspace with the tabs on this bar. In Logical Workspace, this
Navigation Bar bar also allows you to navigate through levels of a cluster, create a
new New Cluster, Move Object, Set Tiled Background, and
Viewport. In Physical Workspace, this bar allows you to navigate
through physical locations, create a New City, create a New
Building, create a New Closet, Move Object, apply Grid to the
background, Set Background, and go to the Working Closet.
5 Workspace This area is where you will create your network, watch
simulations, and view many kinds of information and statistics .
6 Realtime/Simul You can toggle between Realtime Mode and Simulation Mode
ation Bar with the tabs on this bar. This bar also provides buttons to Power
Cycle Devices as well as the Play Control buttons and the Event
List toggle button in Simulation Mode. Also, it contains a clock
that displays the relative Time in Realtime Mode and Simulation mode.
7 Network This box is where you choose devices and connections to put into
Component Box the workspace. It contains the Device-Type Selection Box and the
Device-Specific Selection Box.
8 Device-Type This box contains the type of devices and connections available in
Selection Packet Tracer 5.1. The Device-Specific Selection Box will change
depending on which type of device you choose.
9 BoxDevice- This box is where you choose specifically which devices you want
Specific to put in your network and which connections to make.
Selection Box
10 User Created This window manages the packets you put in the network during simulation
Packet scenarios. See the "Simulation Mode" section for more details.
Window*

6
2.3 Protocols supported by Packet Tracer:

A simulator, as the name suggests, simulates network devices and its


environment, so protocols in Packet Tracer are coded to work and behave in the same
way as they would on real hardware. The following table shows the protocols
supported by Packet Tracer:[5]

Technology Protocols
LAN Ethernet (including CSMA/CD*), 802.11 a/b/g/n wireless*, and
PPPOE
Switching VLANs, 802.1q, trunking, VTP, DTP, STP*, RSTP*, multilayer
switching*, EtherChannel, LACP, and PAgP
TCP/IP HTTP, HTTPS, DHCP, DHCPv6, Telnet, SSH, TFTP, DNS,
TCP*, UDP, IPv4*, IPv6*, ICMP, ICMPv6, ARP, IPv6 ND,
FTP, SMTP, POP3, and VOIP(H.323)
Routing Static, default, RIPv1, RIPv2, EIGRP, single area OSPF,
multiarea OSPF, BGP, inter-VLAN routing, and redistribution
WAN HDLC, SLARP, PPP*, and Frame Relay*
Security IPsec, GRE, ISAKMP, NTP, AAA, RADIUS, TACACS, SNMP,
SSH, Syslog, CBAC, Zone-Based Policy Firewall, and IPS
QoS Layer 2 QoS, Layer 3 DiffServ QoS, FIFO Hardware queues,
Priority Queuing, Custom Queuing, Weighted Fair Queuing,
MQC, and NBAR*
Miscellaneous ACLs (standard, extended, and named), CDP, NAT (static,
dynamic, inside/outside, and overload), and NATv6

* These protocols have substantial modelling limitations, so not all commands


under these protocols work.

7
2.4 Features of Cisco Packet Tracer :

• Unlimited devices .
• E-learning .
• Customize single/multi user activities .
• Interactive Environment .
• Visualizing Networks .
• Real-time mode and Simulation mode .
• Self-paced .
• Supports majority of networking protocols .
• International language support .
• Cross platform compatibility. [6]

8
Chapter 3
3.1 Implementation and Result:

Part 1: Open Packet Tracer and Examine Blockly Program .


Part 2: Control a RGB LED ,Door,Light With sensor using Blockly .

Background:
Blockly is a visual programming language that lets users create programs by
connecting blocks, that represent different logic language structures, rather than by
writing the actual code. Blockly runs within a web browser and can translate the visually
created program as JavaScript, PHP, or Python.
Scenario:
Using Blockly programming to control an IoT objects.
Part 1: Launch Cisco Packet Tracer (PT) and Use Blockly
Step 1: Launch Packet Tracer
a. Double click the Cisco Packet Tracer icon to open the PT program.

b. The user interface is shown.

9
c. Click on the End Devices category, then click laptop and server and drag them to
the workspace.
d. Click on the Network Devices category, then click 2960 Switch and drag it to the
workspace.
e. Click on the Components category, then click SBC Board and drag it to the
workspace
f. Click the subcategory Actuators, select RGB LED and drag it to the workspace.
g. Click on the End Devices category, then click Home then click Door and then
click light and drag them to the workspace.
h. Click on the Components category, then click sub category Sensors and select
Motion Sensor and drag it to the workspace.
i. Click the Connections category, select copper straight through to link SBC Board
to Server and Switch and laptop by fast ethernet cable.
j. Click the Connections category, select IoT Custom Cable to link:
• D0 from SBC board to D0 motion Sensor.
• D1 from SBC board to D0 Door.
• D2 from SBC board to A0 RGB Led.
• D3 from SBC board to A1 RGB Led.
• D4 from SBC board to D0 Light.

Figure(4):Circuit Connection

10
Step 2 : Configuration of Elements
a.Double click the server to change IP , Click Desktop then click IPV4
address to 1.1.1.1.

b.Double click the Laptop to change IP , Click Desktop then click IPV4
address to 1.2.2.2

11
c.Double click the SBC board ,then click physical and click PT-IOT-NM1CEF
features a single fast Ethernet port .
d.Double click the SBC board, then Click Config then click fast Ethernet and
click IPV4 address to 1.3.3.3.

e. Double click the SBC BOARD. Its configuration window displays


f. Double click the SBC BOARD AND Click the Programming tab

12
Step 3: Examine a prebuilt Blockly program
1-Click the SBC BOARD and select New and creat project ,click the name
Blockly lab And select main visual and click creat.
2-Double-click main.visual. The prebuilt Blockly program displays:

13
1.select variables to

2.select functions to

3. select functions - to

4 . select function - to

5.select Pin access to change :

6.select loop 7.select logic

8.select function 9.select function

10.select pin access to

11.select function

12.select pin access

13.select Text 14-select function

14
15.select logic 16.select logic to

Click RGB LED and review its specification. Note different pin inputs represent
different colors

Figure(5) : RGB Led Spesification

15
17.select text

18.select Pin access and

to

19.select

Program will be :

16
20. SELECT RUN :
Results :
• RGB LED light is now coming on but well it is Red indicating that there is no motion
• The Door is not open
• The light is off

When we do (Alt+left click) and drag my mouse over the Sensor and give it a
couple seconds you’ll notice :
• the Door does open
• the Light comes on
• our LED indicator does turn green

17
Step 4 : Example of Send an Email

We want to be able to send an email so first of all do we ever set up SMTP(Simple


Mail Transfer Protocol) emails:

1. mail server and select services and select EMAIL :

Domain name : noorandamna.com

And click Set

User : sbc password : cisco

And click +

User :admin password : cisc

18
2. laptop : click Desktop

Your name: admin

Email address: admin@noorandamna.com

Incoming MAIL Server : 1.1.1.1

Outgoing MAIL Server : 1.1.1.1

User name : admain

Password : cisco

19
3. SBC board ,select desktop and click EMAIL

User name:sbc

Email address: sbc@noorandamna.com

Incoming MAIL Server : 1.1.1.1

Outgoing MAIL Server : 1.1.1.1

User name : sbc

Password : cisco

20
21
4. click SBC board and select programming

a- select function to

b- select logic

c- select variable

d- select Email

to

e- select

22
Program will be :

And Select Run

5. Select Laptop and click Desktop :

23
And Select Reply : Thanks you very much

24
6. SBC BOARD ,SELECT DESKTOP and select receive

3.2 Conclusion :
The purpose of Packet Tracer IoT.The tool used is Cisco packet tracer which
is a software developed by Cisco that is used to create and simulate a virtual
network, basically a wireless network, without the need for any network
hardware. The tool is free of charge, and suitable to work with almost all the
operating systems.Cisco helps enterprises connect and monitor devices,
secure and automate operations, and compute and manage data.

25
References :

[1] Andrea Finardi, IoT Simulations with Cisco Packet Tracer

[2] Design and Implement IoT Smart Home via Cisco Packet

Tracer: Applications & Simulations Dr. Aboagela Dogman, and Mohamed Jewiley

Faculty of Information Technology, University of AL-Zintan, AL-Zintan, Libya,

[3] Simulation-Based Learning via Cisco Packet Tracer to Enhance

the Teaching of Computer Networks , July 2022, Dublin, Ireland.

[4] Al- Mustansiriyah University Computer network lab College of Engineering Fourth

Class/ Second semester Department of Computer Engineering, Prepared by: Lect.

Rana Riad

[5] Packet Tracer Network Simulator , Jesin A

[6] https://www.geeksforgeeks.org/what-is-cisco-packet-tracer/

26

You might also like