Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Detect when Host PC is on

  1. #1
    Junior Member
    Join Date
    Jun 2016
    Posts
    3

    Detect when Host PC is on

    I am brand new to Teensy, but have Arduino experience.

    I am wanting to use S5 power mgmt, and a Teensy to turn a PC on/off.

    Turning on looks easy, configure S5 power on USB, then this - http://rasterweb.net/raster/2011/05/09/the-button/
    Once its on, I am presuming off will be simple enough, calling a API or powershell or similar command/utility.

    The PC that I am turning on and off is under a desk. I would love a way to power a LED when it wakes up to giver some user feedback. Ideally the moment power turns on, not waiting for windows to power up.

    Does anyone know of a way to do this?

    thanks

  2. #2
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    701
    You could try sensing the state of the PCs power light either by adding wires to the LED assembly or if making modifications inside the pc isn't an option you could position a photodiode over the light.

  3. #3
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    This button is the most expensive space bar I've ever seen
    For power off: If you are using Windows you can bind key-presses like "CMD-ALT-{any character key}" to batch scripts, that should do the trick with Teensy acting as a keyboard.
    Regarding power on/off detection: photodiode for the PCs power LED is a good idea, maybe using an LDR is even better as you don't need a signal amplifier. (Or maybe there are photodiodes with some sort of TTL output? IDK.)

  4. #4
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    You can't just send some keypress to wake up the PC. What you are looking for is USB remote wakeup. It should work with the Teensy:
    https://forum.pjrc.com/threads/26649...h-a-teensy-3-0

    USB should be suspended when your PC is off and get resumed by the BIOS reasonably soon after it's turned on. usb_private.h has a usb_suspended variable that may work for detection. (Note that Windows does a suspend/resume cycle as part USB enumeration.)

  5. #5
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    701
    Quote Originally Posted by Ben View Post
    Regarding power on/off detection: photodiode for the PCs power LED is a good idea, maybe using an LDR is even better as you don't need a signal amplifier. (Or maybe there are photodiodes with some sort of TTL output? IDK.)
    You can connect a cheap little photodiode between two pins of the Teensy with no additional components and use analogRead(). An LDR would work too, but they're annoyingly slow for this application. As an added bonus(?), If the photodiode isn't enclosed, you'll be able to read the light level in the room as well. :-)

  6. #6
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401
    Quote Originally Posted by pictographer View Post
    You can connect a cheap little photodiode between two pins of the Teensy with no additional components and use analogRead(). An LDR would work too, but they're annoyingly slow for this application. As an added bonus(?), If the photodiode isn't enclosed, you'll be able to read the light level in the room as well. :-)
    Oh that's interesting, thanks for sharing this piece of information! I thought the Diodes impedance and the ADC input impedance wouldn't work well together.

  7. #7
    Junior Member
    Join Date
    Jun 2016
    Posts
    3
    THanks all for your help.

    My job just got easier, the newest model Intel NUC has a IO Header I can just plug into. Solves all my problems.

    That aside, I have still ordered a Teensy, now I just need to think of a new project to use it for!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •