Search code examples
androidkeyboardserial-portarduinousb-otg

Arduino being recognized as keyboard by android


I wrote a simple firmware for arduino to replicate whatever incoming data it recieves on serial to the serial output. Something like this: int serialData = 0;

void setup()
{
  Serial.begin(9600);  
}

void loop()
{
  if (Serial.available() > 0)
  {
    serialData = Serial.read();
    Serial.println(serialData);
  }  
}

Now I wanted it connect to my Nexus 7 running on Android 4.3 using a microUSB->OTG cable + USB->microUSB cable. I installed a serial monitor app (https://play.google.com/store/apps/details?id=jp.ksksue.app.terminal&hl=en) and was expecting to write serial data over it.

Once I connected this to the tablet I ended up getting a keyboard notification. Android recognizes this connection as keyboard. This collapses the android keyboard as it has detected an external keyboard. however I get an option to paste on the input box. Which seems to work.

Is it possible

  • disable mounting of keyboards in android. Or
  • Making arduino being recognized as something other than keyboard.

Solution

  • A workaround to this problem was to install another keyboard app like Go keyboard or swype. This leads to a notification upon connecting arduinp to the android device, from where you can turn off the external hardware and switch back on screen keyboard. Not persistent but works!