Copyright (C) 2005 - 2009
All rights reserved
Kadtronix / Delahoussaye Consulting
Kadtronix USB Motion Detector
The USB Digital I/O Commander, herein referred to as simply "Digio", provides a powerful means of interfacing your computer to external devices via digial I/O signals. Compatible with desktop and laptop systems, Digio allows a Windows PC to set digital outputs and/or read digital inputs. You can use Digio as a means of controlling external devices.
While Digio can perform simple "set" and "get" operations, its real strength lies is its ability to define notification action(s) when input signals, also referred to as "trigger signals", change state. You'll find Digio an important tool for use in a variety of applications including industrial control, hardware design, and prototyping.
Digio is compatible with the USB Motion Detector which is comprised of an infrared detector and internal USB I/O module (U4x1). The USB I/O module has integrated cable which connects to an available USB port on your computer. The module provides 16 I/O signals configurable in any combination of inputs and outputs. The system is easily expanded by simply adding more USB modules.
Becoming familiar with a new tool can sometimes be a daunting
Many times a real-world example provides the insight needed to gain
and understanding. This tutorial describes how to use
Digio to configure a real-world USB security system consisting of PIR
sensor, 10 door/window sensors, horn/siren relay, and USB interface
(For details on purchasing a USB motion detector plus Digio software,
to the USB
Motion Detector page at the Kadtronix
website.) For details on Digio software including system
installation, and descriptions, you can view the Digio User
The following image shows how to wire a standard PIR motion detector. An external source is required for powering the detector. (Note: The Kadtronix USB Motion Detector is pre-wired and requires no external power source as it derives its power directly from the USB cable. No additional wiring or assembly is required.)
When the program begins, the main display dialog appears as shown below:
On first-time start-up, you will be asked to register your software. Fill in the requested fields and click "Send" to submit your registration data.
Your software may require a license key for activation. If
a key will be provided to you via e-mail after purchase. The
key is an encoded string consisting of a series of alpha-numeric
When you receive the license key, select the following main menu item:
Enter the encoded key string in the "Enter key:" field as shown in the example below. Then, click "OK" to accept the new key and enable the application.
Make the settings adjustments as shown below:
Of particular importance are the notification delay settings shown below. Be sure to activate the "No Re-Trigger" check-box. This will ensure that alarms do not re-trigger falsely.
The following parameters are required for email notifications:
The program is compatible with systems where e-mail is implemented on networked servers. In this instance, simply enter the server name in the "Outgoing Mail Server" field.
Specify the following parameters only if SMTP authentication
Now that you have completed the properties settings, close
by clicking "OK".
Use the "Device" combo-box to select the device as shown. Digio can accommodate multiple U4x1 devices, but our security system application uses only 1 device and it will be designated DEV_00. Additional USB devices would be designated DEV_01, DEV_02, etc. You should establish directions (input/output), states (high/low), and label descriptions as shown. (Note: It is not necessary to set the high/low state on inputs since they will be determined by the software automatically.)
Also enter default notification delay values as shown. Notification delays are used to prevent an overload of notifications on very active inputs. The "Default" column defines the beginning countdown value when a trigger event occurs. For instance, a value of 30 indicates that a minimum delay of 30 seconds is required between successive alarm trigger notifications.
An important setting to note is the check-box located in the upper left region of the dialog.
Use this check-box to enable internal pull-up resistors within the U4x1. This setting is required for proper operation of the USB security system. It ensures that when the motion detector senses activity, a logic high signal will be received at the U4x1 device.
After completing the fields, click "OK" to save your selections, exit the dialog, and return to the main display. It should now contain a summary of your recent settings changes as shown below:
You will notice that most of the fields have been grayed (disabled). This is because the selected signal ("00") is configured as an output for horn/siren activation. Since events are defined for inputs only, you will bypass this signal and go to signal "01" instead. To do this, left-click the mouse on the "Signal" combo-box and select "01" as shown below:
The following display will be shown whose contents represent the PIR motion detector:
First, ensure that the defined bit length is "1" as shown in the image below:
Next, locate the region titled "Single-Bit Trigger" and select "HIGH" as shown below. This assumes the normal pre-trigger state is LOW and that detected motion will cause the signal to become HIGH.
Since you will not be using SPI triggers or Time/Day triggers, you should keep them disabled. It's now time to define some notifications. Remember that these are the actions to take when the PIR motion detector "triggers", i.e., detects movement. There are 8 possible notification types. You will define four actions to perform: display a message on the monitor, send an e-mail message, set a signal output, and play a sound file. Left-click each check-box to enable the four events as shown below:
You will notice two rows of buttons to the right labelled "Select..." and "Preview". Use the select buttons to define events and the preview buttons to test them.
Now, left-click the first (upper) "Select..." button associated with the "Display Msg" selection. Enter the message text, "Motion detected in front lobby" as shown. This text message will be displayed on your computer's monitor when the event occurs. Use "Auto" to automatically extinguish the message after the specified number of seconds. Click "OK" to save the selections, close the dialog, and return to the previous page.
Left-click the "Select..." button associated with the "Send E-mail" selection. This allows you to designate an e-mail message to occur in response to an event. Choose the desired e-mail recipient(s), message subject, and body. If you have not already dones so, be sure to specify e-mail properties using the "Properties..." button. Click "Send" to send a test e-mail message. Click "Close..." to save the selections, close the dialog, and return to the previous page.
Next, left-click the"Select..." button associated with the "Set Output" selection. This will allow you to activate the horn/siren relay in response to detected motion. Make the selections as shown, being sure to choose output signal "00". Also check the "Enable Toggle" box and specify a time delay. This will cause the siren to automatically de-activate after the defined time period. Click "OK." to save the selections, close the dialog, and return to the previous page.
Now, left-click the "Select..." button associated with the "Play Wav" selection. A file browser dialog will appear, allowing you to choose the desired sound file. This file will be played when the alarm event occurs. Click "Open" to save the selection, close the dialog, and return to the previous page. Use the "Preview" button to play the selected sound file.
Now that you have defined the four alarm notifications for signal "01", your events page should resemble the following:
Next, define event associations for the remaining inputs: 02 through 11. Follow the same procedures as described above, beginning with input signal selection as shown below:
Since signal 02 corresponds to the "Front Entrance", you should define messages that appropriately describe this input. You have the flexibility to define any subset of the 8 available notification types. If you choose to remove or disable a notification, simply left-click the box to remove its check-mark.
There is a small red indicator light on the front of the detector unit that illuminates when movement is detected. While viewing your computer's monitor, walk in front of the detector or have an assistant do so. You should notice a pop-up message on your monitor as shown below:
If you configured this message as suggested earlier in the tutorial, it will be shown for several seconds and then automatically extinguish. If you have designated audio (.wav sound) and/or e-mail notifications, make sure they also trigger. If they do not, check the Digio configuration to determine if they are properly defined and enabled. Test the horn/siren relay with a multi-meter. Attach leads to the unsoldered contact connections and check for continuity. The relay will be activated for 20 seconds before de-activating automatically.
The following tables present pin-out information:
|Pin Number||USB Interface Signal|
|7||+5V USB from PC|
|15||PA.0 - Port A bit 0|
|16||PA.1 - Port A bit 1|
|17||PA.2 - Port A bit 2|
|18||PA.3 - Port A bit 3|
|19||PA.4 - Port A bit 4 [SPI SS (slave-mode only)]|
|20||PA.5 - Port A bit 5 [SPI MOSI]|
|21||PA.6 - Port A bit 6 [SPI MISO]|
|22||PA.7 - Port A bit 7 [SPI SCLK]|
|23||PB.0 - Port B bit 0|
|24||PB.1 - Port B bit 1|
|25||PB.2 - Port B bit 2|
|26||PB.3 - Port B bit 3|
|27||PB.4 - Port B bit 4|
|28||PB.5 - Port B bit 5|
|29||PB.6 - Port B bit 6|
|30||PB.7 - Port B bit 7|
|Pin Number||USB Interface Signal|
|14||+5V USB from PC|
|1||PA.0 - Port A bit 0|
|2||PA.1 - Port A bit 1|
|3||PA.2 - Port A bit 2|
|4||PA.3 - Port A bit 3|
|24||PA.4 - Port A bit 4 [SPI SS (slave-mode only)]|
|23||PA.5 - Port A bit 5 [SPI MOSI]|
|22||PA.6 - Port A bit 6 [SPI MISO]|
|21||PA.7 - Port A bit 7 [SPI SCLK]|
|5||PB.0 - Port B bit 0|
|20||PB.1 - Port B bit 1|
|6||PB.2 - Port B bit 2|
|19||PB.3 - Port B bit 3|
|7||PB.4 - Port B bit 4|
|18||PB.5 - Port B bit 5|
|8||PB.6 - Port B bit 6|
|17||PB.7 - Port B bit 7|