Integrating Blackrock CereStim R96 with MWorks via network

Hi Chris,

I am looking to setup a Blackrock CereStim R96-based electrical microstimulation paradigm. I already have a Master-9/Iso-flex microstimulation setup that I use by sending TTL pulses via an Arduino from MWorks, but I am looking to switch as I need automated trial-by-trial control of amplitude & pulse width, which only CereStim allows. One challenge is that the CereStim API (StimMEX/C++ SDK) only runs on Windows, MWorks can’t talk to it directly.

I was thinking of a two-part solution like the following:

  1. Before each trial at setup, send the desired amplitude/duration parameters (in json/csv form) from MWorks → Windows via network to a “stim server” before each trial, and let Windows use CereStim API to load or update the waveform to Cerestim and put it in trigger mode.
  2. At microstimulation time, MWorks outputs a separate hardware TTL via an Arduino to the CereStim’s trigger BNC which will administer the pulse.
    I think this way, I can update the parameters more slowly and still have <5ms low latency from MWorks to stimulation pulse.

I have a few questions regarding this:

  1. Does the plan look reasonable to you? Is there an option that bypasses Windows altogether, or by any chance does a direct MWorks interface with Cerestim already exist?
  2. How would I set up a network server to send something like a json/csv parameter from MWorks to Windows/Cerestim API? Is there an I/O device API for this kind of usage?

Thank you for your guidance!

Best,
Hokyung

Hi Hokyung,

Does the plan look reasonable to you?

Yes, it sounds good. I know other labs that have used similar setups to control Windows-only hardware.

Is there an option that bypasses Windows altogether, or by any chance does a direct MWorks interface with Cerestim already exist?

If the Cerestim had a built-in, network-based interface, it would be possible to bypass Windows. But if the only option is a Windows-only MATLAB/C++ API, then there’s no avoiding using an intermediate process running on Windows, as you’ve suggested.

No, there is no existing MWorks interface.

How would I set up a network server to send something like a json/csv parameter from MWorks to Windows/Cerestim API? Is there an I/O device API for this kind of usage?

I would use Python on both ends. On the Windows machine, you would have a Python script running, say, an HTTPServer instance, which would receive the JSON/CSV and send the appropriate commands to the Cerestim. In your experiment, you would use Python actions to send HTTP POST requests containing the JSON/CSV.

The script running on Windows would use the Cerestim MATLAB API to communicate with the hardware. This should be possible using the MATLAB Engine API for Python.

Cheers,
Chris