COM port lost


As I am progressing in my motion control arm (thanks to your help, guys), I keep encountering a very annoying issue with the virtual COM port.

I’ve got some python scripts going from within C4D (Cinema 4D, 3D animation software), reading values from POTs and/or controlling LEDs and servos. All works fine and as expected but every once in a while, I’ll lose the communication with the COM port, and a “Serial Exception” error is thrown in the console, stating it could not open the port (in my case, COM10).

It will happen randomly, most likely when I change something in the script which probably makes it send a bad command, or when I don’t send any command for too long without closing the port. Everytime, the only solution I found was to go into device manager, disable the port, change it’s number, re-enable it, and then I can access it again.

Is there a more straightforward way to re-establish communication? What happens exactly, the mini maestro shuts down its serial port when it’s not happy?
Whenever that happens, I can still see and control everything fine in the Maestro control center, but will only be able to send serial commands after I disable the port, change its number, and re-enable it. Simply disabling and re-enabling it without changing the port number won’t work. Very annoying, cause then I have to change the port number in all my scripts as well.

I know it only happens when I do something wrong, but it significantly slows down my progress… Any idea?


Hello, alevesque.

How does your program work? Does it connect to the COM port every time it wants to send a command? Is it possible that you accidentally left a handle to the COM port open and forgot to close it? If you did that, you wouldn’t be able to open the COM port until that handle is closed. Also, if a handle to the COM port is left open and it remains open when you plug the Maestro into USB, then the Maestro will be unable to claim that COM port number and you won’t be able to use the Maestro’s COM port for that session.

The procedure I always follow for getting the COM ports to work again is:

  1. Close all programs that might have a handle open to the COM port.
  2. Unplug the device from USB.
  3. Plug device back into USB.

On rare occasions, this procedure isn’t good enough and you actually have to reboot.

The Maestro never intentionally shuts down its virtual COM ports.

Does your computer make a noise when a USB device is connected or disconnected? It would be good to know whether you hear that sound when this problem occurs.


Hi David - thanks again for chiming in

My scripts only connects to the port once; I create an instance “ser” of the port initially, using:

import serial

ser = serial.Serial(9) #open COM10

Then I have various functions and loops going on, sending/receiving data using the “ser” instance. It works flawlessly, and can go on without problem indefinitely. Only when I mess up - send wrong data, forget to close a loop, or when I create a wrong call to the Cunema 4D API, then the COM is lost.

I don’t see how there could be a handle left on the port, really. And I tried unplugging the USB cable, shutting down the python console - heck, shutting down all programs… Nothing does it but disabling the COM driver in device manager, changing the COM port number, and enabling it back. What’s more than annoying is that it’ll randomly ask me to reboot when I do so.

Very annoying, cause in this phase of dev I do have to test and try a lot, and as the Cinema 4D python API isn’t the most documented, I’m in trial and error mode a lot - which means a lot of losing the COM port for no apparent reason.

I can post my script here if it’s helpful…