Windows 11 does not recognize Arduino Pro Micro as a joystick (HID)

Good morning,

I'm experiencing an issue with two Arduino Pro Micro boards. I'm working on this project: hub.com/romapr1me/Button-Box. I had already built it a couple of years ago, and the button box was working correctly.

After a couple of years without using it, a few months ago, I wanted to use my cockpit again, along with the button box, but JoyToKey and the Device Manager did not recognize it as a game controller.

Since I wanted to renew the case, I bought new components and built a new one from scratch. Yesterday, after doing all the wiring and soldering everything to the board, I tested it and uploaded the code, but Windows 11 still didn’t recognize it as a joystick.

In the code, I use a couple of libraries: Keypad by Mark Stanley and Alexander Brevig, and Joystick. When I check the Device Manager in Windows, the board appears under Ports (COM & LPT) as USB Serial Device (COM4) and also under Other Devices in Windows settings, but I can't do anything from there.

When I press WIN + R and type joy.cpl, no devices appear as a joystick. I've tried different cables (including my phone cable, which supports both charging and data transfer) and different USB ports on my PC. I've also tried uploading only the basic code needed for it to be detected as a joystick:

#include <Joystick.h>

Joystick_ Joystick;

void setup() {
  Joystick.begin();
}

void loop() {
}

But it still doesn’t recognize it as a joystick. This happens both with the new board I set up yesterday and with the old one that used to work before.

I've uninstalled and reinstalled the drivers, but nothing changed… I don’t know if I might be missing something in Windows 11. Every time I have an issue, it's always related to it…

Thanks in advance for your help!

1. Board Configuration in Arduino IDE

  • Ensure you're using the correct board: When you upload your code, make sure you're selecting Arduino Pro Micro in the Arduino IDE under Tools > Board. If you have the ATmega32U4 chip selected (which is what the Pro Micro uses), that should be fine.
  • Port Selection: Double-check that you're selecting the correct COM port under Tools > Port in the Arduino IDE when you upload the code.

2. Joystick Library

  • Correct Library: Make sure you're using the correct Joystick library (the one from Matthew Heironimus). You can install it from the Arduino IDE library manager. The code you've posted seems fine, but double-check that you're using the correct library and that it’s up to date.
  • Joystick.begin(): You’ve got the right function in the setup for initializing the joystick, but if the library is not properly recognized or installed, it might not work as expected. You can try uploading just a basic sketch that only uses the Joystick library, like this one:

cpp

Copier

#include <Joystick.h>

Joystick_ Joystick;

void setup() {
  Joystick.begin();
}

void loop() {
  // Just sending a button press, e.g., Button 1 pressed
  Joystick.setButton(0, true);
  delay(100);
  Joystick.setButton(0, false);
  delay(100);
}

This will allow you to test if the joystick is sending data. You can also add a Serial.println() inside the loop() to monitor any output for debugging.

3. USB Communication Mode

The Pro Micro boards are tricky in that they support both serial and HID (Human Interface Device) modes. It sounds like your board is currently in Serial mode (appearing as USB Serial Device (COM4)). This is why Windows sees it as a COM Port rather than as a joystick.

To make the board act as a joystick, you need to force it into HID mode, not Serial mode. Here’s how you can ensure that:

  • Use the right USB descriptor: Ensure the Joystick library you’re using is correctly configured to use the HID descriptor. There might be an issue with how the Pro Micro enumerates as a USB device if you're using the wrong type of descriptor.
  • Change bootloader: Make sure you’re using the correct bootloader for HID devices (like the "Arduino Leonardo" bootloader). You can burn the bootloader again with the right settings using an external programmer if needed.
  • Use HID-Project library: If you still have issues with the Joystick library, you can try using the HID-Project library, which is another library that supports HID devices like joysticks. You can install it through the Arduino Library Manager:
    • In the Arduino IDE, go to Sketch > Include Library > Manage Libraries.
    • Search for HID-Project and install it.Here’s an example using HID-Project to make the board act as a joystick:

cpp

Copier

#include <HID-Project.h>
#include <HID-Settings.h>

void setup() {
  BootKeyboard.begin();
}

void loop() {
  // Example to send a key press as joystick input
  BootKeyboard.press(KEY_ENTER);
  delay(100);
  BootKeyboard.release(KEY_ENTER);
  delay(100);
}

4. Windows Device Manager

  • Check for conflicts: Sometimes, Windows can get confused if there are conflicting drivers. Right-click on the USB Serial Device (COM4) in Device Manager, and see if there are any error codes or messages. If so, try updating the driver manually, pointing to the Arduino drivers folder.
  • HID Joystick Driver: In some cases, Windows may fail to recognize the board as a joystick automatically. You can try manually updating the driver to the HID Joystick driver if it's not being detected correctly.

5. Check Windows 11 Issues

  • USB Settings: Windows 11 may have some quirks with how it handles USB devices, especially with boards that switch modes between serial and HID. Make sure that your USB ports are working properly. Sometimes, updating Windows or drivers can help fix these issues.
  • Use Windows Troubleshooter: If the device doesn’t appear in joy.cpl, you can run the Hardware and Devices Troubleshooter in Windows 11 to try and identify any issues with USB or HID devices. Go to Settings > Update & Security > Troubleshoot > Additional troubleshooters.

6. Test on Another Computer

  • If possible, try connecting your Arduino to another computer (preferably one without Windows 11) to check if the problem is isolated to your current system. This might help determine if it's a software issue on your PC or an issue with the board itself.