
Building a junction box
If you are using the National Instruments Lab-NB, PCI-1200, or DAQCard-1200 data acquisition cards, you will need to buy or build a junction box for attaching the output wires from your instruments. You can buy a very basic junction box directly from National Instruments, but it's kind of expensive ($110), needs a 50-connector cable ($25), and utilizes teeny little screw terminals that are a pain to use (especially if you change connections frequently).
To build your own box, I recommend the following. You can do anything you like as long as you end up with all the inputs and outputs joined to the correct connectors on the A-D board, but this fairly simple approach works well. Building the box requires a few simple skills like soldering, cutting and stripping electrical wires, and drilling holes. If you can't do these things or don't want to, any electronics technician should be able to make the box easily.
Making a 'main' cable: First, you need a cable to connect to the A-D card (I call this the 'main' cable). Both the Lab-NB and the PCI-1200 have standard 50-pin connectors that you access through the back of your computer. The DAQCard-1200 has a special, small socket; you need to buy an adapter from National Instruments to provide the same 50-pin connector as on the other two cards (incidentally, this costs about $75, which is about 10% of the price of the DAQcard itself! And you'll still need a junction box!). The best 50-conductor cable to get is one used to attach many disk drives to their circuit boards. It has the requisite female connector at one end (see picture below) and two more at the other, and is available at many electronics parts stores for perhaps $15. Just make sure to get the 50 conductor cable, not the 37 conductor version!
A 50-pin ribbon cable is rather large and unwieldy (and
you won't need all those conductors to use LabHelper). Moreover,
attaching things to a 50-pin connector can be a challenge (you'll likely
find this out when you try attaching the main cable to the A-D card; fortunately
you don't have to do that very often). To minimize these problems,
cut the ribbon cable crosswise (a good pair of scissors works nicely), about
25-30 cm from the connector. Then carefully split it into two 25 conductor
halves for part of the total length. You should end up with
something like this:
For those not unduly familiar with electronics, note that along one edge of the ribbon cable is a contrastingly-colored wire (the colors may be different than shown here). This indicates conductor #1, which (logically enough) is joined to pin #1 on the connectors, which themselves will have small markings (triangles or arrows) to indicate pin #1. It's important to keep this orientation in mind for the next step in cable construction.
Now that you've split the ribbon cable, you need to attach appropriate connectors to the bare ends. I use a standard 25-pin connector called a DB-25 (25 pins in a double row) designed for use with ribbon cable. When you buy parts, make sure you get the DB-25 versions for ribbon cable!
You'll probably need two DB-25's, one male and one female
(you only need the male if you want to make all your connections through
a single junction box). These need to be attached to the ribbon cable
by inserting the cable ends into the DB-25 connector and then squeezing
the two parts of the DB-25 in a vice (carefully). This crimps the
pin leads through the insulation on the ribbon cable and mates them with
the actual conductors (how this works is obvious when you look at the DB-25).
You can insert the ribbon cable into the DB-25 in either direction as long as you keep the pin polarity correct.
Make sure you line up conductor #1 of the cable with pin #1 on the first
(male) DB-25 (remember that pin #1 will be marked with a little arrow or
triangle). For the second (female) DB-25, line up its pin #1 with
conductor #26 on the cable (the first conductor after the split).
You should end up with something looking like the diagram.
At this point you have a choice. You'll always be using the male DB-25 on the main cable (which I'll refer to as the "main cable male connector") to connect to the incoming voltage signals from your instruments. For digital outputs (used to switch external devices), you can use either of the two DB-25s. You can bring all the connectors through the main cable male connector to a single (fairly complex) junction box, or you can bring the digital connections through the female DB-25 on the main cable (which I'll call the "main cable female connector"). In the latter case, you probably don't need a second junction box, since the cable from your external devices can be terminated in a male DB-25 that plugs directly into the main cable female connector.
This diagram shows all of the connections you need to
make if you wish to use the main cable male connector exclusively, and use
the analog voltage outputs and digital outputs in addition to the analog
voltage inputs. The colored circles represent pins (actually sockets)
on the DB-25 or binding posts (the terminals
to which you attach wires from your instruments) on the junction box (the
position of the binding posts on your junction box is not crucial).
If you just want to read voltages, you only need to make the first 9 connections (from the top; red and green wires). To add digital control of external devices, you need to add the bottom 9 connections (blue and green). However, if you intend to use external digital devices exclusively in "3-bit word" mode and not "one line per device" mode, you only need to use the first 3 digital lines (bits 0-2) and the digital ground. If you use the "one line per device" mode, you need to connect as many digital outputs as you have devices to switch (to a maximum of 8). See the External Devices page for descriptions of these two modes. Make sure you tell LabHelper to use Port 0 for digital output (instead of Port 2); this is done in the A-D menu.
To use the analog voltage outputs, you'll need to connect the middle 3 wires (green and orange). [I haven't quite finished implementing this in a useful way in LabHelper, but I'm working on it.]
To avoid some confusion: if you read the National Instruments user's manuals, you will see the analog inputs numbered from zero to seven instead of one to eight, as in this diagram. Also, the analog outputs are numbered zero and one in the NI manuals, instead of 1 and 2 as shown here.
The system uses a single-ended configuration with a common ground for all analog inputs. Electronics purists may cringe at this, since in theory single-ended inputs aren't as resistant to electrical noise as differential inputs. However, in reality most instruments don't employ differential outputs, and in a decade of use I've never found electrical noise to be much of a problem (the PCI-1200 and DAQCard-1200 can be configured with 4 differential inputs instead of 8 single-ended inputs, but LabHelper doesn't use that option).
This table shows the junction box connections indexed to the pins on the female DB-25 connector (for attaching to the main cable male connector):
| DB-25 pin | junction box | DB-25 pin | junction box | |
| 1 | voltage input channel 1 | 14 | voltage input channel 2 | |
| 2 | voltage input channel 3 | 15 | voltage input channel 4 | |
| 3 | voltage input channel 5 | 16 | voltage input channel 6 | |
| 4 | voltage input channel 7 | 17 | voltage input channel 8 | |
| 5 | input voltage ground | 18 | analog output channel 1 | |
| 6 | analog output ground | 19 | analog output channel 2 | |
| 7 | digital ground | 20 | bit 0, digital port 0 | |
| 8 | bit 1, digital port 0 | 21 | bit 2, digital port 0 | |
| 9 | bit 3, digital port 0 | 22 | bit 4, digital port 0 | |
| 10 | bit 5, digital port 0 | 23 | bit 6, digital port 0 | |
| 11 | bit 7, digital port 0 |
This table shows the pin connections for attaching external devices through the main cable female connector. Remember that the cable from the external device must terminate in a male DB-25 with these connections. You also need to tell LabHelper to use digital port 2 (in the A-D menu).
| DB-25 pin | external device | DB-25 pin | external device | |
| 3 | bit 0 | 16 | bit 1 | |
| 4 | bit 2 | 17 | bit 3 | |
| 5 | bit 4 | 18 | bit 5 | |
| 6 | bit 6 | 19 | bit 7 | |
| 13 | digital ground |
Metal (or heavy plastic) chassis box with enough
room for all your connectors and any additional electronics you might want
to add -- don't try to make it too small!
DB-25 female solder-tail connector (gold-plated sockets
will make for better connections) with hood.
Connecting cable with at least 9 conductors (minimum
configuration; voltages only) to 21 conductors (maximum configuration).
I usually avoid ribbon cable for this purpose, since it will get a lot of
use and ribbon cable often ends to fall apart or abrade if abused.
The cable should be about 2 meters long.
Alternately you might get a pre-built cable terminating with a female DB-25 and including all the conductors you need, but this may be hard to find (most DB-25 terminated cables are for serial ports and have only 7-9 conductors, and not the right ones for LabHelper). Another possibility is to attach the DB-25 directly to the junction box, with no intervening cable. Then you can use a 25-pin ribbon cable with male and female DB-25s to join the junction box to the main cable on the computer. You could even join the junction box directly to the main cable, especially if you make the main cable several feet long.
Strain relief for the cable (to keep it securely
and safely fastened to the box).
Enough binding posts for all the connections you
need (16 minimum, 28 maximum). The choice of style and color is yours;
I like the spring-loaded types since they easily and quickly make secure
connections to bare wire leads; examples are the terminals used on many
stereo speakers. Screw-down posts (finger-tightened, as opposed to
simple screw terminals that need a screwdriver) also work well, if a bit
more slowly (usually these posts also include sockets for 'banana jack'
plug connectors). You can also chose BNC connectors, as long as you
never intend to make a connection with anything other than a BNC cable (these
are practically impossible to use with bare wires).
To avoid confusion, try to use red for the analog input signal posts and green or black for the analog ground posts, and some other color for digital output posts.
Some means of labeling the binding posts.
Optional additions:
If you are the paranoid type (like me), you may want to
add additional overvoltage protection. This might help avoid the tragedy
of fatally zapping your A-D card with a stray static charge, an instrument
voltage surge, or (shudder) an accidental connection to high voltage instead
of a proper signal. I've never had any of these disasters actually
happen -- even when working without protection, so to speak -- but there's
a first time for everything... Anyway, get a pair of 6-12 volt zener
diodes for EACH analog input (a total of 16). Zeners have very high
resistance until a certain threshold voltage is exceeded, whereupon they
short (resistance drops to near-zero). Connect them between input
and ground such that any voltage with absolute value > 6 to 12 volts
gets shorted to ground.
You may also want to add built-in circuitry for reducing
large input voltages to readable levels (a voltage divider), for noise filtering,
or for voltage offsets. The Sable Systems online
measurement guide is an extremely useful reference for this sort
of stuff.
go back to the LabHelper Topics page