Touch Keypad
The Touch Keypad example application uses a 2.5” touch screen display to implement a keypad that you can use to control lighting based on the LED Controller example application. You can also use the keypad to display temperature, humidity, and light level values reported by an Environment Sensor example application. Once launched, the Keypad application will attempt to automatically connect to Environment Sensor devices using the ISI protocol if enabled.
There are four scene buttons as well as a power button. The four scene buttons can be set to a variety of scenes depending on how the keypad is configured. The power button is used for turning the LEDs on and off.
Along with the previously mentioned buttons, there are also two addition sets of buttons used for incrementing and decrementing the hue and brightness of a particular scene.
When the keypad is "winked", which can be done from the device viewer webpage, it flashes an icon in the bottom left hand side of the keypad. This icon will flash for a full minute or until pressed.
There is also a gear button in the lower right hand side of the initial screen. Pressing this button will display the settings page. From the settings page, you can manually connect or disconnect the LED controller and environment sensor. It also allows you to send a service pin message.
Scenes, state, and color can also be input from the device viewer on the Web page.
This section consists of the following:
Hardware
The schematics are available in Eagle and PDF format in the hardware directory within the Touch Keypad example directory.
Running the Touch Keypad Application
You can start the Touch Keypad example application as a service and optionally enable it to automatically run on boot, or you can run it from the command line. Running from the command line is useful for doing interactive testing and debugging. Running as a service is useful for setting up working networks and demonstrations.
To start the Touch Keypad example application as a service and enable it to run on boot, enter the following command:
izot_enable keypad
To stop the Touch Keypad example application and disable it from running on boot, enter the following command:
izot_disable keypad
To start the Touch Keypad example application without changing its boot status, enter the following command:
izot_start keypad
To stop the Touch Keypad example application without changing its boot status, enter the following command:
izot_stop keypad
To display the status of all IzoT services, enter the following command.
izot_stat
To run the Touch Keypad example application from the command line, change to the Touch Keypad example directory at $IZOT/izot/examples/keypad and enter the following command at the Linux shell prompt:
The keypad.py script can be run with the command line:
supy keypad.py [-C] [-D] [-d DEVICE] [-h] [-I] [-i] [-l LOG] [-m] [-n NVD] [-p PROGRAM_ID] [-v] [-rRESET_TYPE]
The following table summarizes the command-line flags and options:
Flag / Option | Description |
---|---|
-C | Enables debugging with the PyCharm IDE. |
-D | Runs the Touch Keypad example application in debug mode. The log level is increased for both the console log and the application log. |
-d DEVICE | Sets the device URI, e.g., uc://10.0.1.12:1628. If not specified the default URI is used. |
-h | Displays the available flags and options. |
-I | Disables ISI. Without ISI, the application requires installation by a network management tool such as the IzoT Commissioning Tool. |
-i | Runs the Touch Keypad without any attached I/O hardware. This is useful for running the Touch Keypad on platforms that do not have the Touch Keypad I/O hardware. |
-l LOG | Sets the path and filename for log files. If not specified, the default path is the Touch Keypad example directory, and the filename is keypad. |
-m | Runs the Touch Keypad in demo mode. In demo mode, periodic ISI messaging is increased to speed up device and connection discovery. The result is that more bandwidth is consumed for ISI messaging provide faster discovery at the expense of less bandwidth for application data. |
-n NVD | Specifies the path for the non-volatile data directory. If not specified the default directory is keypad-nvd in the Environment Sensor example directory. |
-p PROGRAM_ID | Specifies a program ID for this running instance of the application. PROGRAM_ID is a 16-digit hex value described in the Defining the Program ID. If not specified the default program ID for the Environment Sensor example application is 9F:FF:FF:05:00:70:00:01. Specify a different program ID if you have modified the IzoT interface for the example application and you need to load a different device class file for the modified application. |
-r RESET_TYPE | Clears persistent data. Set RESET_TYPE to 0 to clear all persistent data; set RESET_TYPE to 1 to clear all persistent data except for the device unique ID. RESET_TYPE 1 is useful to prevent a change in unique ID which will result in a new discovery of the device by the IzoT Server. |
-v | Runs the Touch Keypad example application in verbose mode. The log level is increased to the maximum level for both the console log and the application log. |