[SOLVED] Arduino Micro + Keyboard library to auto-login

I have an Arduino Micro, a very simple circuit to simulate a soft-power button-push to the computer, and an extremely slow-booting work computer that I can't simply turn Windows "auto-login" on in the registry. I also have a sketch that:

  1. briefly (500ms) sends 5V to a transistor that causes a boot-up command to go to the motherboard
  2. waits for 8 minutes for the computer to reach the login screen
  3. sends Ctrl-Alt-Del, (pause), Enter [company disclaimer screen], (pause), my password, Enter

I've tested this on my personal Windows machine by adding code to send an ESC char in; that way I can run it on the machine that I'm doing development on. It works great, causing the Win 7 Blue Screen to come up (then go away, thanks to the Esc), and then types what I want into my waiting Notepad program.

But when I hook it up to the target machine, the booting works flawlessly but the keyboard commands just never happen. The Arduino thinks it has sent the keyboard commands, and reaches its idle state, but nothing happens on the target machine. The target machine is an HP Z600 workstation, and has another USB keyboard plugged in. Could this be the issue?

Any ideas how to go about chasing this down?

How about posting a schematic ?
How about posting the code (using the "#" code tags toolbutton)
How are you connecting the arduino to the computer ?

The target machine is an HP Z600 workstation, and has another USB keyboard plugged in. Could this be the issue?

sounds like you need to do some common sense debugging

Write a simple program that types something like “Hello World” to the keyboard

Plug the Arduino into the target machine.

Open notepad

reboot the Arduino

See if it types Hello World

This would probably rule out the dual keyboard issue

You may also want to try the same thing booting the machine in question and see if you see the … dots as the keys are typed into the login box albeit Hello World will not be your password

How are you connecting the arduino to the host computer ?
You can't use the USB port on the arduino for that because the USB port is a SLAVE port, not a HOST port.
You have to use the Tx & Rx pins or SoftSerial.

raschemmel:
How about posting a schematic ?
How about posting the code (using the "#" code tags toolbutton)
How are you connecting the arduino to the computer ?

Only the Keyboard portion of the schematic is relevant, since the booting portion works fine.

Schematic: Arduino----USB----->Computer

I'm only posting the keyboard portion of the code, since the booting portion works fine.

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

bool gDone = false;
void loop()
{
  if (gDone)
    return;

  gDone = true;
  Keyboard.press(KEY_LEFT_CTRL);
  delay(10);
  Keyboard.press(KEY_LEFT_ALT);
  delay(10);
  Keyboard.press(KEY_DELETE);
  delay(50);
  Keyboard.releaseAll();
  delay(1000);

  // Enter through the disclaimer screen
  Keyboard.press(KEY_RETURN);
  delay(50);
  Keyboard.releaseAll();
  delay(1000);

  Keyboard.print("password");
  Keyboard.press(KEY_RETURN);
  delay(50);
  Keyboard.releaseAll();

  Keyboard.end();
}

raschemmel:
How are you connecting the arduino to the host computer ?
You can't use the USB port on the arduino for that because the USB port is a SLAVE port, not a HOST port.
You have to use the Tx & Rx pins or SoftSerial.

The Arduino Micro can act natively as a USB Keyboard. See http://arduino.cc/en/Guide/ArduinoLeonardoMicro?from=Guide.ArduinoLeonardo.

As I said in the original post, the entire circuit and sketch works like on a champ on another computer.

I wasn' t aware of the separation of USB and serial communication with the Micro. That was news to me.
Doe the Micro transmit to the serial [EDIT] Monitor ?

Doe the Micro transmit to the serial port ?

AFIK the Micro is the same architecture as the Leonardo

It uses the ATMega32U4 which has built in USB.

The USB code in the 32U4 appears as 3 devices to the host computer

  1. Serial port
  2. USB Keyboard
  3. USB Mouse

The hardware serial lines are routed to pins 0 and 1 as on the Uno etc, but as the serial comms to the host are handled directly in the USB code in the Arduino core for the 32U4 they are free to be used as a hardware serial

In the Arduino core code Serial is mapped to the internal USB connection to the host, Serial1 is mapped to the real serial hardware on pins 0 and 1.

The connections on the Arduino Micro are basically the same as it has the ATMega32U4, its just a miniaturized version of the Leonardo without the regulator and the headers etc

I discovered this morning that the target Windows machine didn't like the Arduino as a keyboard. Even installing the Arduino IDE (and its included drivers) had no effect. The Micro would show up as an "Arduino Micro" in the Device Manager, but as an Other Device with the Yellow Exclamation-Point Of Fury.

Following the instructions at the getting started page did not work - Windows instantly gave me the generic "driver installation failed" message.

Advice given on the forum here in the main post also didn't work, as I didn't have an Arduino LLC entry in my driver list and using the "Have Disk" option also failed - Windows told me the drivers in the "drivers" folder weren't for my version of Windows and/or my device.

However, three responses down was a suggestion that sort of worked: manually copying the INF and CAT files into C:\Windows\INF, uninstalling the Other Device, and then pulling and re-inserting the Arduino. Windows ran off trying to find updates for the drivers on Windows Update, and I just let it. After a few minutes, it was happy, and then the keyboard commands started reaching Windows as intended.

Unfortunately, this did not survive a reboot. So I had to turn User Account Control Notifications to "never notify me about anything", re-do the procedure above, and then reboot again.

Now the Arduino shows up properly (for a Micro) in the Device Manager: one entry under Ports that reads "Arduino Micro [COM3]", and another under Keyboards that just reads "HID Keyboard Device". Once this survived the reboot, I was able to put UAC back to its default setting (a good safety feature), and the driver installation started surviving the reboot.

Note: this whole thread refers to Windows 7 Professional, Service Pack 1, 64-bit.

If there is interest I will post the full circuit and sketch for informational purposes.