How do I Send Event Markers to BIOPAC via Serial Port?

Hi All,

I’m currently switching from using SuperLab to Psychopy and am having some problems in regards to sending event markers to BIOPAC (MP150). Essentially, I want to send an event marker right before the start of a video. On SuperLab, I could do so by creating an event “Digital Output” which I could see as a raised line on one of the digital channels on AcqKnowledge.

Is there a way to do this on Psychopy? As per the API, I tried to implement pyserial:

import serial
ser = serial.Serial (‘COM1’)
ser.write(?)
ser.close()

But I am not sure what to actually “write” in order to get that raised line on AcqKnowledge (nor am I sure I am doing any of this correctly…) If anyone has any insight on this, that would be greatly appreciated!

Edit: I am using Psychopy 1.84 on a Windows 7

Hello Mike,

Is there any documentation supplied with the MP150? What data were you sending in SuperLab to the MP150?

Hi mdc,

I am not sure what type of data SuperLab was sending - I took a screenshot of the UI in case that might give away clues:

I am relatively new to the lab, so I am not sure where the manual is for the MP150; however, I assume the one online (http://www.biopac.com/wp-content/uploads/mp_hardware_guide.pdf) is the same. Page 9 in particular seemed relevant, but I don’t have any experience in hardware to really make heads or tails of it.

Hello Mike,

Okay I have a good idea what’s going on now. It seems you have a PCI-DIO24 card in your PC which is used for general purpose digital I/O. SuperLab might be triggering a pin on that card which your AcqKnowledge reads. Can you confirm you have the PCI-DIO24 card installed in your PC? It should have a D-shaped 37 pin connector located at the back of your PC.

Hi mdc,

Sorry for the wait. Attached is an image of the card:

I’m not sure if it is in a “D” enough shape, but there’s certainly 37 pins on it.

Is there anyway I can use python to communicate to it?

best,
Mike

Yes that would be it. You’ll need to communicate to the device through a driver interface/library that shipped with the device. I don’t think Python’s serial library will do it, but there might be some tutorial/code sample somewhere on the net to show you how. Unfortunately, I don’t have that model board here so I can’t work out a solution (maybe someone else seeing this knows how?)

Here are some options that will work right now:

  • If your PC has a printer port (parallel port) you can use that instead and get the same results. Printer port PCI cards are still available and very inexpensive.

  • Use a micro-controller board (like the Arduino) to communicate over serial/USB and program it to send digital pulses when it gets commands. There is a bit of latency in this option that might be significant.

  • Use the DTR/RTS pins of a DB-9 serial adapter to produce digital signal pulses (make sure you check these are 5V on your adapter before plugging anything into them!)

3 Likes

Thanks mdc!

I actually found a printer port cable this morning (I originally thought we didn’t have any, although one of the computers has the card for it) - so I’ll be giving that a try!

1 Like

I am setting up a biopac mp 36R system that will do event marking on skin conductance changes. We are using e-prime at the moment. My understanding is that you have to use the parallel port with the 36R in this type of task because the biopac is paying attention to the signal levels on individual pins.

I don’t know if the mp 150 is different but I tried to find a serial->parallel converter that would work without luck.

Ken

Hello KenS,

USB-to-parallel port converters require special drivers to function correctly, not sure if the OS picks them up as a true parallel port. There are high-speed USB serial-to-parallel converters like the FTDI UM245R that you can use with the pyusb package as a substitute.

Hi, Mike,
I am very interested in your solution by using a printer port cable.
Because our lab also using printer port with other software (presentation/matlab) when sending triggers to M150 system.
Recently, I am trying to switch to PsychoPsy, so I am wondering how you solve the problem.
Many thanks.

If that is PCI-DIO24 board then check the Measurement Computing website for drivers. It might be supported by their Python drivers, but if it is supported on your OS at all then you could use Python and ctypes.

EDIT: I just noticed this thread is over a year old. Was a solution found?

- Allen

In the write function, you should write the value ‘1’ so that acqknowledge will show a peak.

code:
ser.write(‘1’)