Serial port communication between MWorks and new laser unit

Hi Chris -

We recently received a new laser unit from the National Primate Research Center at UWashington, and MWORKS seems to be complaining about connecting to it via serial port.

Attaching the console error we get (Error_Laser.txt) - as well as the mwel that configures the laser (config_Laser.mwel). The mwel is based on the plugin you kindly wrote for us and includes the following:

iodevice/qcualor laser (
    serial_port = '/dev/cu.usbserial-AR0JVL1T'  //check the correct portal
    mode_1 = 'off'
    mode_2 = mode_2
    mode_3 = 'off'
    mode_4 = 'off'
    modulation_frequency = modulation_frequency
    max_gain = 1
    // select the gain to TURN ON a specific laser channel
    gain_1 = 0
    gain_2 = amplitude
    gain_3 = 0
    gain_4 = 0

However, Im not sure how to check for the correct portal. Could you help us with that?

This code works beautifully on our first rig, with our older laser and Mac - but not with this newer laser and Mac.


Many thanks,
Yasmine (CCing Taylor our new technician to keep her in the loop!)

Error_Laser.txt (959 Bytes)

config_Laser.mwel (4.12 KB)

Hi Yasmine & Taylor,

The quickest way to find the correct serial port is to open Terminal (on the machine running MWServer) and run the following command:

ls /dev/cu.usb*

There will probably be just one match, and that’s the port you want.

If that doesn’t work (e.g. if ls reports “no matches found” or something similar), an alternative approach is to comment out the line with the serial_port parameter, e.g.

iodevice/qcualor laser (
    //serial_port = '/dev/cu.usbserial-AR0JVL1T'  //check the correct portal

and then try loading the experiment. One of two things should happen:

  1. If there’s only one serial device present, MWorks will assume it’s the laser and try connecting to it.
  2. If there are multiple serial devices present, the experiment will fail to load, with an error message listing the ports of the discovered devices. You can then try each of these in turn, until you find the correct one.


Hi Chris,

Thank you for your help! We commented out the line and it worked. The console gave error when we did that but it also told us the serial port of the laser on this rig.

There seems to be some communication issue with the laser. We are still troubleshooting and will get back to you!