| Reference | Downloads | Github

Triggering a Daq Box

I have a DAQ box connected to a MEG and am trying to trigger it using PsychoPy. Using the Coder, not the Builder. I’ve successfully used the parallel port before but never the DAQ box. Does anyone have any tips or sample code they could help me out with? Any help would be greatly appreciated.

Thanks for any help,

Hi Dave, “DAQ box” is a very broad term. To get any helpful response, you will have to be more specific. What kind of DAQ device are you talking about, and what exactly do you want to do with it?

The model of DAQ box is: Measurement computing USB1208FS. We are trying to send triggers using our psychopy code to mark our MEG recording whenever an event occurs such as stimulus presentation, button presses, etc. Please let me know if any additional information would be helpful?

Thanks for any help,

Hi David,

so that is this board which also goes by the name of USB PMD-1208FS.

To get this device running, you must first install the appropriate hardware drivers (InstaCal), which you can download from the manufacturer.

After that, download and install UniversalLibrary, which will allow custom code to access the device.

To get the Python side working, you will then have to download PyUniversalLibrary – a Python wrapper for UniversalLibrary. Click on the “Clone or download” link, download the ZIP file, and add the contained package to your PsychoPy installation.

You should then be ready to use the DAQ board.

Here is an example based on code from PyUniversalLibrary:

import UniversalLibrary as UL

board = 0
direction = UL.DIGITALOUT

UL.cbDConfigPort(board, port, direction)

data = 1
UL.cbDOut(board, port, data)

This should set the first line of the first port to 1, and all other lines on that port to zero.

NB: Everything mentioned here is untested by me, I don’t have such a device, and only used Google and documentation to put this advice together.

@jon, if this turns out to be working, maybe we could include PyUniversalLibrary in future standalone releases?

I’m taking a new policy with additional libs like this that I’m only going to be willing to package things that can be installed with pip. The idea is that when my development machine has to get rebuilt I need to be able to recreate it with a simple install script and I’m not willing to go searching websites to download zip packages.

I’ll send Andrew Straw an email (and cc you) to see if he’ll add a pypi package for this

1 Like

Sounds very reasonable, thanks for your effort!

This worked! Thanks for all the help. A tip to anyone with this problem in the future, run Instacal (the hardware driver) after you install it. That will generate the configuration file needed when sending the triggers.
Thanks again.

1 Like

Hi all,

Has anyone tried this using a Mac computer? The drivers for this specific piece of hardware are Windows only. Has anyone tried and had success with this? Any help would be greatly appreciated.

Thank you all,