Wake up a PC from an Uno

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure if this is the right forum (I don't even know what "AVR" means), but I was pointed here and the "LUFA" package, as maybe being able to help me. I want to wake up a PC via a USB-connected Arduino. When using a Pro Micro (Leonardo) I can do it, as its HID interface can wake up a PC. That is, in the Device Manager, under "Keyboards", the relevant HID device under "Power Management" has an "Allow this device to wake-up the PC" checkbox.

 

 

However, I need to use an Uno for this project. There's a hack (see link below) which flashes the ATMega16U2 on an Uno to act as a HID keyboard. It works fine, but this HID keyboard on a flashed Uno does NOT have the "Allow this device to wake up the PC" checkmark, i.e. I can't wake up my PC. I tried, the PC doesn't wake up. I know I can use an Ethernet shield on an Arduino to send a Wake up on LAN packet, but I don't want to add any shields, if I don't have to. . I don't need any other keyboard (or mouse etc) emulation functionality besides being able to wake up the PC. Is there some basic, simple code that would do this from an Uno? Thanks.

 

Relevant link:

http://www.kevindemarco.com/2014/01/02/arduino-uno-as-a-usb-hid-interface/

This topic has a solution.
Last Edited: Fri. Aug 10, 2018 - 06:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the checkbox is not there then at the time of enumeration, the device told the host that it does not have the ability to wake the PC.

 

You are going to have to provide more information as this:

element22 wrote:
There's a hack (see link below) which flashes the ATMega16U2 on an Uno to act as a HID keyboard. It works fine, but this HID keyboard on a flashed Uno does NOT have the "Allow this device to wake up the PC" checkmark, i.e. I can't wake up my PC. I tried,

 

Does not tell us if YOU tried the hack, and all the links embedded in the article, or only some of them etc.

 

Post a detailed description of what you have done, and the success and fails in doing so.  It will get you better answers.

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From the LUFA manual:

http://fourwalledcubicle.com/fil...

 

void USB_Device_SendRemoteWakeup(void)

           

Sends a Remote Wakeup request to the host. This signals to the host that the device should be taken out of suspended mode, and communications should resume.

Typically, this is implemented so that HID devices (mice, keyboards, etc.) can wake up the host computer when the host has suspended all USB devices to enter a low power state.

 

Attention

This function should only be used if the device has indicated to the host that it supports the Remote Wakeup feature in the device descriptors, and should only be issued if the host is currently allowing remote wakeup events from the device (i.e., the USB_Device_RemoteWakeupEnabled flag is set). When the NO_DEVICE_REMOTE_WAKEUP compile time option is used, this function is unavailable.
 

The USB clock must be running for this function to operate. If the stack is initialized with the USB_OPT_MANUAL_PLL option enabled, the user must ensure that the PLL is running before attempting to call this function.

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for looking into this. Besides LUFA, I found another library (NicoHood, see link below) to code a HID keyboard for the ATMega16U2 on an Arduino Uno. The problem is that acquainting myself with the subject and (either) library, would take several days, which is why I'd prefer to find an already-compiled simple HID device that does what I want. If I can't find one, I have a "dumb" solution: since the Leonardo can wake up a PC, I can hook it up to the PC, power the Uno (with my code) off the Leonardo, link one digital pin between the Uno and the Leonardo, so that the Uno can trigger a USB keystroke on the Leonardo. This is kludgy, since it uses the Leonardo just to send one USB keystroke to wake up the PC, but it would work.

 

https://github.com/NicoHood/HID/wiki/Keyboard-API#boot-keyboard

https://github.com/NicoHood/HoodLoader2

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The problem is that acquainting myself with the subject and (either) library

@element22 - are you related to this Element 22: http://www.element-22.com/ ?

 

If this is for a commercial project, then note that a commercial licence is available for LUFA

See: https://www.avrfreaks.net/commen...

 

Which gives you priority support and "Three free hours of consultation with the author to help develop your product"

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's not me, I'm a hobbyist not a company.

Last Edited: Thu. Aug 9, 2018 - 12:30 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Got it working: my Uno can now wake up a PC. I followed the HoodLoader wiki and I used the HID-Bridge sketches (below). It took about 2-3 hrs.

 

https://github.com/NicoHood/HoodLoader2/wiki

https://github.com/NicoHood/HoodLoader2/tree/master/avr/examples/HID-Bridge

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Congrats!

 

Please mark your post as the solution

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user