Multi DIO

The Multi DIO application demonstrates simple digital input and output that can be built for one to seven channels.  It is the simplest of the IzoT SDK example applications, and is a good starting point to learn about IzoT Python and LonTalk/IP. You can use this example to see how to monitor both a hardware digital input and a LonTalk/IP digital input datapoint, and use them to control the state of a hardware digital output and a LonTalk/IP digital output datapoint.

 

The Multi DIO example application runs on a Raspberry Pi device with a PiFace Digital I/O Board installed. The PiFace Digital I/O 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.  The Multi DIO application uses the pushbuttons and the relay outputs.

 

The Multi DIO application is used for the IzoT Device Stack Hands-on Lab. You can take a look at the Hands-on Lab Instruction Manual for more details.

 

Using the Multi DIO application, you can control each pushbutton switch directly or via the IzoT network using the demo Web pages, as shown in the Dashboard Web page.

 

The following video describes how to create a network with the Multi DIO application:

 

 

The Multi DIO application toggles the state of LED 1, 2, or 3 each time you press the corresponding Button 1, 2, or 3. When LED 1 or LED 2 toggle, Relay 1 or Relay 2 also toggle since they are attached to the same outputs as LED 1 and 2. There is no relay for Button 3.

 

A key feature of the IzoT Platform is the capability for IzoT-enabled devices to autonomously communicate without the use of servers or controllers. IzoT-enabled devices can periodically broadcast information about their applications and available datapoints, and can monitor these broadcasts to subscribe to datapoint updates from compatible devices. The Multi DIO application broadcasts information that informs other IzoT-enabled devices that it has a digital input that can be controlled via a datapoint, and it has a digital output that publishes the state of the digital point.

 

To optimize network traffic, one of the Multi DIO devices in your community acts as a host for all the Multi DIO connections. You will need to modify the application on one of your Multi DIO devices to act as a host. To do this, change the value of is_host_device in the Multi DIO application to True.

is_host_device = True    # Set to True if this device is a host

Once you have multiple Multi DIO applications running, and one of them is acting has a host, they will discover each other and start to form connections, creating a community of devices. Within a few minutes of starting the Multi DIO applications on your multiple Pi devices, the Multi DIO applications will connect to each other. By pressing the first pushbutton on one Pi device, you may notice that the state of LED 1 of the other Pi devices are changing.

 

You can change the number of DIO blocks on your device. By default the Multi DIO application implements three DIO blocks. To change the number of DIO blocks on your device from three to two, modify the value for DIO_COUNT in the Multi DIO Python application from "3" to "2".

DIO_COUNT = 2             # Number of DIOs; can be 1 to 7 with the PiFace