Symptoms
I was running in to a number of issues with the Arduino IDE not being able to connect to my Arduino’s serial port.
The error messages typically indicated that the COM port was busy.
Something like: Error opening serial port 'COM14'. (Port Busy)
(Your COM port number may vary.)
No matter what I tried, over the course of multiple debug sessions I couldn’t it out. The only time I could access the device was after a fresh reboot. If I programmed the device I would then get the ‘port busy’ message afterwards. And, having to reboot after every single programming run just to see serial output was just not going to happen. (Let alone, if the pertinent messages came up right after the device rebooted after a programming session.)
In my case I will say that the culprit was NZXT CAM; a program which controls my NZXT liquid cooling setup.
That said, I would like to explain how to figure out what process is using the COM port because this may not be the culprit for you.
Getting Started
Checking Your Arduino
The first step is to make sure your Arduino is showing up as a device. This is pretty easy:
- Right click on your ‘Windows’ logo / start menu in the bottom left of the screen.
- Select ‘Device Manager’
- In the window that pops up, expand the ‘Ports (COM & LPT)’ member
- Your Arduino should be listed there along with it’s COM port number
- Don’t close Device Manager yet. We may need it later
You should expect to see Arduino under the ‘Ports (COM & LPT)’ section. If you don’t see it there is probably something else wrong. You may need to find a different tutorial; sorry about that.
Finding the Culprit
Downloading Process Explorer
There are a couple of tools you can use to do this investigation, but in this page we’ll be using Process Explorer. This is a tool provided by Microsoft, and is reasonably easy to use.
- Download the tool; as of this writing you can find it here
- This tool does not require an install, but I recommend extracting the zip file at least.
- Open the resulting extracted folder
- IMPORTANT: Make sure you run Process Explorer in the next step AS ADMINISTRATOR (via the right-click menu). Otherwise you may not be able to have insight in to all of the processes running on the system.
- If you are on a 64-bit system (most likely with newer systems) run
procexp64
You should see a window that looks like this:
Doing an Initial Search
At first, there are a few different strings you can search for. I’ll cover these here (including the one that worked for me), but I’ll also help you try to find other strings you could search for below.
- With Process Explorer open, click ‘Find -> Find Handle or DLL’ or hit
Ctrl+F
- In the box next to ‘Handle or DLL substring’ you’ll want to try one of the following:
- usbser
- Serial
- VCP
For me, usbser
was the winner, but the other two may also work.
The list started from this Stackoverflow reply.
You should end up seeing something like this:
Diving Deeper
More Search Terms
As I mentioned above, with the initial search terms I was finding online (Serial, VCP) I was unable to locate the culprit. So, I turned to the data in device manager to see if I could expand my search terms. If you’d like to try some more, you can take the following steps.
- With device manager open, and showing your Arduino device under ‘Ports (COM & LPT)’…
- Right click on your Arduino device and select properties
- Select the ‘Details’ tab
In this tab you can make changes to the ‘Property’ drop down to search for more potential search terms. I found mine (usbser) under the ‘Service’ item. Some of these are likely more useful than others. However, I am not a Windows expert so I’m not sure what handle names are valid ones so you may have to do a little bit of manual searching.
After killing NZXT CAM on my system it is smooth sailing again for my Arduino. I hope this helps you root cause your COM port (or other resource) issues!