Global TMW:
Login  |  Register          Free Newsletter Subscription
Subscribe
Email
Print
Reprint
Learn RSS

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

Design your own drive circuits

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.
Digital input modules sense voltages as high as those on AC mains and convert them to TTL-level signals that measurement equipment can safely detect. Because the input modules use optoisolators, they also provide electrical isolation between sensitive measurement equipment and external devices. The isolation protects computers and sensitive measurement equipment from harsh signals often found in external devices, and they eliminate potential problems with ground loops.

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 connection

To 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.
Before you specify a mechanical relay or SSR output module or internal relay output board, you need to measure the power requirements of your load. Start by connecting the load from a power supply through a switch, then measure the voltage across and the current passing through the load. Use an oscilloscope with a voltage probe and a current probe. Pay attention to the power required to start the load, not just to maintain it. Then, add a safety factor of at least 20% when you specify a relay or output module. For example, if a load requires 1.3 A in the steady state, but requires 3 A at startup, you should use a relay or module that can pass at least 3.5 A.

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 tricks

A 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.

 

Design your own drive circuits

If you just need to drive or sense the status of one or two devices, then buying an I/O module, a mounting rack, and interconnect cables may not be worth the cost. In those cases, you can build your own signal-conditioning circuits.

To convert a high-level voltage to TTL levels, you can use an IC optoisolator. Optoisolators are available in small quantities from most component distributors. Figure A shows a typical optoisolator input circuit. You just need to add a current-limiting resistor in series with the optoisolator's input LED. Calculate the resistor value based on the signal voltage, the voltage drop across the LED, and the LED's drive current.

Figure A. Optoisolators provide electrical isolation between your measurement system and external devices.

Figure B. A small-signal transistor such as a 2N2222 or a 2N3904 can sink up to 800 mA, enough to drive numerous devices.

Suppose you need to drive a small load such as a solenoid, a light bulb, or a buzzer that requires 250 mA. You can't sink or source that much current through a board's digital I/O lines. You can boost the current with a bipolar transistor, Darlington transistor, or MOSFET device. You'll also need an external power supply, although your data-acquisition card may provide enough power, depending on the voltage and current you need to drive your load. Figure B shows a typical drive circuit using a small-signal NPN bipolar transistor that can pass up to 800 mA. If you need more current, you can use a power transistor or MOSFET. See "Interfacing Power MOSFETs to Logic Devices" for more information (Ref. A). You also can use Darlington-transistor array ICs such as the ULN20XX series available from both Texas Instruments (www.ti.com) and Allegro Microsystems (www.allegromicro.com).

Unfortunately, a transistor won't electrically isolate the load from the data-acquisition board. Current in the load can couple into sensitive circuits. So, you should use a mechanical relay or SSR to drive the load. Figure Ca shows a typical circuit in which a small-signal transistor drives a relay that in turn, drives a load.

Figure C. a) Mechanical or b) solid-state relays let you drive external devices and isolate computer grounds from external grounds.

You also can drive relatively low-current devices with small SSRs. These optically-isolated relays can drive about 600 mA and you can connect them directly to most TTL output circuits because they turn on with as little as 5 mA. Figure Cb shows a typical drive circuit, and "Choosing An Input Resistor for a Microelectronic Relay" explains how to calculate a series resistor value for the SSR's input (Ref. B).

References

A. Berringer, Ken, "Interfacing Power MOSFETs to Logic Devices," Application note AN1102, ON Semiconductor, Phoenix, AZ. www.onsemi.com/pub/Collateral/AN1102-D.PDF .

B. Collins, Bill, "Choosing An Input Resistor for a Microelectronic Relay," Application note AN-101, International Rectifier, El Segundo, CA. www.irf.com/technical-info/appnotes/an-101.pdf.

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

Sponsored Links



 
Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Podcasts

Blogs

  • Rick Nelson
    Taking the Measure

    July 1, 2008
    S-parameters are so yesterday
    Textbook amplifiers operate in linear mode and are easy to analyze. Unfortunately, it’s often ...
    More
  • Martin Rowe
    Rowe's and Columns

    May 28, 2008
    More on Bill and Dave
    In my January 11 posting, "Tell your Bill and Dave Stories," I asked if the HP Way still e...
    More
  • » VIEW ALL BLOGS RSS

Podcasts

Advertisements





NEWSLETTERS
Click on a title below to learn more.

Test Industry News (3 Times Per Month)
Machine-Vision & Inspection (Monthly)
Communications Test (Monthly)
Design, Test & Yield (Monthly)
Automotive, Aerospace & Defense (Monthly)
Instrumentation (Monthly)
Resource Center E-Alert (Monthly)
©2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites