Arduino Pro Micro not detected as USB Keyboard

Hi,

I'm working on a Arduino based macro keyboard to control a professional audio recorder. In this case, a Sound Devices Scorpio:

The recorder has an USB-A port for for peripherals and I can easily control it with a regular keyboard.

I've created a very simple setup using an Arduino Pro Micro and an example sketch from the library, and it works fine when connected to my computer.

However, the recorder doesn't detect the Arduino keyboard, as if there was nothing plugged in.

Is there something in my code that I should try, such as other keyboard or HID library?

Or maybe another board with a different chip?

Any help is much appreciated!

Thanks, Luis


  • Hardware: Arduino (compatible) Pro Micro
  • Arduino IDE 1.8.12
/*
  Keyboard Message test

  For the Arduino Leonardo and Micro.

  Sends a text string when a button is pressed.

  The circuit:
  - pushbutton attached from pin 4 to +5V
  - 10 kilohm resistor attached from pin 4 to ground

  created 24 Oct 2011
  modified 27 Mar 2012
  by Tom Igoe
  modified 11 Nov 2013
  by Scott Fitzgerald

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/KeyboardMessage
*/

#include "Keyboard.h"

const int buttonPin = 4;          // input pin for pushbutton
int previousButtonState = HIGH;   // for checking the state of a pushButton
int counter = 0;                  // button push counter

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState)
      // and it's currently pressed:
      && (buttonState == HIGH)) {
    // increment the button counter
    counter++;
    // type out a message
      Keyboard.press(KEY_UP_ARROW);
  delay(100);
  Keyboard.releaseAll();
  }
  // save the current button state for comparison next time:
  previousButtonState = buttonState;
}

How is that button, keyboard etc wired? Schematics please.

Thanks for the reply.

Schematics are:

  • 4 pin pushbutton attached from pin 4 to +5V
  • 12 kilohm pulldown resistor attached from pin 4 to ground

Please let me know if I can provide any other useful information.

That's okey. Why not use the builtin pullup resistors by declaring INPUT_PULLUP and connect to GND? No external resistors needed....

What about the keyboard?

Sure, using the builtin resistors would be even simpler, but I don't think that's the cause of the problem.

I'm using the Arduino to emulate a USB keyboard, there is no other keyboard involved. In this sketch, pressing the button corresponds to an Up Arrow key.

The issue I'm facing is the fact that the recorder does not detect the Arduino as a USB keyboard, but my computer does.

Try this:

  1. Install the HID-Project library (available in the library manager).
  2. #include <HID-Project.h> instead of "Keyboard.h".
  3. Replace Keyboard with BootKeyboard.

No it can't be. Just wanted to give You a tip. Hopefully You've got a useful tip.

1 Like

When I build the final circuit I'll definitely use the internal resistors :slight_smile:

It worked!

:star_struck:

Thank you!

Congrats!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.