Digital Output Guide
Introduction
Digital outputs on VINT Hubs and InterfaceKits can be used to drive LEDs, transistors, or anything that accepts a digital control signal. With the help of external transistors and some electronics experience, other devices can be controlled, such as buzzers, lights, larger LEDs, and relays.
If you think your project could benefit from the use of digital outputs, check out this list of Phidgets with Digital Outputs.
State
On a basic level, all digital outputs have two states: TRUE or FALSE. This translates to on (high) and off (low) respectively. In a low state, the digital output produces a 0V signal, and a high state will produce the digital output voltage. This voltage (commonly 3.3V or 5V) is specified on the product page for your device.
Duty Cycle
Some Phidget Digital Outputs have the ability to set a duty cycle which can provide more control over the power to the load. This can be used to dim LEDs, or other similar loads.
Setting the duty cycle sets the fraction of time the output is on (high), as shown in the diagram to the right:
As the diagram shows, a duty cycle of 1.0 is equivalent to a TRUE state, and a duty cycle of 0 is equivalent to a False state.
Duty cycles other than 1 and 0 should only be used with output devices that react quickly enough or are "dimmable". For instance, you could use a duty cycle of 0.5 with an LED or a transistor driving a small fan, but not with a mechanical relay, which needs to be left completely on or off.
State vs. Duty Cycle in the API
In our API for communicating with Digital Output Phidgets, there are parameters for Duty Cycle and State. When setting these parameters, it is important to know that setting a Duty Cycle of 1.0 or 0.0 can be used interchangeably with setting the State to TRUE or FALSE, respectively. We recommend you use either Duty Cycle or State exclusively for a given Digital Output.
Technical Details
Ground Protection
Ground terminals on the VINT Hub share a common ground with USB ground. Because they are not internally isolated, these terminals will expose the USB ground potential of the PC to which they are connected. Be sure you are completely familiar with any circuit you intend to connect to the VINT port before it is connected. If a reverse voltage or dangerously high voltage is applied to the input or output terminals, damage to the Phidget or the PC may result.
Remembering Output States Through Reboot
When your computer reboots, the Digital Output object will disconnect in software, which will cause you to lose your output states, even if the digital output is connected to a powered USB hub. If you need to remember the output states, you could program your application to save the states to a file when a disconnect event occurs, and load the states when it connects again.
Switching Frequency
Due to the nature of USB communications, it is not possible to give a concrete specification for the exact speed or precision with which you can time switching the outputs. The exact time it takes between calling the command to change the output could take anywhere form one millisecond to several, depending on the system running on the local machine and the overall system load, among other variables.