Académique Documents
Professionnel Documents
Culture Documents
This manual contains instructions for two independent yet related labs; the IzoT Device Stack EX lab,
which allows you to create communities of autonomous devices that can interact without requiring
servers, routers, or head-end applications, and the IzoT Server lab for developing Web pages to
control and monitor your communities of devices. Both labs have been designed for expediency and
completion within a 60 minute session.
Device Stacks
The core of the IzoT Platform consists of the device stacks. The device stacks implement the
LonTalk/IP protocol that provides control services on top of IP. These IzoT Control Services enable
devices to discover each other and to easily and reliably exchange data.
There are three device stacks:
The EX stack is available as a free download from Echelon, and is also available in a paid Premium
Edition with enhanced functionality and including one-year of support. Using this stack, you can
develop IzoT-enabled applications in Python, C++, or C. Full source code for the stack is included in
both the free download and in the Premium Edition. A reference implementation is included that
runs on a Raspberry Pi, BeagleBone Black, or other ARM processors running Linux. You can also port
the stack to other 32-bit or 64-bit processors and operating systems. The stack includes a set of
example applications with full source code, schematics, and I/O board layouts for the Raspberry Pi
that provides the user with enough elements for a quick start trying the stack. The following figure
illustrates the components of the IzoT Device Stack EX.
Chips
You can use the EX or DX stack with the processor of your choice, or you can use one of Echelons
new Series 6000 chips for creating a low-cost IzoT-enabled device. To reduce installation cost, there
are versions of the Series 6000 chips that use a free topology twisted pair link. Free topology uses
simple twisted pair cable with multi-drop wiring that is easier and less expensive to install than
Ethernet cable. The Series 6000 chips all include four processor cores, with two dedicated to the
LonTalk/IP Protocol. They also include on-board memory and I/O to reduce device cost. The FT
6050 and FT 6010 add a free topology twisted pair transceiver. The Series 6000 chips are provided in
a compact 7mm by 7mm QFN package so you can build very small devices. The following figure
illustrates the architecture of the FT 6050 and FT 6010 chips.
Control Services
All three device stacks provide a common set of control services on top of IP called the IzoT Control
Services. These services enable devices to communicate with datapoints. The following figure
illustrates how a sending device uses datapoints to reliably exchange datapoints with multiple
receiving devices using peer-to-peer communication. When notification is required of datapoint
update delivery, the sending device can request acknowledgements from each of the destination
devices, and the device stack automatically manages retries to any devices that do not acknowledge
receipt.
A messaging interface is also provided for exchanging larger payloads of data. An IzoT application
can implement up to 4096 datapoints, providing support for complex control devices. The IzoT
Control Services support up to 32,385 devices in a community. Devices may be organized into
groups providing a way to control a large number of devices with a single network update. The IzoT
Control Services also provide services for reliable message delivery with acknowledged and
request/response services, with thousands of transactions per device active at the same time when
using the EX stack.
Example Applications
The IzoT SDK includes an example application that demonstrates how the SDK can be used with
Raspberry Pi devices to create a lighting system with color control. The example demonstrates both
peer-to-peer control as well as Web-based monitoring and control.
There are five example device applications:
1. An Environmental Sensor that measures and reports temperature, humidity, occupancy, and
light level.
2. A 2.5 touch screen keypad that can be used to control the lighting.
3. An LED Controller that controls up to two 3W RGB LEDs.
4. A digital I/O (DIO) application that can be built for one to seven channels that demonstrates
simple digital input and digital output. This example is used for the Hands-on Lab.
The examples support multiple instances of each device type, so you can have multiple
Environmental Sensors, Keypads, and DIOs controlling multiple LEDs. The following figure illustrates
three of the example device applications and Web pages included with the IzoT SDK.
The Web pages are all implemented using HTML5 and Javascript. They are compatible with all major
browsers, and are also optimized when displayed on an iPad.
The example includes source code for the device applications, schematics, and layouts for the I/O
hardware, and HTML5 and JavaScript code for the Web pages.
Lab Configuration
The DX and EX versions of the IzoT Device Stack, and the IzoT Server Stack are provided as source
code stacks so that you can port them to your choice of processor and operating system. In this lab
you will use the IzoT Device Stack EX running on a Raspberry Pi with Raspbian Linux, and you will
share a server running the IzoT Server Stack on a BeagleBone Black. If you are participating in a
scheduled lab session, each of you has a Raspberry Pi that has been pre-loaded with Raspbian Linux
and the IzoT Device Stack EX. In addition, a PiFace Digital I/O Board has been installed into each of
your Pis. This board has 8 digital inputs and 8 digital outputs. Four pushbuttons are provided that
control four of the digital inputs. Eight LEDs indicate the state of the eight digital outputs, and two
of the digital outputs are also connected to two relays. Our lab examples use the pushbuttons and
the relay outputs.
If you are doing this lab on your own, you will need to provide your own Raspberry Pi devices with
PiFace Digital I/O Boards, and one BeagleBone Black server. Set up your Pi devices as described in
Part I, and your BeagleBone Black server as described in Part III.
Get Started
The labs are organized into the following four parts.
Part IDownloading the IzoT SDK and installing it on a Raspberry Pi. The IzoT SDK includes
both the IzoT Device Stack EX and the IzoT Server Stack. It can be ported to many different
platforms, but the Raspberry Pi is a very low-cost ($35) and easy to set up platform for the
6
IzoT SDK. If you are attending an IzoT Hands-on-Lab, Part I has been completed for you prior
to the start of the lab. The instructions are included here so that you can set up your own
Raspberry Pis with the IzoT SDK at home or in your office.
Part IICreating an IzoT device, followed by creating a community of devices, using the IzoT
Device Stack EX on a Raspberry Pi. This is the hands-on portion of the IzoT Device Stack EX
Hands-on Lab. You can also follow these steps with Raspberry Pi devices that you have set
up yourself following Part I.
Part IIIDownloading the IzoT SDK and installing it on a BeagleBone Black. The BeagleBone
Black has about twice the performance of a Raspberry Pi, for about $10 more. While you
can run an IzoT Server on a Raspberry Pi, the BeagleBone Black is a better platform for the
IzoT Server because of the higher performance requirements of the server stack. The IzoT
Server includes an implementation of the IzoT Device Stack EX, and also includes a Web
server, a Web application server, a REST server, a LonTalk/IP network server, and a SQL
database. All these components run simultaneously, requiring more processor resources
than a typical IzoT device running just the IzoT Device Stack EX and a device application. If
you are attending an IzoT Hands-on-Lab, Part III has been completed for you prior to the
start of the lab. The instructions are included here so that you can set up your own
BeagleBone Blacks with the IzoT SDK at home or in your office.
Part IVCreating Web pages that interact with IzoT Devices using the IzoT REST API
provided by an IzoT Server. This is the hands-on portion of the IzoT Server Stack Hands-on
Lab. You can also follow these steps with a BeagleBone Black that you have set up yourself
following Part III.
2. Download and install the following tools (Win32 Disk Imager is for Windows;
see www.raspberrypi.org for instructions for other platforms) :
a. SD Formatter from www.sdcard.org/downloads
b. Win32 Disk Imager from sourceforge.net/projects/win32diskimager/
c. Python 3.3.4 (or newer) from www.python.org/download/
d. PyCharm from www.jetbrains.com/pycharm/download/
3. Create an SD card with Raspbian Linux:
a. Insert 8 GB Samsung Class 10 Micro SD card into SD card adapter, and insert it into a PC
SD card slot.
b. Reformat the SD card with SDFormatter, selecting the options to Expand and do a Full
(Erase) format.
c. Start Win32DiskImager, select the image you downloaded in step 1b, select the SD
device primary partition, and then click Write to write the R-Pi image to the SD card (if
you have any mapped drives you may see an error at startupyou can ignore the error).
a. Click Create New Project. Enter a project name, select any location for your project, and
select Empty Project for the project type.
b. Click the arrow for Python Interpreter. If a Python 3.3.4 (or newer) local Python
interpreter is displayed in the list, click it and skip the next three steps.
10
c. If a Python 3.3.4 (or newer) Python interpreter is not displayed in the list, click the
browse button () to configure a new Python interpreter.
d. To configure a new Python interpreter, click the green + on the top-right of the dialog.
Select Local in the Select Interpreter Path dialog.
e. Browse to and select a Python 3.3 or newer interpreter on your computer. If the last
Python interpreter you installed was a Python 3.3 or newer interpreter, it may be
selected by default. Click OK to select the Python interpreter and close the Select
Python Interpreter dialog, and then click OK to add the new interpreter and close the
Python Interpreters dialog.
11
f.
Set the default encoding for SSH terminal windows to UTF-8: click File -> Settings;
click SSH Terminal; and then set Default Encoding to UTF-8.
8. Run raspi-config at the Linux shell prompt with: sudo raspi-config; in raspi-config, configure the
following:
a. Expand Filesystem
b. Internationalization Options -i. Locale: en_US.UTF-8 UTF-8 (leave en_GB.UTF-8, and make en_US.UTF-8 the
default)
ii. Timezone: US/Pacific-New
12
c. Advanced Options
i. Hostname -- e.g. DIO-51
9. To use a Wi-Fi link, configure WiFi from the command line as follows:
a. Edit the interfaces file with the following command:
sudo nano /etc/network/interfaces
c. Type Ctrl-X, answer "Y" to write the updates, and then press Enter to confirm the
filename.
d. Shutdown by entering the following command: sudo shutdown now.
e. Disconnect the power from the R-Pi.
f. Physically install the Wi-Fi adapter in the R-Pi.
g. Reconnect power to the R-Pi.
h. Find the new IP address of the R-Pi, using the same method as step 9.
i. Reserve a static IP address assignment for your Pi in your router.
j. Reboot, or enter the following commands at the Linux shell prompt to release and
renew the IP address:
sudo dhclient -r
sudo dhclient
13
11. Open a terminal window with Tools -> Start SSH Session and select the server you just
created. Click Yes at the authenticity prompt. Your new console session opens as a tab in the
Terminal pane. Enter the following commands:
a. Verify that the date and time are correct with the date command. Correct them if they
are wrong.
b. Update your Linux installation with the following commands:
sudo apt-get update
sudo apt-get upgrade
These commands may take a few minutes to complete. The upgrade command displays how much
additional flash drive space will be consumed by the upgrade and prompts you to verify that the
upgrade should proceed. Enter "Y" and then press Enter to proceed. A command prompt appears
when each is completed.
12. Copy the IzoT SDK to your R-Pi:
a. Right-click your Project directory and then click Show in Explorer on the shortcut
menu. Windows Explorer opens with your Project directory open. Copy the IzoT SDK
that you downloaded to this directory.
14
b. Browse your new server by entering the Tools -> Deployment -> Browse Remote
Host command. The Remote Host pane appears. Click Yes at the authenticity prompt if
it is displayed.
c. In the Remote Host pane for your R-Pi, expand the home directory, right-click your user
directory, which is pi by default, and then click Create Folder. Enter izot-sdk for your
folder name and then click OK.
d. Right-click the izot-sdk.tar.gz file in the Project pane and click Copy on the shortcut
menu; then right-click the izot-sdk folder in the Remote Host pane and then
click Paste. Wait for the transfer to complete.
13. Open the terminal window for your host and install the IzoT SDK by entering the following
commands at the shell prompt:
a. Change to your izot-sdk directory: cd izot-sdk.
b. Extract the files from the SDK archive: tar -xzf izot-sdk.tar.gz.
c. Delete the SDK archive: rm izot-sdk.tar.gz.
d. Run the bootstrap script: etc/bootstrap. An Internet connection is required for this
step. Depending on the speed of your connection, this script may take up to 90 minutes
to run. When the script completes it displays "Welcome to IzoT!", and you will see the
Linux shell prompt.
e. Log off with Ctrl-D and log back on. This will create the virtual environment required to
use the IzoT SDK.
15
16
This command erases any previous student files and copies a fresh copy to an ~/izot-lab
directory, and then changes the current directory to the ~/izot-lab directory. You will be making
your changes to the copies in the izot-lab directory.
6. Enter the following command to start the multi_dio.py example application:
$ supy multi_dio.py -m
The supy command runs the specified application (multi_dio.py in this case) with the Python 3
interpreter running with root privileges. Many IzoT Device Stack EX applications require direct
access to I/O devices which is not allowed for applications running with user-level privileges.
The m flag runs the application in demo mode which speeds up discovery by four times.
17
7. Push Button 1 to confirm the application is running. The Multi-DIO application will toggle the
state of LED 1 each time you press Button 1 if the application is running. Relay 1 will also toggle
since it is attached to the same output as LED 1.
8. Push Buttons 2 and 3 to confirm that you can control LEDs 2 and 3. Button 2 will also control
Relay 2. There is no relay for Button 3.
Part II-B. Testing the DIO Python Application with the IzoT Device Browser
The IzoT Device Browser is a Web page included with the IzoT Server that you can use to test your
IzoT-enabled devices as you develop them. To start the IzoT Device Browser and use it to test your
DIO device, follow these steps:
1. Open the IzoT Device Browser
a. Open an Internet browser such as Chrome, and enter 192.168.1.19. The IzoT Server
home page opens.
18
b. Enter admin for the username and admin for password in the two boxes at the top-right
of the page, and then click Login.
c. Click the large green Example Dashboard (Local) button. The IzoT Dashboard opens.
The Dashboard is a custom interface for the device types implemented by the IzoT
Device Stack EX example applications. If you are viewing the Dashboard for an IzoT
Server attached to a network with multiple DIO devices, you will see all the DIO devices
in the network discovered by the server.
d. Push Button 1 on your DIO. The first box for your DIO on the Web page changes to
match your physical LED. This happens because the Javascript for the Dashboard Web
page monitors the IzoT Server for changes to the datapoints represented in the
Dashboard.
In the following example, the first box is illuminated for DIO-55 and DIO-57.
e. Click the first box on the webpage for your DIO. LED 1 on your DIO will change, and you
will hear the relay change state. This happens because your button press event is
translated to an update to the load control input for your selected device.
f. Click the Device Browser tab. The IzoT Device Browser appears. Unlike the Dashboard,
the browser can be used to monitor and control any device recognized by the IzoT
Server. When you first click the Device Browser tab, you will see a delay as the browser
gets a list of devices from the IzoT Server.
19
g. Find your device in the Device Browser and click it. There will be a brief delay as the
Device Browser queries the IzoT Server for all the datapoints on your device. The
webpage will automatically update when the Device Browser gets the response.
20
2. Use the state-1 box to monitor the output in the browser while changing the state via the first
pushbutton
3. Use the state-setting-1 box to change the state of the first digital output. Monitor the state
change by observing the LED 1 state. You will also hear the first relay turn on and off.
6. If you are doing this lab on your own, and as a result do not already have a DIO device set up as a
host for your DIO connections, search for the first instance of is_host_device. You will find it
near line 37. Change False to True for the first DIO that you startup in your network.
is_host_device = True
7. Search for the first instance of DIO_COUNT. You will find it near line 32. This will be the
statement just before the statement from the previous step. Change the value for DIO_COUNT
from 3 to 2.
DIO_COUNT = 2
8. Right-click in the editing pane, click Upload To, and then select your remote host. PyCharm
copies your edited file from your PyCharm computer to the remote host.
Part II-E. Starting the 2-Channel DIO Python Application
To start your new 2-channel DIO application and verify it works, follow these steps:
1. Open the SSH Terminal window for your R-Pi and enter the following command at the command
line:
$ supy multi_dio.py m
Your modified 2-channel DIO application starts. The m flag accelerates discovery.
22
3. Monitor the LED 1 and LED 2 states while changing the states via the browser
Part II-G. Testing Manual Peer-to-Peer Communication
In your previous peer-to-peer testing, you verified that your R-Pi device automatically joins
connections with other DIO devices in your device community. Using IzoT Control Services, you can
also use manual connections to specify specific devices that should communicate. The DIO
application is configured to delete all automatic connections once a manual connection is requested,
so your automatic connection will be deleted as soon as anyone in the lab gets to this part of the lab.
To test your automatic connection and create a manual connection, follow these steps:
1. If automatic connections for the DIO devices are still enabled, within 20 seconds of starting up,
your 2-channel DIO device will join the connections with other DIO devices in the lab. Verify
peer-to-peer connections for both of your DIO blocks. Within a few minutes of starting
multi_dio.py on your Pi, and your neighbors' starting it on their Pi devices, the multi_dio.py
applications will connect the two DIO assemblies to the matching DIO assemblies on each
other. You can verify this by pressing Button 1 and Button 2 on your Pi and watching your
neighbors' R-Pi devices to see if they change. Or, you may notice the state of your LED 1 and LED
2 state changing when your neighbors push their pushbuttons. If you are ahead of your
23
2.
3.
4.
5.
6.
neighbors, you can test with the instructors R-Pi, which is running the instructors version of
multi_dio.py, as long as automatic connections are still enabled.
To manually create a connection, push the Connect button for one second. The Connect LED on
all the DIO devices in your community will illuminate, indicating that they are all deleting the
automatic connection. After the automatic connection is deleted, the Connect LED starts
flashing on all DIOs in the community, indicating which devices are available to join the
connection.
To add a DIO device to the new connection that you have started, briefly press the Connect
button on any other DIO device with a flashing Connect LED. The Connect LED will stop flashing
and turn on, indicating the DIO device is ready to join the connection.
To add more than one other DIO device to your connection, push additional Connect buttons.
The Connect LED will stop flashing and turn on for each of the devices as you press the Connect
buttons.
To confirm your new connection, briefly press the Connect button on the first DIO device you
used to start forming the manual connection. All the Connect LEDs will turn off, indicating that
you have created the manual connection.
Test your new manual connection by pressing Button 1 or Button 2 on any of the connected DIO
devices. The corresponding LED on all the connected DIO devices should turn on or off as you do
that. You will also see that any devices not in your manual connection will not respond to your
button presses.
2. Search for the first instance of is_host_device. You will find it near line 37. Add the following
line in bold to create a global variable that you will use for your new Analog Input block:
is_host_device = False
analog_input = None
3. Search for the first instance of PROGRAM_ID = (with a space before the =). You will find it
near line 55. The program ID is used to look up the definition of the datapoints that are exposed
by the IzoT Server. This definition is contained in a file called the device class file. Change the
51 in the program ID to a 71 to specify an alternate device class file that is included with the
IzoT Server for this example device. The alternate device class file adds the definition for the
new analog output datapoint.
PROGRAM_ID = '9F:FF:FF:05:00:71:00:1' + str(DIO_COUNT)
24
4. Search for the first instance of dio_controllers.append. You will find it near line 90. This line
creates the DIO controller objects that implement the DIO functionality for this application. Add
the following lines in bold to create a new Analog Input block. The line with the call to
app.block() does all the work of creating a new block, including creating all the network inputs
and outputs required by the Analog Input profile. It also assigns analog_value as the network
visible name for the new block.
for i in range(DIO_COUNT):
dio_controllers.append(DioController(framework=framework, dio_index=i))
# Create an Analog Input functional block to publish a percentage output
global analog_input
analog_input = app.block(profile=iotAnalogInput(), ext_name='analog_value')
5. Search for the first instance of self._piface (with an underscore before piface. You will find
it near line 443. This statement turns on an LED on the PiFace board in response to a local
button being pressed. Add the following lines in bold to increment the analog output datapoint
value by one in response to any of the local buttons being pressed when their corresponding LED
is off.
if self._piface:
self._piface.output_pins[event.pin_num].turn_on()
# Increment the analog percentage output by one
global analog_input
if analog_input.nvoAnalog.data.present_value < 100:
analog_input.nvoAnalog.data.present_value += 1
else:
analog_input.nvoAnalog.data.present_value = 0
Part II-I. Testing the Multi DIO with Analog Output Application
Note: This part requires updated device class files included with version 1.01.27 or newer of the IzoT
SDK. You have to manually add the new device class files if you are using an earlier release.
To test that your new Multi DIO with Analog Output application works over the network, follow
these steps:
1. Open the IzoT Device Browser
2. Monitor the outputs in the browser while changing the state via Button 1 and Button 2. The
analog output is displayed in the analog_value field in the browser. It will increase by one each
time you press one of the local pushbuttons on the monitored Pi device. You will notice a delay
from the time you press the button until you see an update on the display. That is because you
have not yet connected this output to any inputs, so the value is only updated when the IzoT
Server polls the value. The polling rate configured for your network determines how long the
delay will be.
25
26
d. Start Win32DiskImager, select the image you downloaded in step 1b, select the SD
device primary partition, and then click Write to write the Ubuntu image to the SD
card (if you have any mapped drives you may see an error at startup--you can ignore the
error).
27
6. Start and configure PyCharm (you can use any remote console application such as PuTTY):
a. Start PyCharm
b. Set the default encoding for SSH terminal windows to UTF-8: click File -> Settings;
click SSH Terminal; and then set Default Encoding to UTF-8.
28
c. Create a new project. Enter a project name and select the Python 3.3.4 (or newer) local
Python interpreter.
29
10.
11.
12.
13.
These commands may take a few minutes to complete. The upgrade command displays how much
additional flash drive space will be consumed by the upgrade and prompts you to verify that the
upgrade should proceed. Enter "Y" and then press Enter to proceed. A command prompt appears
when each is completed.
30
b. Click IzoT Example Web Pages and then Device Browser tab and the tab with your Pis
name
31
___
state-1 ___
___
state-2 ___
SW2 - LED2:
state-setting-2
a. Click the Get Request button and wait until you get a response in the text area at the
bottom of the web page. There may be a delay.
b. Click the Get Request arrow to select different Get Request and then press the Get
Request button. Try all the commands. Any command that has a number like
datapoints/4/ or devices/4/ in it you should replace the number with one of the
datapoint IDs or the device ID for your Pi.
c. Copy the following command into the Get Request textbox and change the 1,2,3,4 to the
ids in you wrote down above.
/api/datapoints/?ids=1,2,3,4
192.168.1.19/dashboard/izot-lab/<#>/lab.html
2. Press the Refresh button. You will either get an error message or you will see a GET response in
the trace Log. If you get an error message it means that the Web page datapoint IDs do not
match your or any other Pi device and you need to change the datapoint IDs in the Web page.
You can correct these in the next section.
Part IV-C. Change the Lab Web Page Datapoint IDs
1. Start and configure PyCharm:
a. Start PyCharm. Click Create new Project.
c. Set the default encoding for SSH terminal windows to UTF-8: click File -> Settings;
click SSH Terminal; and then set Default Encoding to UTF-8. Next click the Configure
Server link.
33
d. If the IzoT server is not already listed in the Deployment pane then press the + to add
the IzoT server. Enter in the server name, IP address, and username and password and
press OK.
e. Select Tools -> Deployment -> Browse Remote Host; In the Remote Host pane select the
Beagle bone Server. Next click the button (the three dot button) in the Remote Host
pane
34
f.
Click the mapping Tab; In the Remote Host pane select the Beagle bone Server. Next
click the button (the three dot button) for Deployment path on server .
g. Navigate to the your assigned lab1. Then click the button (the three dot button) for
Deployment Path on Server.
For example if you were assigned lab1, you will want to click the following folder and click OK.
/home/ubuntu/izot-sdk/www/dashboard/izot-lab/lab1
35
h. Back in the Remote Host pane navigate to your assigned lab folder. Right click to and
select Download from Here to copy the files on the IzoT server to your computer.
i.
Expand your project folder and double click the lab.js file
36
Note: When you open the file in PyCharm you may see a lot of yellow warnings. In most cases
warnings can be ignored. If you see red errors you should look to see if you have a bug in your code.
Note: You should always make frequent backups of your Web page files when making changes as it is
not always easy to troubleshoot Web page issues.
j.
Go to the call to the addDisplayObj() function in the lab.js file. If the state-1 and statesetting-1 datapoint IDs do not match your Pi devices datapoint IDs, change the IDs to
ones your Pi uses. State-1 is the readDp and state-setting-1 is the writeDp. Write click
the file and select Upload To to copy the file from your computer to the Izot Server.
2. On the lab Web page click the Refresh button. You should see the current state of LED #. Press
Button1 on the Pi and click the Refresh button again. If you dont see a change, wait a couple of
seconds and press the Refresh button again.
3. Click the LED shape, you should see the LED element in the Web page change color and in a
couple of seconds you should see the Pi LED toggle. Click the Refresh button again on the Web
and you should the new change.
Part IV-E. Add a Second Clickable LED to the Web Page
1. Add a second LED div structure in the lab.html file
a. Go back to PyCharm and open the HTML file. Find the <div> element with leddiv_1.
b. Copy the complete leddiv_1 <div> element and its subelement to just below its </div>.
c. In this new div element change all the _1 to _2 and change the toggleLedState(1) to
toggleLedState(2).
d. If you dont see any red warnings then right-click the page to upload the file to the IzoT
Server.
2. Open the lab.js file
a. Add a second addDisplayObj() function in the $(document).ready function. Remember
to use the correct display and datapoint IDs for the second pushbutton-led.
b. Un-comment setDisplayLedColor("unknown", "canvas_2", ""); in the init() function.
c. If you see no errors in PyCharm then upload the new .js file to the IzoT server.
3. Refresh your browser and see if the second LED appears. If so, after pressing the Refresh button
and verify that you see data for two sets of datapoints in the trace log. Click the second LED, and
verify that you see the LED on your Pi toggle. The clickable LEDs controls only that LED, but the
Master On and Master Off buttons control both LEDs.
Part IV-F. Periodically Get Datapoint Values with a Refresh Timer
1. In PyCharm, open the lab.js file
a. Change the enableUpdateTimerElements() parameter in the
(document).ready(function() from a 0 to a 1.
b. Upload the file to the IzoT server.
2. In the Web Browser make sure your change works.
a. Refresh the Web Browser.
You will notice that the Refresh button disappears as well as the trace log. The trace log is good
for debugging but when you are periodically getting information it will cause too much data to be
stored which could affect Web page performance.
b. Press the push button on the Pi and you should see the LED toggle on the web page after
a short time.
c. Click one of the LEDs on the Web page. Youll see the page change state quickly but
then change back to the original state, and then in a few seconds changes again.
This feedback delays happens due to the round trip delay between changing a control datapoint,
the Pi performing a function on the control datapoint update, the Pi changing the value of the
feedback datapoint, the IzoT Server seeing the feedback datapoint update and the Web page
polling the IzoT server for changes.
38
To reduce the chance of seeing the toggling affect we need to add a feedback delay between
changing the control datapoint and responding to a change in the feedback delay.
39