In many neurophysiology or imaging experiments, we record activity of neurons while simultaneously providing some form of stimulation or taking images with devices that are controlled by different computers. To do this, it is important that we are able to track when all of these devices are active and providing their stimuli or performing their recording.
To accomplish this synchronization, we send digital trigger signals from many of our devices that indicate exactly when they have performed some action. These trigger signals are received and acquired by our main data acquisition device. These trigger events are then correlated with physiological signals that are also acquired on the main acquisition device. In the VH lab, this means that our visual stimulus computer and 2-photon microscope send digital triggers that are acquired by our CED micro1401.
The triggers that are sent are all digital signals that are either 0 volts (low) or 5 volts (high). Each of these trigger signals travels on its own wire. Some of these trigger signals stand alone as a single channel, such as a signal that our visual stimulus computer sends to indicate when a stimulus comes on (its value goes from low to high). Our acquisition device detects this signal to know precisely when the stimulus occurred relative to the clock on the acquisition computer. Others trigger signals encode a number, such as the 8 trigger signals that encode the stimulus id number of the visual stimulus that is presented (from 0 to 255). We number these channels from 1 to 8, and they express an 8-bit number in binary with their 8 on/off values.
You might ask, why is it necessary for us to generate and receive triggers for each different event? Couldn't we send 1 pulse in common, define that pulse to indicate time 0, and let all of the devices run from that point? The reason we choose not to do this is that different devices have clocks that drift slightly differently. If our recordings were very short, just a few seconds in length, then these differences would not matter. But if our recording is several minutes in length, then our devices might be off by a few 10s or 100s of milliseconds at the end, which is unacceptable for physiology studies. It is possible to measure these different clock drift rates in control experiments, and to account for these differences, but we find that process more complicated than simply sending and receiving multiple triggers (and one doesn't have to worry whether or not one has adequately corrected these drifts for each experiment).
Sometimes, we build an interconnect box not only to synchronize many signals, but also to provide strain relief for a data acquisition device. For example, our anesthesia interconnect box allows us to plug BNC cables from our heart rate/EEG monitor into an acquisition device. The BNC cables plug into the outside of a box, and wires inside the box connect those BNC jacks to a USB data acquisition device. If we didn't have a box, we'd have to connect the EKG and EEG wires directly to the USB acquisition device's terminals, which would mean that any time we tugged or put strain on the cables, the cable attached to the terminal of the acquisition unit would get tugged, and would probably break at some point. So the interconnect box provides for a mechanically secure connection.
Said another way: if you don't have a sturdy box, it is likely that 1 channel of the 20 or so you use will slightly become disconnected unbeknownst to you, in the heat of an important experiment (the more important the experiment, the more likely they are to become disconnected...well, not really but you get the idea!). Do you really want to go fishing around to find out which is miswired? No. Better to put all of your connections inside a sturdy box that isolates the fragile cables and connections from the long-distance cables that plug into your devices.
For our typical Stimulus/2-photon rig interconnect box, we need to tell our main acquisition device when our visual stimulus computer shows stimuli and when the 2-photon is acquiring imaging frames.
1) Visual stimulus signals: 12 digital lines (that is, 12 bits)
We typically use Macs for our visual stimulus computers, and we connect a USB device, the USB-1208FS by Measurement Computing, to generate most of the trigger signals. The visual stimulus computer generates several trigger signals with the USB-1208FS (11 digital lines):
Additionally, we also tap into the video cable that goes to our monitor to acquire the vertical refresh trigger line (using this VGA to BNC cable splitter, joined in with a VGA cable splitter), so we know exactly when the video monitor is redrawing its screen. This can be helpful because the frame trigger, which indicates we have asked the monitor to display new information, is often slightly delayed relative to the actual video display. The vertical refresh trigger exactly indicates the time when the monitor is blank before drawing starts. This is the 12th digital line for the visual stimulus setup.
2) 2-photon acquisition signals: 2 digital lines (that is, 2 bits)
Most 2-photon acquisition computers can be configured to send a trigger whenever it acquires a frame. By listening to these signals we can determine exactly when each frame was started and correlate this information with other physiological signals or the visual stimulus computer. In our scheme, we have left a digital line open to indicate some value that might be useful in the future. In summary, we have
3) The CED micro1401 acquisition device
Our primary acquisition device is a CED micro1401. We connect our lines to the Digital Inputs 25 pin dsub connector on the back. The 25-pin configuration was commonly used for the parallel port on IBM PC and compatibles for many years, so the cables that one buys for this port are commonly referred to as "parallel port cables" (but note there is a 9 pin version so buy carefully).
The CED expects certain inputs to arrive on certain channels. As outlined in the micro1401 manual on page 22, the digital lines can be configured in a number of different ways. The digital input lines are 1, 3, 4, 5, 6, 7, 8, 14, 15, 16, 17, 18, 19, 20, and 21. These can be specified to represent individual high/low triggers. Alternatively, one can use pins 1,14,2,15,3,16,4, and 17 to encode an 8 bit number, or 5, 18, 6, 19, 7, 20, 8, and 21 to encode another 8-bit number. Finally, one can use pins 1,14,2,15,3,16,4, 17, 5, 18, 6, 19, 7, 20, 8, and 21 to encode a 16-bit number.
In our system, we use a combination of these settings. We use 5, 18, 6, 19, 7, 20, 8, and 21 to encode the stimulus id number. The micro1401 will only read this number when the "DAL" (which I think means "data available") line goes high, so we connect the stimulus trigger to line 23. This means, whenever the stimulus trigger goes high, the micro1401 will read and record the 8-bit stimulus id number.
Finally, we wire our single bit trigger channels to other pins. We chose to send the stimulus trigger to digital input 17, the frame trigger to digital input 4, the stimulus monitor vertical refresh to digital input 16, an expansion channel to pin 3, the 2-photon frame trigger to pin 15, and the 2-photon expansion signal to pin 2. (See complete wiring diagram below.)
There are 2 steps to complete in the Spike2 software. First, in Spike 2 Under the Edit menu, "Edit Preferences" , under "Sampling" (I think it's under "Sampling") make sure that the box "Event ports 0 and 1 on the rear connector" is checked. Second, in Spike2 under "Sampling configuration", add event channels for all of the current events: stimulus trigger, frame trigger, stimulus monitor vertical refresh, 2-photon frame trigger, etc, and the DigiMark. Make sure to link them to the appropriate pin number that is used on the Digital Inputs.
4) The intrinsic imaging camera
The intrinsic signal imaging camera needs to start acquiring about 0.5 seconds before the stimulus comes on the screen. Therefore, we connect the Pre-Stimulus BNC line of the interconnect box to the camera, and configure our stimuli in software so that they have 0.5 seconds of "pretime". The pre-stimulus trigger then serves as a fantastic trigger to initiate a picture grab sequence for the camera.
5) A multichannel NiDaq acquisition board
On 1 of our rigs, we use an inexpensive but powerful 64 channel data acquisition board from National Instruments to acquire multichannel input. We connect the stimulus trigger BNC to one of the input channels of the National Instruments board in order to synchronize the data that is acquired on this board.
6) Future hardware
The beauty of having an interconnect box is that it is very easy to attach additional devices. We can use BNC 'T' connectors to connect additional devices to the BNC pins on the front, and a parallel cable "splitter" to send all 14 bits to another device.
The overall connection diagram can be read here (see same link below).
For the stimulus interconnect box, you should use a Data Transfer Switch box that has 5 25-pin sub-D connectors in the back.
First, you will need to drill 10 D-shaped holes into the front of the box so you will be able to hook up up to 10 BNC cables. These holes can be arranged in two rows of five, and should be roughly two centimeters apart on the front of the box (to the right of the knob). Make sure your BNC cable heads will fit in these holes by trying to fit one of the BNC cables heads into a hole.
Here is a picture of the front of the box once the knob has been removed and
the 10 BNC cable heads have been put in the box through the machine shop.
Next, you will need to pry the knob off of the front of the box, and unscrew the fastenings underneath so you can remove the spool of wires inside the box. Unscrew the box and take out this blue spool.
We will be detaching all five of the 25-pin connectors from this spool, making sure to leave the wires attached to the 25-pin connectors. Using a hex wrench of the appropriate size, unscrew the two fastenings for all of the 25-pin connectors except for the one on the top left (or wherever you prefer). Remove a connector, get out those trusty wire cutters, and begin to cut the wires that lead to this connector at the spool. Repeat this process for the next four connectors. For the black ground cables connected to the sub-D 25 connector pin that are still attached, cut these wires in the middle so the wire will still be attached to the desired connector and can be used in the future as ground connections.
Next, following your pin list (Example for the Measurement Computing USB-1208FS device here: https://spreadsheets2.google.com/ccc?hl=en&key=ttDEHVuWAgM35d0NC_it2mQ&authkey=CJW59ZMH&hl=en#gid=0), the wires will be connected to the Measurement Computing USB-1208FS (or a similar device) by the 25-pin connector, or extra wire will be soldered to the indicated BNC cable head and then connected to the Measurement Computing USB-1208FS (or a similar device). Make sure to follow this list carefully, noting that sometimes more than one wire will be placed in a pin. (Gordon Smith made his own version of the pin wiring diagram, available here. It has the same info but with a slightly different layout/description.)
Finally, you can place the Measurement Computing USB-1208FS (or a similar device) back into the box and attach the cable that will connect to the computer through one of the openings left by one of the 4 25-pin connectors that have been removed (we found that the top right space was the easiest).
The image on the left shows the Measurement Computing USB-1208FS after The image on the right shows that the pin numbers are located on the
it is connected to wires from the 10 BNC heads and the Dsub 25-pin connector. bottom side of the Measurement Computing USB-1208FS device.
Here, both a DB25 cable (bottom left) and the Measurement Computing USB-1208FS cable (top right)
are connected to the Stimulus Interconnect box. The Measurement Computing USB-1208FS cable
fits into the device through the space where the 25-pin connector once was.
Making sure that the device is connected (which you can test by inserting the cable into the computer and seeing if the device blinks green), screw the lid back onto your box. You can use the 25-pin connector to hook up a DB25 cable from the computer to this device. Now you should have a stimulus interconnect box ready for use!
The 2-photon trigger line is taken from the PCI-611X-PFIO on the Prairie Technologies GPIO box (general purpose input/output).
Front of Data Transfer Switch Box Back of Data Transfer Switch Box
Then, you will need to remove the knob and the fastenings on the front of the box. You should unscrew the box and take out the spool that is connected to the wires. Since this box will contain your Measurement Computing USB-1208FS (or a similar device), it is important to go get that device and make sure it fits in the box.
If it does fit, get a wire clipper and remove the wires from the spool, making sure that they are still connected to the BNC cables. Each ground cable (the wires that run from BNC head to BNC head) should also be cut, making sure that one ground cable is connected to each BNC head. At the end of this, you should have a total of six wires, with two wires at each BNC head. Remove the spool from the box, and note that this spool, the knob, and the fastenings will not be placed back in or on the box.
The spool found in the Data Transfer Switch Box. The red wires were clipped from the spool and connected to the BNC cables.
It is also important for the cable that connects your device to a computer (or another machine) is able to fit through a hole out of the box. We will use the hole where the knob was in the front of the box to create this area. Keep cutting away this area until your cable can comfortably fit through the space. Make sure the ends of the cables will also be able to fit since you will be feeding them through this hole. Since the area will not be rough and sharp, you need to sand down the area so it is not a safety hazard. You can use a Dremel drill to smooth out the edges on this new hole.
Lastly, take your Measurement Computing USB-1208FS (or a similar device) and connect the wires inside the box to the appropriate pins. For example, with this device, the wire from 'Ch0 - EKG' should be placed in Pin-1, while its ground wire should be placed in Pin-2. Next, 'Ch1-EEG' will have its wire in Pin-4, while the ground wire will be in Pin-5. Finally, 'CH2''s wire can be placed in Pin-7 and its ground wire can be placed in Pin-8. After making sure that all of these wires are secure using an appropriate screwdriver, you can screw the lid back on the box and begin to test your anesthesia interconnect box.
The wires will be connected to the pins in the
Measurement Computing USB-1208FS using a
tiny screw driver to tighten and loosen each pin area.
Note that these are not the connections described above
This photo illustrates that the pin numbers are on the
bottom of the Measurement Computing USB-1208FS