Recognizing the UNO on a com port


I had a windows service developed for recognizing the Arduino board when it's plugged into a PC. I have a couple of project using the Due, Lilypad and UNO. It's similar to when a person plugs in a board and the IDE knows which ports are being made available on that device. I have no problem getting the com port for the Due and Lilypad to be recognized, but for some reason the UNO remains silent. Is there something new about the way the UNO uses a com port or announces itself to the system that prevents it from working compared to the Due?



Are you saying that the Uno fails to respond after data has been written to it from the PC?

No, the UNO works fine. What I am saying is that for some reason the Due is able to announce itself tot he PC, but the UNO remains silent. Yet when I launch the IDE it will recognize the port the UNO is on and I am able upload the code to it without a problem. With the Due I am able to register it being connected to the PC and have it assigned a port. With the UNO I don't see it. I was just wondering if there is something new about the way an UNO connects to the PC on its serial port that causes it not to appear.


Due is able to announce itself tot he PC, but the UNO remains silent

Annonce itself? In what way? WM_DEVICECHANGE message?

Yes, I believe that is what we are using.


Two things...

  1. WM_DEVICECHANGE message is WAY outside the realm of the Arduino. While I'm willing to try and help, I suspect I'm alone. You may be better served by soliciting for advice on a Windows development forum.

  2. In my experience, every USB insertion results in a WM_DEVICECHANGE message being broadcast. I believe Configuration Manager is responsible for broadcasting the message so it is unlikely that the "new" Uno driver is causing the problem. The Uno uses a different driver so the WM_DEVICECHANGE message parameters may be different. If I were in your shoes, I'd start with the WM_DEVICECHANGE message handler. First ensure that the message makes it to your handler when an Uno is inserted.

OK, thanks for your help and advice.


Hi, I have installation problem. I could find only COM1 as serial Port. I think I have not properly done the installation when I first connect the Arduino Duemilanove board to my PC. Can anyone please suggest how can I bring the USB Serial port of the Board so that I can download my code to the board.

Thanks Yumnam Kirani Singh

Asking on a Win32 forum isn’t going to lead anywhere if UNO is misbehaving.

What type of notification are you requesting for your WM_DEVICECHANGE?
It makes a difference how you ask. Try using the GUID method.
Here’s a little code that works for me, but I don’t own a UNO (yet)
so I haven’t tested on it. For more info on WM_DEVICECHANGE,
look it up on MSDN, it’s fairly well documented.

HTH // L.

First, global stuff.

#include <dbt.h> // Needed for DEV_BROADCAST_PORT
HDEVNOTIFY          hDevNfy = 0;

Then the request, for example in WM_CREATE/WM_INITDIALOG.

        0x86e0d1e0L, 0x8089, 0x11d0, 0x9c,0xe4,0x08,0x00,0x3e,0x30,0x1f,0x73 );
    // Request notifications when COM ports are added/removed
    memset( &devFilter, 0, sizeof(devFilter) );
    devFilter.dbcc_size = sizeof(devFilter);
    devFilter.dbcc_devicetype = DBT_DEVTYP_PORT;
    devFilter.dbcc_classguid = GUID_CLASS_COMPORT;
    hDevNfy = RegisterDeviceNotification( 
        hWnd, &devFilter, DEVICE_NOTIFY_WINDOW_HANDLE 

Then the response, in your window proc.

        case WM_DEVICECHANGE: 
            PDEV_BROADCAST_PORT pDevPort;
            pDevPort = (PDEV_BROADCAST_PORT) lp;
            if (!pDevPort) return TRUE; // Allow config changes
            if (pDevPort->dbcp_devicetype == DBT_DEVTYP_PORT)
                switch( wp ) 
                case DBT_DEVICEARRIVAL: {
                    AddComPortItem( hComList, pDevPort->dbcp_name );
                    const char* const S_ComAdd = "COM port added - %s\n";
                    SB_SetText( hStatBar,2,strfmt( S_ComAdd, pDevPort->dbcp_name ));
                    DPrint( S_ComAdd, pDevPort->dbcp_name );
                  } return TRUE;
                case DBT_DEVICEREMOVECOMPLETE: {
                    RemoveComPortItem( hComList, pDevPort->dbcp_name );
                    const char* const S_ComRem = "COM port removed - %s\n";
                    SB_SetText( hStatBar,2,strfmt( S_ComRem ,pDevPort->dbcp_name ));
                    DPrint( S_ComRem, pDevPort->dbcp_name );
                  } return TRUE;
            return TRUE;
        } // WM_DEVICECHANGE

Hi, I have installation problem


Please post problems with installation in this section…,2.0.html

Which service is failing to detect the uno?

You can see in Windows devices that the uno is creating the COM port, so it might be a failure in your application. If you don't require a constant monitoring, I suggest to use a simple approach like this (C#):

private void UpdateSerialPortList()
    String[] ports = SerialPort.GetPortNames();

    if (originalPorts.Length == 0)
        originalPorts = ports;

    foreach (String s in SmartSort(ports))
        ToolStripMenuItem i = new ToolStripMenuItem(s + ((Array.IndexOf(originalPorts, s) == -1) ? " (new)":""));
        i.Tag = "port_" + s;
        i.Click += new System.EventHandler(connectToToolStripMenuItem_Click);