0

many mac keyboards have a power button. Is there a way to mimic this power button shortcut from an arduino?

asked Jul 2, 2014 at 20:11
6
  • 3
    Perhaps you could be clear what you mean by "mimic". Do you want your Arduino to be able to turn on (or off) your Mac without manual intervention? Commented Jul 2, 2014 at 20:57
  • 2
    Also, what keyboard? Some Mac laptops have a power button for the computer, where others have one to shut off the wireless keyboard. Commented Jul 2, 2014 at 21:21
  • You have to research HID keyboard codes and its protocol. The power button is a regular key on the keyboard with a specific key code and specific a data frame. Leonardo can probably do it, most somewhat older design Arduino's can't act as a USB HID. Commented Jul 3, 2014 at 5:04
  • The Arduino can emulate a keyboard from which you can send a series of keystrokes to turn off the computer. Not sure you'll be able to mimic the hardware button. There are a few questions that are related: arduino.stackexchange.com/search?q=hid+is%3Aquestion Commented Jul 3, 2014 at 16:47
  • I have a mac mini rack holder that has a front panel with power button. It connects and controls the mac mini with USB only. I want to replicate this power signal sent over the USB with an arduino instead. Commented Jul 3, 2014 at 20:08

1 Answer 1

2

There are multiple ways to do that.

  • You could use an Arduino Leonardo as a keyboard, then send a shortcut command to shut down or sleep the computer. You can edit these from System Preferences>Keyboard>Shorcuts>Services. The keycode 0x66 does not work for mac, but may for other operating systems source

  • You could write a small program (I'd do it in Python) which communicates with the Arduino over the serial port and shuts down the Mac if the Arduino wants it to.

  • You could sacrifice an USB keyboard and use a relay to "press" the power key.

answered Aug 26, 2014 at 18:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.