Packet Tracer 7.0 - IoT advanced programming & automation

4 1 1 1 1 1 Rating 4.00 (2 Votes)

Tutorial description

This tutorial will provide guidelines to simulate a fully automated IoT environment using the capabilities of the new Cisco Packet Tracer 7.0 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


ISR829 router wireless configuration with WPA-PSK encryption

1. Setup an IP address on the wlan-ap0 interface for integrated AP managment

2. Connect to the integrated AP (service-module wlan-ap0 session)

3. Configure the SSID with the following settings. Here is configured the SSID, the authentication mode, and the WPA-PSK key.

dot11 ssid TEST
  authentication open
  authentication key-management wpa
  wpa-psk ascii 0 AZERTYUIOP

4. Configure the Dot11Radio0 interface with the following settings. Here is configured the encryption mode and the link with the previously configured SSID.

interface Dot11Radio0
 no ip address
 bridge-group 1
 encryption mode ciphers aes-ccm
 ssid TEST

5. Go back to the router configuration. The data path of the integrated AP is linked to the router's Wlan-GigabitEthernet0 interface (not the AP interface).

6.Configure the Wlan-GigabitEthernet0 interface as an access port in Vlan 1 :

interface Wlan-GigabitEthernet0
 switchport mode access

7.Configure DHCP on the router for vlan 1 :

ip dhcp excluded-address
ip dhcp pool IoE_POOL
 interface Vlan1
 ip address


IoE MCU board registration

Add a wireless connector to the MCU board and configure wireless settings to connect it to the remote 829 router. On the config tab, configure the address of the remote IoE server ( with the following user/password (user : register, password : register)

MCU board wireless configuration

MCU board registration to IoE server


Javascript code for the MCU Board (remote fire sensors)

The IoEClient.setup(api) function sets up the API for remote monitor and control from IoE server. The api is an object describing the states reported by the IoE device and identifying the one remote controlable [controlable: true] by the server.

The IoEClient.reportStates(states) reports the states of this device to the IoE server. The argument is a string representing all states of this device. The argument can also be an array representing all states. The number of states must match the length of the states property in the IoEClient.setup() function.

function setup() {
	pinMode(1, OUTPUT);
	 type: "Fire Detection",
	 states: [{
		name: "Fire",
		type: "bool"
	  name: "Temperature",
	  type: "number",
	  unit: "°C",
	  imperialUnit: "°F",
	  toImperialConversion: "x*1.8+32",
	  toMetricConversion: "(x-32)/1.8",
	  decimalDigits: 1
	  name: "Smoke Level",
	  type: "number",
	  unit: "ppm",
	  decimalDigits: 1

function loop() {
	var SmokeLevel = analogRead(A0);
	var Temperature = analogRead(A1);
	var FireDetected=false;
	if (SmokeLevel>50 || Temperature>580) {
    	digitalWrite(0, HIGH);
  	else {
    	digitalWrite(0, LOW);


Javascript code for the SBC Board (visual fire alarm)

var state = 0;

function setup() {
		type: "FireAlarm",
		states: [{
			name: "On",
			type: "bool",
			controllable: true
	IoEClient.onInputReceive = function(input) {
		processData(input, true);
	attachInterrupt(0, function() {
		processData(customRead(0), false);

function processData(data, bIsRemote) {
	if ( data.length <= 0  )

function setState(newState) {
	state = newState;
	if ( state === 0 )
		digitalWrite(0, LOW);
		digitalWrite(0, HIGH);
	customWrite(0, state);
	setDeviceProperty(getName(), "state", state);