Home
  • Features
    • Packet Tracer 9.0 available for download !
    • Cisco Modeling Labs 2.8 available for download !
    • What's new in GNS3 3.0.0 ?
    • What's new in Packet Tracer 8.2.2 ?
    • What's new in Packet Tracer 8.1.1 ?
    • What's new in Packet Tracer 8.0.1 ?
    • What's new in Packet Tracer 8.0.0 ?
    • What's new in Packet tracer 7.4.0T ?
    • What's new in Packet Tracer 7.3.1 ?
    • What's new in Packet Tracer 7.3 ?
    • What's new in Packet Tracer 7.2.2 ?
    • What's new in Packet Tracer 7.2.1 ?
    • What's new in Packet Tracer 7.2 ?
    • What's new in Packet Tracer 7.1.1 ?
    • What's new in Packet Tracer 7.1 ?
    • Cisco Packet Tracer features
    • System requirements
    • Routeurs and WIC modules
    • Packet Tracer 8.2 vs GNS3 3.0
    • Real network connection
  • Try it online !
  • Labs
    • Packet Tracer labs
    • Lab 1 : Basic switch setup
    • Lab 2 : Interfaces configuration
    • Lab 3 : VLAN and VTP
    • Lab 4 : Port security
    • Lab 6 : Basic router setup
    • Lab 11 : HDLC configuration
    • Lab 12 : PPP configuration
    • Lab 16 : Clientless SSL VPN
    • Lab 17 - Site to site IPSEC VPN with ASA 5505
    • Lab 18 : ASA 5506-X DMZ configuration
    • Lab 19 - DPI with ASA 5505
    • Lab 20 - CBAC trafic Inspection with ISR router
    • Lab 21 - Wlan users differentiation
  • Tutorials
    • Netflow configuration
    • HSRP Configuration
    • ACL configuration
    • DHCP configuration
    • Frame Relay configuration
    • Radius configuration
    • Video tutorials
    • BGP configuration
    • VOIP - Telephony devices
    • VOIP - Basic configuration
    • VOIP - Advanced configuration
    • IPSEC VPN tunneling
    • Cisco 819 ISR router AP configuration
    • Precision Time Protocol
    • LLDP configuration
    • Wireless - WLC configuration
  • IoT
    • IoT devices configuration
    • Arduino emulation for IoT programming
    • IoT advanced programming
    • IoT with IoX on ISR 819 router
    • Blocky programming IoT devices
    • Real HTTP server using SBC device
  • CCNA / CCNP
    • What is Cisco Networking Academy ?
    • CCENT certification exam
    • CCNA certification exam
    • CCNP Enterprise training
    • CCNP training : Cisco CSR1000v
    • CCNP training : FRRouting (FRR)
  • Blog
  • Download
  • Archives

Packet Tracer 7.x - Internet of Things tutorials

Packet Tracer 8.2 - Arduino emulation for IoT programming

Last Updated: 12 September 2023

What is Arduino ?

Arduino is a hardware and software company building microcontroller-based kits for building digital devices and interactive objects that can sense and control physical devices.

The project is based on microcontroller board designs, produced by several vendors, using several microcontrollers. Arduino boards provide digital and analog input/output (I/O) pins that can interface to different expansion boards  and other circuits. The boards feature serial and USB communication interfaces for loading programs from computers to the boards.

Programming the microcontrollers is done through the Arduino integrated development environment (IDE) based on a programming language named Processing, which also supports the languages C and C++.

 

Arduino at Cisco Live 2016

Arduino organised a technical challenge at Cisco Live 2016. The idea was that people at the Cisco event could discover and play with some fun Arduino projects like a RFID lock, a colour sensing and display thing, and a light sensitive theremin. Have a look on the video ;-)

 

Arduino language implemented in Packet Tracer 8.2

Packet Tracer 7.0 was the first Cisco Packet Tracer release including IoT features. This version includes IoT components and microcontroller (MCU-PT) or single boarded computers (SBC-PT) to connect them to the network. The microcontroller board emulate Arduino hardware and can be programmed using the same Processing language.

Function Packet Tracer 8 reference Arduino reference

Structure

setup()

If defined, this function is called once when the program starts.

function setup() {
pinMode(0, INPUT);
} 

The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board.

void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
}
loop()

If defined, this function is called continuously when the program is running. The frequency of the calls depends on the complexity of this function, the number of other devices running programs and their complexity, and the machine's processing power.

  function loop() {
  	Serial.println(digitalRead(0));
  }
 

After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board.

void loop()
{
  if (digitalRead(buttonPin) == HIGH)
    Serial.write('H');
  else
    Serial.write('L');

  delay(1000);
}
Digital I/O
pinMode(slot, mode) 

Set a digital slot to INPUT or OUTPUT. 

pinMode(1, OUTPUT); 
pinMode(2, INPUT);

Configures the specified pin to behave either as an input or an output.

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}
digitalRead(slot)

 
Reads from a digital slot, returns HIGH or LOW. 

var val = digitalRead(1); 

Reads the value from a specified digital pin, either HIGH or LOW

void loop()
{
  val = digitalRead(inPin);   // read the input pin
  digitalWrite(ledPin, val);    // sets the LED to the button's value
}
digitalWrite(slot, value)

Writes to a digital slot with HIGH or LOW.

digitalWrite(1, HIGH);

Write a HIGH or a LOW value to a digital pin.

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}

Packet Tracer 8.2 - IoT advanced programming & automation

Last Updated: 12 September 2023

Tutorial description

This tutorial will provide guidelines to simulate a fully automated IoT environment using the capabilities of the new Cisco Packet Tracer 8.2 devices.

A MCU board connected to smoke and temperature sensors will act as a remote Fire Detection Unit. The board will be securely wifi connected to a 829 ISR router.

A SBC bord connected to a visual alarm will act as a Fire Alarm System.

Both IoT board will register to a central IoE server which will provide automation capabilities to raise the Fire Alarm if a fire is detected by the Remote Fire Sensor.

Packet Tracer 7.0 advanced programming and automation network topology

  

Read more …

IoT with IoX on ISR 819HG-4G router

Last Updated: 12 September 2023

What is IoX ?

Cisco IoX hosts applications in a virtual machines running on an hypervisor hosted on an IoX capable hardware called fog node. Cisco IoX is delivered with a pre-packaged Yocto Linux distribution but developpers are free to use any operating system. Yocto has been selected by Cisco because of it's various CPU architectures support, it's comprehensive SDK, and it's slim design to work on resource constraint platforms like routers.

Read more …

Blocky programming IoT devices

Last Updated: 12 September 2023

What's blocky ?

Blockly is a visual programmation editor which uses uses graphical blocks to represent code concepts like variables, logical expressions, loops, and more. It helps students to better understand and apply programming principles without having to worry about the specific syntax of a specific programming language.

Code can then be exported to popular programming languages such as python, javascript, ...

Read more …

Packet Tracer 8.2 - Real HTTP server using SBC device

Last Updated: 12 September 2023

Real HTTP server API in Packet Tracer 8.2

Packet Tracer 7.2 introduced the capability to create a real HTTP server accessible from the outside of the Packet Tracer emulation environment. This capability is only available on the SBC IoT device.

HTTP server can be programmed using javascript, python, or the visual programming language

Javascript API

The following javascript functions have been added in Packet Tracer 7.2 (SBC device only) to support real HTTP server. The HTTP is able to listen on a custom TCP port and to respond with text/plain or any other content-type (file, ...).

Function

Return Type

Description 

Example 

HTTPServer.route(path, method, callback); 

N/A

Sets up a route for path and calls callback when it is requested. Routes also support wildcards using *.

HTTPServer.route("/hello", function(url, response) { 

  response.send("world"); 

});



HTTPServer.route("/*", function(url, response) { 

  response.send("hi"); 

});

HTTPServer.start(port) 

boolean

Starts listening on port. 

HTTPServer.start(80); 

HTTPServer.stop() 

N/A

Stops listening.

HTTPServer.stop(); 

 

 

 

 

Response class

 

Passed into the HTTPServer route handler.

 

send(content)

N/A

Sends content back as response.

response.send("hello");

setContentType(type)

N/A

Sets the content type in the response.

response.setContentType("text/plain");

sendFile(filePath)

N/A

Sends a file back as response. The file path is in the device's file manager, not relative to the source code of the current project/script.

response.sendFile("/test.txt")

sendNotFound()

N/A

Sends a file not found as response.

response.sendNotFound()

 

Use the following javascript code to start a real HTTP server listening on TCP port 8080.

var server = new RealHTTPServer();
server.start(8080);

 

Read more …

 

Trademark notice : This web site and/or material is not affiliated with, endorsed by, or sponsored by Cisco Systems, Inc. Cisco, Cisco Systems, Cisco IOS, CCNA, CCNP, Networking Academy, Linksys are registered trademarks of Cisco Systems, Inc. or its affiliates in the U.S. or certain other countries.