Topology

Objectives
- Part 1: Modify Your Thing
- Part 2: Test Your Modified Thing
Background / Scenario
In this activity, you will modify the security camera IoT device created in the previous activity.
Instructions
Part 1: Modify Your Thing
Step 1: Save the device icon from the instructions file.
a. Open the HTML instructions file for this activity if it is not already open.
b. Right-click the image below and select the option to save the image as a file on your computer. This must be done from the instructions document; it cannot be done from the Packet Tracer instructions window.
c. Save the image in a folder where you can find it easily.

Step 2: Add an additional device icon.
a. In the Packet Tracer file for this activity, click the Security Camerain the Packet Tracer workspace, and click the Config tab.
b. Click the Advancedbutton in the bottom right of the device configuration window, then click the Thing Editor tab. Be sure that the Properties tab is open. You will see the icon for the security camera that you worked with in the last activity.
c. Click the Newbutton. This will allow you to add a second graphic for the security camera. Locate the file that you saved to your computer in Step 1 and click Open to insert the image. This image will represent the security camera when it is activated by motion, as indicated by the red light.
d. Next, click the Rulestab.
e. Then, click the Addbutton.
f. Click in the Sub Componentcolumn and select Security Camera in the drop down menu.
g. The Slot Valueshould change to LOW and the Image should show the security camera image that will be used as the icon when the camera is not active (the camera without the red dot).
h. Click the Addbutton again.
i. Click in the Sub Componentcolumn and select Security Camera in the drop down menu again.
j. Click in the Slot Valuecolumn and select HIGH and click in the Image column and select the security camera image that will be used as the activated icon (the camera with the red dot). This is the file that you saved in Step 1.
Step 3: Copy programming code from an existing IoT device.
a. View the existing programming code by clicking the Programming tab. Notice that there is minimal code for the device.
Note: You may need to double-click Blink (JavaScript) and double-click main.js to view the code.
b. Minimize the Security Cameraconfiguration window.
c. To copy code from an existing Packet Tracer IoT device, add the Motion DetectorIoT device to the Packet Tracer workspace. You can find it under End Devices > Home in the device selection box. You will be adding motion detector functionality to the security camera by copying the code from the motion detector to the security camera.
d. Click the Motion Detectorand click the Config tab, click the Advanced button, then click the Programming tab.
e. In the Programmingtab, click * Motion Detector (JavaScript) in the left pane and click Open.
f. Click main.jsin the left pane and click Open. This opens the code that is associated with the Motion Detector in the code edit pane to the right.
g. You will need to copy the entire script. To select all of the programming script, click in the code edit pane and press Ctrl+A on the keyboard. With all of the script selected, click Copyin the code edit pane menu.
h. Close the Motion Detectorconfiguration window and delete the motion detector device.
Step 4: Create a new script in the security camera.
a. To paste the copied code to the security camera IoT device, re-open the Security Camerawindow and select the Programming tab if not already selected.
b. Click the ..(two dots) in the left pane and click Open to return the window to display Blink (JavaScript).
c. Click the Newproject button above the left pane. This opens the Create File window.
d. In the Create Filewindow, create a new programming project by typing Security Camera in the Name box and then clicking Create.
e. To view the new project just created, click the ..(two dots) in the left pane and click Open.
f. Notice there is now a Security Camera (JavaScript)project in the left pane. Click the Security Camera project and click Open.
g. Click main.jsand click Open.
h. You can now paste the copied code from the Motion Detector into the code edit pane on the right. Click in the code edit pane and click the Pastebutton to paste in the copied code.
Step 5: Edit the security camera programming code.
a. The code that you copied from the Motion Detectorneeds to be edited to change the type value from Motion Detector to Security Camera. To do this, click the line that says type: "Motion Detector" in the code edit pane. In this instance, it is line 8.
b. Change the line from type: "Motion Detector", to type: "Security Camera"
Note that the quotation marks and comma at the end of the statement are required.
c. Run the program by clicking the Runbutton.
Part 2: Test Your Modified Thing
Step 1: Register the security camera thing with the IoT Registration Server.
a. In the security camera configuration window, click the Configtab.
b. In the IoT Serversection of the pane on the right, click the Remote Server radio button. The IoT Registration Server is remote because it is connected to a network that is outside of the home network.
c. Enter the Server Addressas 203.0.0.3.
d. Enter the User Nameas home and the Password as home.
e. Click the Connector Refresh button to initiate the connection.
Step 2: Monitor and test the thing from the IoT Server.
a. Access the IoT Registration Server from the Tablet. To do so, click the Tabletto open the configuration window. Click the Desktop tab and select the Web Browser icon. In the web browser window, enter the URL of the IoT Registration Server, home.com, and click Go.
b. In the Registration Server Loginpane type in the following credentials and click Connect.
- Username: home
- Password: home
c. In the IoTServer - Devicespane, click the Security Camera to expand the device information. Notice the Security Camera is On but not activated, as indicated by the red dot.
d. Move the Tabletconfiguration window out of the way. It should be visible next to the PT workspace.
e. Hold down the Alt key on the keyboard and move the mouse pointer over the Security Cameraicon. This signifies motion that should be detected by the camera.
f. Notice that the icon will change to the image with the red dot. In the Tablet browser window, the Security Camera status changes to activated as indicated by the green dot in Security Camera display. If no additional motion is detected, the security camera will switch back to deactivated after a brief delay. You will see the green dot turn red and the deactivated camera icon display in the workspace.
g. You can also control the other devices that are registered with the server. The registration server provides a way that the home IoT network can be controlled from any end device that is connected to the internet. Try controlling the other devices and observe the results in the registration server interface and the workspace.
Step 3: Experiment
a. Experiment by adding other types of IoT devices and editing the programming of those devices to perform different functions.
b. Close Packet Tracer.
Download Packet Tracer (.pka) file:
