Recording and Stimulation
DataView can currently record through 3 device sources:
- The on-board computer microphone input.
- The Arduino Uno type of microcontroller board.
- DataTranslation AD-DA boards using the OpenLayers programming interface. This offers the most sophisticated facilities. The exact details depend on the hardware, but many DT boards provide stimulation capability.
Data acquired through DataView are stored in files with the extension dtvw-rec (legacy dtx files can still be read).
Common Interface Features
Each recording device shares several common interface features. There is a main view in which recorded data are displayed, a toolbar above the view which controls starting and stopping the recording, and a tabbed property page dialog box on the left that sets recording (and sometimes stimulating) parameters.
We will use the microphone facility to illustrate basic recording features. If your computer has a built-in microphone you can use it immediately. If not, you will either have to connect an external microphone (or at least put a jack into the microphone socket), or just follow the instructions in your imagination.
Microphone Input
The microphone input on a computer provides 1- or 2-channel AC-coupled recording at ADC rates up to 44 kHz. This can be used with an extracellular amplifier (e.g. Backyard Brains) to record neural signals, or with an actual microphone or any other equivalent voltage source. The input amplification level is controlled by the computer itself and is usually not quantified.
- Select the File: Record/Stimulate: Microphone input menu command.
The following dialog should open:
Recording
Recording is started by clicking the Start toolbar button. Data are stored in a temporary disk file which allows them to be reviewed, but for permanent storage the user must click the Save button. The temporary file is deleted after each recording session.
The recording mode can be either single-sweep, refresh or scroll.
Single sweep: A single screen of data are acquired. The user sets the recording duration by editing the right-hand time-base (X-axis) scale in the display, or equivalently, the time-per-division scale.
Refresh: Sweeps of data are acquired repetitively and the display is cleared between each sweep. Recording continues until the user clicks the Stop toolbar button, or the user-set Time limit is reached. Recording progress is indicated in the read-only Time done box.
Scroll: The data scroll in continuously from the right-hand side of the screen. Again, recording continues until the user clicks the Stop toolbar button, or the user-set Time limit is reached.
The Time limit is to ensure that the temporary file generated during recording cannot inadvertently occupy too much of the available disk space (for instance if you leave the recording running over a weekend). You can set the limit to a large value if you know that you want to record for several hours.
Trace Gain and Position, and Display Time-base
You can change the trace gain and position while recording using the standard toolbar buttons attached to the main frame window, just like with any other DataView display. In refresh and scroll modes you can also change the time-base of the display by clicking the compress or expand main toolbar buttons.
Pause Display
You can review data that has already been recorded while continuing to record new data in the background, by checking the Pause box. You can then use the navigation toolbar buttons to move back and forth through recorded data. To resume updating the display with new data, uncheck the box. Note that any changes to the time-base made while reviewing data will be reset back to the original recording value when the update resumes.
Multi-Threading
Recording and disk storage take place in a separate background thread relative to display and analysis, so even lengthy display operations in Pause mode should not cause dropped data.
Markers
While recording you can press any letter or number on the keyboard and that character will be entered as a marker into the recording. The markers will not be visible until you Stop or Pause the recording.
Note that if you click Pause, you will have to click somewhere in the display area afterwards to reset the focus to the main window if you want to add further markers (or else your computer will just go ping! when you press a key).
Monitor
Monitor is similar to Start, except that data are not stored in a temporary file, and cannot be saved. The monitor mode is for setting up and checking recording parameters, or for a long-term demonstration (such as a laboratory class) where data are not intended for saving.
Try-out
Read through the following instructions before you start, so that you know what you are going to be doing.
- Click Start in the acquisition toolbar. Observe that data scrolls in from the right-hand side of the screen.
- Speak into the microphone, and as you do so, press the ‘v’ key on the keyboard. You should see the waveform distort in response to the input, although you may have to increase the gain to see this properly.
- Wait until the input scrolls off the screen, and then check the Pause box on the acquisition toolbar.
- Click the Show All main toolbar button, and you will see your voice recording and the ‘v’ marker.
- Make another noise, but note that since the display is Paused, you do not see the new data.
- Click the Show All toobar button again. Observe that the trace expands to show your new noise. Thus recording was continuing in the background while you observed the previously recorded waveform. This is because you clicked Pause rather than Stop.
- Click Pause again to uncheck the box, and note that scrolling new data continues at the original timebase setting.
- Click Stop on the acquisition toolbar and then click the Show All main toolbar button. The display now shows the whole recording.
- Click Play. Whatever noise you made during the recording plays back through the computer sound system, if you have one enabled.
- Use the horizontal magnifier toolbar button to expand just the region of data containing the voice input and marker.
- Click the drop-down arrow on the Save button on the acquisition toolbar, and click Save Visible on the menu. Enter a filename when requested, and note that a new file loads showing just the voice region of data. By repeating this you can save multiple regions from within the same original recording. If you click Save All on the menu, the entire recording is saved and the screen is then cleared.
- You probably want to delete any files that you save.
Triggered Scope
The main recording view is rather like a traditional chart recorder, especially when it operates in Scroll mode. You can simultaneously display a fast time-base Scope view.
- Check the Show triggered Scope box to open the Scope (real-time) dialog, and move it so that it does not obscure the main view.
- Click the Monitor button so that data will be displayed but not recorded.
- Make a series of sharp noises by clicking your fingers or tapping the table.
When the Scope first displays it operates in auto trigger mode, which means as soon as one sweep finishes the next starts. This mode allows you to observe the data as it is acquired.
- Drag the red threshold cursor upwards in the Scope so that the waveform just crosses it when you make the noise.
- Select the data threshold source option in the Scope.
A Scope sweep is now only triggered when the data in the selected trace crosses threshold in the selected direction. This is a good way of observing the waveform of individual spikes. By default the trigger point is set mid-way through the sweep, so that an equal length of pre- and post-trigger data are displayed. However the trigger point can be shifted with the < or > buttons, and the sweep duration can be compressed or expanded with the >< and <> buttons.
- Check the Store box to superimpose the sweeps in the Scope display, rather than clearing before each new sweep acquisition.
- Close the Scope dialog, and Stop the monitor acquisition (although since nothing is written to disk in this mode it would do no harm to leave it running).
Saving data
Data are initially stored in a temporary file so that they can be reviewed, but unless they are explicitly saved they will be lost when the next recording starts or the program exits. Click the Save button to save the data. The drop-down arrow on the button exposes a menu with two options: Save visible and Save all. Save visible just saves the data displayed in the screen (which of course can be adjusted with the navigation buttons). This means that a very long recording can be made, and then selected regions of interest within this recording can be saved to separate, short, files. The Save all option saves the entire recording and deletes the temporary file.
Data recorded through the microphone input can be saved in one of two file formats by selecting from the Save as type drop-down list in the Save dialog box. The dtvw-rec format is the native format for DataView recordings. Alternatively, data can be saved in the Microsoft wav format. In the latter case a header file with dtvw-hdr extension is also saved to contain DataView-specific information such as the marker.
Quality
The Quality tab enables you to set the AD sample rate to one of the standard audio options. The default 22.05 kHz is usually suitable for most extracellular recordings. The data can be acquired with either 8-bit or 16-bit resolution, but the default 16-bit is normally the best choice. The recording can be either mono (1 channel) or stereo (2 channels), although the stereo option may not be functional on some computers, depending on the microphone input type.
Arduino
The very inexpensive Arduino Uno provides 0-5 V DC-coupled recording of up to 4 channelsThe board itself has 6 channels, but the DataView software is limited to 4., with 10-bit (1024 voltage bins) resolution. The maximum ADC rate supported by DataView is 5 kHz for single channel recording, multiplexed for multichannels.
Setup
If you have a new Arduino-type microcontroller and have not previously used one with DataView, follow these steps to get started:
- Download, install, and open the standard Arduino IDE (integrated development environment).
- Install all the drivers it offers.
- Connect the Arduino board to your computer and wait while Windows configures the driver.
- Run one of the standard example sketches supplied with the IDE to make sure that everything is working.
- Install the Arduino TimerOne library:
- Activate the Sketch: Include Library: Manage library menu command in the IDE
- Scroll down to find TimerOne in the listing (Jesse Tane is the primary author, I think)
- Click on this and follow the instructions to install it. There is more information on installing libraries here.
- Open the file dv_ard.ino and loadYou can download it from your browser as a file and load it into the IDE, or copy-and-paste it directly. it into the Arduino IDE.
The sketch code is also given here in case your browser objects to opening an ino file from the internet. - Verify that the sketch compiles.
- Check that the IDE has the correct port setting for your board.
- Upload the sketch to the board.
Once a sketch has been uploaded to a board, it will persist even if the board is unplugged. However, if you reset the board (or upload a different sketch), you will have to re-upload the dv_ard sketch.
Once the dv_ard sketch is installed on the Arduino board, that board can interact with any computer running DataView. You do not have to install the Arduino IDE and library on every computer that uses the Arduino-DataView combination. Since the Arduino board is very inexpensive this makes the Arduino-DataView combination a good choice for classroom use if you need a cheap DC digital chart-recorder.
If you want to install dv_ard on multiple Arduino boards (e.g. for a class practical) and you try to upload the sketch to each board in turn from single computer, you may find that Windows advances the com port ID number with each board, which means that the number can get large. This is because each time Windows sees a new device with a serial port (or each time one without a unique id is unplugged/replugged), it permanently allocates a serial port number. At the moment DataView cannot access Com ports with ID higher than 9. You can remove the unused Com port IDs by following the instructions given here, or using the steps below:
- Right-click “Command Prompt” in Windows, Accessories on the Start menu, and choose “Run as Administrator”.
- Enter “set devmgr_show_nonpresent_devices=1″at the prompt – without the quotes, obviously.
- Enter “start devmgmt.msc”.
- In the dialog box that opens, select “Show hidden devices” in the ‘View’ menu.
- Now if you expand the section on COM ports, all the COM ports that have ever been created will be displayed, the non present ones being in grey. You can
uninstall anything that you don’t want (right click, select uninstall). - Note: uninstall, but do not delete the driver
Recording and Saving
- Activate the Arduino recording interface through the File: Record/stimulate: Arduino menu command.
- You have to confirm the COM port the Arduino is plugged into; if you are unsure, you should be able to find it using the standard Windows Device Manager, and looking at the listing under Ports (COM & LTP).
See the Common Interface Features for further details of recording and saving.
DataTranslation (DT) Boards
DataView supports Measurement Computing (formerly DataTranslation) ADC-DAC boards through the Open Layers programming interface. The exact facilities available depend on the hardware capabilities of the board, but the more expensive boards have high specifications and are fully suitable for research use.
Note: I have used DataView with the DT9818 and 9812 boards. According to MC, the OpenLayers protocol allows software to control any of the DT boards. However, before purchasing an expensive board other than one of the two listed above, I would recommend that you ask MC for a test trial to confirm that it does indeed work as you expect.
The following general specifications apply to the DataView interface.
Input: Data can be acquired on up to 16 channels, with all channels acquiring at the same ADC rate. Acquisition can be triggered either manually, or in response to an external TTL electronic pulse, or at timed intervals.
Episodes: A single DataView acquisition file contains one or more episodes of recording, with each episode having a user-determined duration, and with each episode starting when trigger conditions are met. If the file contains more than one episode, then the start time of each episode is marked by an event in channel a.
Output: Stimuli can be output through up to 16 channels, each at the same DAC rate, which can be independent of the ADC rate. Output can take the form of an arbitrary number of pulses with optional on- and off-ramps, or an arbitrary waveform held in a native DataView dtvw-dat format file. Output is initiated at the same time and in response to the same trigger as input.
Simultaneous Recording and Stimulating
Many DT boards claim “simultaneous start” capability for input and output systems, but this is software-implemented and is only accurate to within a few clock cycles (at least, this is the case for the DT9818 board that I used). For many electrophysiological applications this is not adequate; the stimulus needs to be very precisely timed relative to data acquisition. This can be achieved by using a single “external” digital trigger to activate both ADC and DAC systems. This usually does not require a separate piece of electronic hardware since many DT boards (like the DT9818) provide a digital i/o facility which can be used to generate this trigger.
DataView has a “use d/o + ext trigger” checkbox option which becomes available for boards that provide digital i/o. To use this you should make a hard-wired connection between the first digital output (bit 0) and the external trigger inputs for both the ADC and DAC systems. DataView then configures these for external triggering, and starts each acquisition/stimulus cycle by outputting a pulse from bit 0 of the digital i/o channel. This pulse triggers the start of analogue input and output virtually synchronously. In actuality, the AD system seems to start one clock cycle before the DA system, so you may acquire one data sample before the DA output starts.
First Use
Software drivers and the board should be installed/connected as per the manufacturer’s instructions prior to first use, and the digital i/o, if used, should be wired as above. After installation, the recording and stimulating facilities become available through the File: Record/stimulate: DT board menu command.
General Purpose
The general purpose interface, as its name suggests, provides a wide range of a facilities for general recording and stimulating.
The figure above shows a recording made with a DT9812 board, which is one of the less expensive ADC-DAC boards available. Single sweep was selected as the acquistion mode, with a sweep duration of 40 ms. All other control parameters were left at their default values. I simply started the system, put my finger on the input terminal of the first data channel to generate some mains interference (50 Hz, being the UK), and then clicked the Start button. The recorded data are displayed in the main view to the right, while recording and stimulating parameters are controlled through the dockable tabbed Control page to the left. Input, output and save options are controlled using buttons in the toolbar above the main view.
See the Common Interface Features for details of recording and saving data.
I will now describe the controls available on the various tabbed pages, and this will give more details about what can be done with DataView.
Input Options
Recording parameters are set using the Acquisition, Input and Trigger tabs on the control page.
Acquisition tab
Acquisition duration – Sweep mode
Single sweep: The episode duration is set in milliseconds by the right-hand timebase scale of the acquisition view, and for each trigger a single sweep of data is acquired.
Continuous: In Refresh or Scroll mode the episode duration is set in seconds by the Time limit edit box. In Refresh mode each sweep replaces the previous one, while in Scroll mode the data scroll to the left as soon as a complete sweep is achieved.
In Refresh or Scoll modes, the display update can be Paused during acquisition. Data continue to be recorded to disk in the background, but the screen does not update. This allows the user to scroll through the view to examine data recorded earlier in the same episode. This can be useful if making a very long recording. When the Pause option is de-selected, the display update resumes.
Save options
If the Auto-load box is checked, then as soon as data are saved they are re-loaded into the main view. If it is not checked, then you have to load files explicitly if you want to display them.
Manual save, no append: Each episode of data acquisition has to be saved explicitly by clicking the Save button.
Manual save + append: You save the first episode that you want to keep by clicking the Save button. Subsequent episodes can be appended to the same file if desired by clicking the Append button (which appears in the toolbar after the first save), or discarded by acquiring another episode. The file is finalized by clicking the Done button, which appears in the toolbar when this acquisition mode is selected. After this the file is available for analysis and no further episodes can be appended.
Auto save + append: In this mode you specify a pre-set filename before you start acquisition. Each episode is then automatically appended to this file without further intervention. This is particularly useful in Timer repeat mode (see below), in which a series of episodes can be acquired at fixed intervals, while you go off for lunch. However, you sacrifice the ability to discard episodes containing unwanted data in this mode.
In the Append modes the new file is automatically loaded and displayed immediately after saving the first episode. The data can be examined using the usual facilities. Subsequent episodes are appended to the end of this file. If the Show latest episode option is checked, then the view automatically updates to bring this on screen. If you do not want this (if you are reviewing earlier episodes, for instance), then uncheck the box. The file remains available for appending as long as it is open until the Done button is clicked.
Auto save, no append: This mode is similar to Auto save + append, except that each episode is written to a separate file, rather than appended onto a single file. Again, you select a starting filename, and then this name is automatically incremented after each episode.
Input tab
Check the On box for channels on which you wish to acquire data. Optionally, choose a channel Gain from the drop-down list.
Select the recording mode as Single ended or Differential.
Set the desired acquisition frequency (ADC sample rate) in the edit box at the bottom of the tab. You may not acquire at exactly the frequency you specify, depending on the board capability, but this value will update to the actual acquisition frequency used after the first cycle of acquisition.
The availability of options depends on the capability of the board in use.
Trigger tab
Manual single-shot: With this trigger option selected, you start each episode of acquisition by clicking the Start button. A single episode of data is acquired, and then the system stops.
Timer repeat: In this mode you set the Count of the number of episodes that you want to acquire, and you set the Interval between the start of each acquisition. The first episode is acquired as soon as you click Start, and subsequent episodes are acquired at the set interval.
External trigger: With this option selected, you arm the system by clicking Start, but actual acquisition does not start until the external trigger condition is met.
Output Options
DataView can output up to 16 channels depending on your hardware. The output can be either in the form of arbitrary waveforms stored in standard DataView dtvw-dat files, or pulses with optional on- and off- ramps and a DC level. A sequence-controller can change any combination of pulse parameters through a sequence of steps, advancing one step through the sequence with each acquisition. The parameters are controlled from the Output tab.
Synchronizing input and output
To get the most accurate synchronization of input and output, check the Use d/o + ext trig box in the Trigger tab and wire bit 0 of the digital output to the external triggers of both the AD and DA subsystems as described in the section Simultaneous Recording and Stimulating above.
Steady-State Output
DataTranslation boards should default to 0 output on start-up. After outputting a series of data values, the DA channels should “stick” at the last value output from that channel.
NOTE: at the moment when outputting from multiple DA channels, they all seem to stick at the last value output from the highest channel ID, rather than at the last value output from each channel individually. This is not a problem if you define each output channel to have the same final output, but it may be a problem if you wish the channels to finish with different DC outputs. This seems to be a bug in the DT driver software, and hopefully it will be corrected by the manufacturer at some time in the future.
Output tab
- Select the Number of channels to use (up to the available hardware limit).
You need to specify at least 1 output channel if you want to output anything!
- Set the Frequency of the digital-to-analogue converter in kilohertz.
- Select the Type of output you want
Simple pulse
This outputs a train of one or more identical square-wave pulses, superimposed on a DC offset if desired.
To prepare for pulse output do the following.
- Set the time units to milliseconds or seconds. Changes to this selection will apply to both existing and new pulses.
- Set the Edit channel to the channel from which you wish to output. If you have more than one channel enabled, the output is specified separately for each channel.
- Set the Preview duration to a suitable value. This is optional, but the pulse preview monitor shows a graphical representation of the pulse pattern in the selected Edit channel.
To specify the output
- Set the DC value.
- Set the Count of pulses. A count of 0 will just output the specified DC value.
- Set the Delay to the first pulse.
- Set the Amplitude and Duration of the pulses. They are all identical.
- Set the Interval between pulses.
Advanced pulse
This outputs a train of one or more pulses, superimposed on a DC offset if desired. The pulses can be configured individually.
To prepare for pulse output do the following.
- Set the time units to milliseconds or seconds. Changes to this selection will apply to both existing and new pulses.
- Set the Edit channel to the channel from which you wish to output. If you have more than one channel enabled, the output is specified separately for each channel.
- Set the Preview duration to a suitable value. This is optional, but the pulse preview monitor shows a graphical representation of the pulse pattern in the selected Edit channel.
To add a new pulse, carry out the following steps.
- Ensure that the Edit pulse value is 0 (otherwise you will edit an existing pulse, rather than adding a new pulse).
- Set the values of the Delay, Ramp on duration, Peak (plateau) duration, Ramp off duration and Amplitude.
- Click the Add button
Repeat until you have set up as many pulses as you wish. Note that pulses which overlap in time will add together, and that pulses add on to any DC level that you set.
Pulses are assigned ID numbers in the sequence in which they are added (not the sequence in which they are output).
To edit an existing pulse, carry out the following steps.
- Set the Edit channel to the channel containing the pulse you wish to edit. The pulse preview monitor adjusts to display the pulses in that channel.
- Select the pulse that you wish to edit. To do this, either click the pulse in the preview monitor, or explicitly set the pulse ID number in the Edit pulse. Remember that pulse ID numbers are set in the sequence in which the pulses were added.
- Note that a marker appears above the preview display to indicate the start of the selected pulse.
- The parameters of the selected pulse appear in the appropriate edit controls.
- To delete the selected pulse, click the Del button.
- To change the parameters of the selected pulse, edit the appropriate value. Parameter changes take effect as soon as you tab away from the edit control, and are reflected in the pulse preview monitor.
Sequence control
You can set up a sequence control so that every time you acquire an episode of data, specific pulse parameters are stepped by a specified values. Note that you need to uncheck the Pause box to enable the sequence to advance. The current Sequence count is shown at the right hand end of the View toolbar.
To set up a sequence, first use the Edit channel and Edit pulse controls to select the pulse whose parameters you want to step. You can step parameters on multiple pulses simultaneously, but you have to set them up one at a time. Now click the Sequence button to display the Pulse sequence dialog box, and do the following.
- Set a non-zero (positive or negative) value into any combination of the Delta controls to step the specified parameter by that value after each acquisition episode.
- Set the Sequence count value to specify how many steps to take for each sequence cycle of acquisition episodes.
- Choose one of the options in the At sequence end group to determine what happens when the Sequence count is reached. Stick causes the parameters to stick at their final values. Recycle from start causes the parameters to return to their initial values, and then the sequence starts again. This repeats indefinitely. Reverse and stick causes the sign of the delta values to invert, and the parameters to step back to their initial values and then stick. Reverse and recycle is the same as the previous option, except that the cycles repeat indefinitely. Reset and stick causes the parameters to return to their initial values directly (without stepping) and stick.
You can pause the sequence by checking the Pause box on the Output tab. This prevents the Sequence count from advancing and causes the pulse parameters to stick at their current values. Note that this box is checked by default; to allow the sequence to advance you need to uncheck the box.
You can reset the sequence so that parameters return to their starting values by clicking the Reset button.
Waveform
If you have a previously-recorded or constructed data file containing one or more waveforms, you can output this through the hardware DAC. Each trace in the source file is output through a separate DAC channel, up to the available hardware limit. The output frequency will be set to the nearest allowed value to the source file sample rate, although it can be adjusted manually if desired.
Note that the source data has to be held in memory for output, so if you try to output a very long source file, you may run out of memory.
- To load a source file for output, first load and display it in the normal manner.
- Then click the File def button on the output tab. You will be presented with a list of loaded files from which you select the one that you wish to use as the output source.
- If desired, check the Only use visible data box. This will limit the output to the part of the file visible in the main display view.
Configurations
If you have an acquisition system running, the File: Save config menu command allows you to save a complete set of recording and stimulation parameters to a file, while the File: Load config menu command restores recording and stimulating parameters to a previously-saved set of values. Configuration files are specific for the recording device – microphone, Arduino or DataTranslation board. In the latter case it is obviously important not to load a configuration file into a system using a DT board with less capable hardware than that which was present when the configuration file was saved.
If you do not currently have an acquisition system running, the File: Record/Stimulate: Load from config menu command activates the recording interface for the appropriate device directly.