Digital I/O: It's easy & it works
Use signal-conditioning components to connect the signals in a data-acquisition system.
Martin Rowe, Senior Technical Editor -- Test & Measurement World, 11/1/2001
|
While analog measurements often top the list of data-acquisition issues, don't forget about digital I/O. When you need to switch UUTs to power sources prior to a test, check the status of a device, or control a motor or oven, you need to use digital I/O ports. How you connect your measurement equipment to outside devices can mean the difference between success and failure.
Multifunction data-acquisition boards and external modules often add 8 to 40 digital I/O lines to a host computer. Plug-in digital I/O cards can add up to 128 digital I/O lines per card, and external digital I/O systems can add even more. When configured as inputs, digital I/O lines let you read the status of TTL-level signals. When configured as outputs, they let you toggle TTL outputs that you can use to control external devices.
Data-acquisition systems often need to read or control signals with voltages and currents that exceed TTL levels. In these cases, you need to add signal-conditioning components.
You can either design your own signal-conditioning circuits with discrete transistors, optoisolators, mechanical relays, and solid-state relays (SSRs), or you can buy off-the-shelf digital-signal-conditioning hardware. (See Design your own drive circuits for information about basic digital I/O circuits.) For most applications, using off-the-shelf signal-conditioning modules will save you the time and trouble of designing, building, and testing your own circuits.
Companies such as Grayhill (LaGrange, IL, www.grayhill.com) and Opto 22 (Temecula, CA, www.opto22.com) manufacture I/O modules that condition the TTL-level signals to numerous higher-level signals (Figure 1). Manufacturers of data-acquisition hardware design their products to easily connect to these modules.
![]() |
| Figure 1. I/O modules contain relays and optoisolators that convert external signals to signals compatible with digital I/O ports on data-acquisition hardware. Courtesy of Opto 22. |
![]() |
| Figure 2. Interconnect boards adapt a ribbon cable from a digital I/O board (center connector) to other ribbon cables that connect to I/O modules. Courtesy of United Electronic Industries. |
Output modules contain mechanical relays or SSRs that boost the voltage and current drive capabilities of TTL-level signals; these relays also provide electrical isolation. Output modules typically can drive up to 3.5 A at up to 280 V.
Make the connectionTo use I/O modules, you must connect them to your measurement hardware and to your external devices (solenoids, motors, heaters, etc.). You can design and build your own boards and cables to connect your measurement system to the modules. Alternatively, you can get mounting boards (called "mounting racks") that accept 4, 8, or 16 modules. Measurement-equipment manufacturers offer cables and breakout panels that let you connect their equipment to I/O module mounting racks. The breakout panel in Figure 2 takes TTL signals from one 100-pin ribbon cable, adds ground lines, and routes the signals to four 50-pin ribbon cables. These cables connect directly to an I/O module mounting rack.
After you connect your measurement equipment to an array of I/O modules, you'll need to connect the modules to your sensors and actuators. If you use a module rack, you can connect your external signals to I/O modules through terminal strips such as the one shown on pp. 12–13. Typically, input modules require five wires, and output modules use four. (To learn more about your I/O modules, you should download data sheets, which contain schematics and connection diagrams, from the module manufacturers' Web sites.)
Some input modules let you detect the presence or absence of AC or DC input signals (Figure 3a), while others accept DC voltages only (Figure 3b). Those that accept AC signals will internally rectify the voltage into DC before applying it to an optoisolator. For either type of module, you connect your input signal to a pair of terminals.
|
|
| Figure 3. (a) AC input modules rectify AC voltages and provide digital outputs for a measurement system’s digital inputs to detect. (b) DC-only input modules don’t need a rectifier. |
![]() |
| Figure 4. Digital output modules take TTL-level signals from a measurement system to control an SSR’s output. A bleeder resistor assures that the load will turn off when the SSR’s output achieves a high-impedance state. |
The side of an input module that connects to your data-acquisition equipment requires three connections. One connection provides 5 V to power the phototransistor output of the module's optoisolator. The NPN transistor's collector and emitter become the input modules' output to your measuring equipment. You can make these three connections with a commercial cable and an I/O module mounting board. But you may need to add a pull-up resistor between the collector and the 5-V terminal if you don't buy a mounting rack. Some racks and input modules provide the pull-up resistor, so check your documentation.
Output modules (Figure 4) have four connections: Two connect to your measurement system's TTL-level digital outputs, and two provide a switch to control a load. The module's input terminals connect through a ribbon cable to your measurement equipment's output port. Using a rack's terminal strips, you connect your load and external power supply to the output module's power-output terminals.
Under some conditions, you may not need external output modules. Some manufacturers offer internal mechanical-relay and SSR boards that you install in your computer; you connect your external I/O devices to the relays through a screw-terminal board. Some companies also provide external relay boards that operate under the control of TTL-level signals from an internal digital I/O board (Figure 5).
![]() |
| Figure 5. Some accessory boards contain mechanical relays that can provide power to external devices. Connect your loads to the board at the terminal strips. Courtesy of Keithley Instruments. |
![]() |
| Figure 6. Digital I/O boards may contain solid-state relays that isolate signals and boost output drive capacity. Courtesy of National Instruments. |
In some applications, you need to drive loads that require more than a few milliamps but not as much as a few amps. Some digital I/O boards and systems contain TTL buffer ICs that increase output current over TTL-level signals available from the board's I/O port controller chip. Other boards may include low-current optoisolators. A buffered TTL signal, for example, may supply (source) as much as 32 mA per channel and pass (sink) as much as 64 mA per channel. A board containing optoisolators (small SSRs) such as the one in Figure 6 may pass 120 mA per I/O line, enough to drive small solenoids.
Just because an IC containing several outputs can pass a specified amount of current doesn't mean you can simultaneously drive every channel with that much current. For example, a 74LS373 latch (often used in multifunction and digital I/O cards and systems) can sink 64 mA through each of its eight I/O lines. But there's an aggregate limit of 180 mA that can safely pass through the device. If you exceed that aggregate limit, you could overheat the device and damage it.
Tips and tricksA few simple tips can help you get the most out of your digital I/O system:
When you drive inductive loads, such as solenoids, you should install a diode across the load's coil. Inductors store energy. When you remove power from an inductor, the stored energy will dissipate as current that will take any available path to ground, which could be directly to ground or through a power supply. That current can cause a ground bounce that can radiate EMI, which may interfere with other circuits.
By placing a diode across the load, you provide a path that keeps the current away from other circuits. (Some relay boards and I/O modules include such diodes, so check your data sheets to see if you need to add your own.) You should install a diode as close to its corresponding coils as possible to minimize the loop size and, thus, radiated emissions. Attach the anode to the coil's positive voltage supply and attach the cathode to the other end of the load. When you remove power from the coil, the current will dissipate in a loop through the diode, bypassing other circuits.
When you use an SSR to drive a device, you need a bleeder resistor. When you connect your load to an SSR's output as shown in Figure 4, you need a pull-down bleeder resistor in parallel with the load. The resistor provides a path to ground for any voltage that might remain across the load when the SSR moves to a high-impedance state. Remember the resistor is in parallel with the load, which lowers the resistance the SSR must drive. The bleeder resistor should have a value that's at least 100 times greater then your load's resistance.
To decide if you need a mechanical relay or SSR, you must consider a device's switching time and your switching rate. If you need to control a motor by pulsing its power, then use an SSR. SSRs change state three orders of magnitude faster than mechanical relays. A typical SSR takes dozens of microseconds to change state whereas a mechanical relay needs dozens of milliseconds. Mechanical relays may be too slow. Also, SSRs don't wear out as mechanical relays do. Use mechanical relays for controlling alarms and other slow devices.
If you need to monitor the status of 24 VDC or AC mains controlled by a mechanical relay, you must deal with relay bounce. When mechanical relays close, they often "bounce," or connect and disconnect several times before remaining closed. If you use a digital input to sense the status of an externally controlled mechanical relay, then don't simply poll that input once. Your data-acquisition system may falsely detect an open circuit while the relay bounces. You can "debounce" an external relay by polling your digital input two or more times several milliseconds apart until you detect the closed position on two or three successive polls.
Digital I/O, while often easier to implement than analog I/O, still requires careful component selection and wiring. Most often, off-the-shelf components will handle your digital I/O signal conditioning, simplifying your measurement system design.
For more information"82C55A CHMOS Programmable Peripheral Interface," Intel, Santa Clara, CA. developer.intel.com/design/periphrl/datashts/231256.htm.
Data Acquisition and Control Handbook, Keithley Instruments, Cleveland, OH, 2001. www.keithley.com.
"G4 Digital I/O Wiring Diagrams," Opto 22, Temecula, CA. www.opto22.com/Datasheets/1287_G4_Wiring_Diagrams_IntheBox.pdf
Lancaster, Donald E., TTL Cookbook, Sams, 1980.
Maharajh, Niranjan, "Digital I/O Applications," Application note AN-131, National Instruments, Austin, TX. This application note describes how to program 8255 I/O ports for data transfers. zone.ni.com/devzone/conceptd.nsf/appnotebynumber.
"MXSB 039 Opto-Isolator Board," Technical note TN-192, Microstar Labs, Bellevue, WA. www.mstarlabs.com/docs/technote.html.
| Author Information |
| Martin Rowe has a BSEE from Worcester Polytechnic Institute and an MBA from Bentley College. Before joining T&MW in 1992, he worked for 12 years as a design engineer for manufacturers of semiconductor process equipment and as an applications engineer for manufacturers of measurement and control equipment. E-mail: m.rowe@tmworld.com. |
|




























