Connect with us

Trying to detect wake/sleep from USB port

Discussion in 'General Electronics Discussion' started by JackP, Aug 28, 2017.

Scroll to continue with content
  1. JackP

    JackP

    8
    0
    May 8, 2017
    I want to detect if my AndroidTV device is on or in sleep mode using the USB port. The port remains powered even if the device is sleeping (ie I can light an LED with dropping resistor even if it is in sleep mode).

    Originally I was trying to test if the port was powered using my iPod and looking at the charging indicator. I see now this was a bad test of port power as the iPod shows not charging when the AndroidTV is sleeping.

    Even though my originally testing method was flawed, it produced the results I am trying to achieve. Is there something simple I can do with the data out to detect wake/sleep on the USB port?
     
  2. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    First off I have to preface this question with I have no idea if your android device queries your USB port when it wakes up. It's more likely that the device will wake up in response to plugging in a USB device. This does not include external devices that utilize only V+ & GND.... like your LED.

    Do you have access to a dual trace scope?

    Chris
     
    davenn likes this.
  3. JackP

    JackP

    8
    0
    May 8, 2017
    I dont have access to a scope, juts a logic probe.
    I have been trying unsuccessfully to hack an optical mouse over the last few hours. The tracking LED on the mouse goes on and off with the USB sleep.
     
  4. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    What exactly do you want to trigger when your android wakes up?
    Hacking a mouse might be your ticket.
    Chris
     
  5. JackP

    JackP

    8
    0
    May 8, 2017
    The AndroidTv outputs to an HDMI splitter and then to and HDMI over Cat5 converter to feed the bedroom. These devices and the AndroidTV get really hot and they are used infrequently. I want them all to (auto) power down when they are not in use, ie when the AndroidTV goes to sleep.

    Both of the other devices use USB chargers (2A each) I doubt the AndroidTV puts out enough power over the USB port to power them (and it stays on in sleep mode anyway) but I wanted the USB port to trigger a transistor driven relay to switch off the other 2 devices.
     
  6. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    There might be an easier way that doesn't involve messing with USB ports. There are current sensing relay modules available on Ebay and Amazon. They plug into a 120V receptacle that controls another on-board 120V receptacle. When it senses that the TV is ON the controlled receptacle will switch ON and it will drop out when the TV is off. You could then power your peripherals from the controlled receptacle.
    These devices are widely used in wood shops. Used to control large dust collectors when they sensed any dust or chip making machine in use. I tell you this because you need a model that can sense current levels far less than a Table Saw. ;)
    Chris
     
  7. JackP

    JackP

    8
    0
    May 8, 2017
    I actually use a current sensing power strip to turn off all of my computer peripherals when the CPU is off. Can't use one in this situation for several reasons.

    1. TV is wired into dedicated wall socket
    2. The AndroidTV and other parts are hidden in a very small "secret compartment" with very limited space (and this is partly why it is getting so hot) in a piece of expensive furniture below the TV. No room for something as large as a power strip.

    But thanks for the suggestion anyway :)
     
  8. JackP

    JackP

    8
    0
    May 8, 2017
    I cant get my hacked mouse LED to drive a transistor/relay but was thinking about swapping the LED in the mouse for the LED in an opto -isolater, with the photo transistor in the opto -isolater driving my transistor/relay
     
  9. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    OK, then back to your mouse..
    How about a second wireless mouse and OptoCoupler pick-off?
    Actually, it may be possible to pick off the trigger sig with a direct connection to the Mouse' LED driver.

    Chris
     
  10. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    EDIT Ha! We doubled!
     
  11. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    Since this should be doable please post your schematic of how you've been using a transistor & relay tapped into your mouse LED.

    Chris
     
  12. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    Jack, I reread your post regarding replacing the mouse LED with an Opto. It's sounds doable. What's the coil specs on your Relay? Do you know if the mouse LED receives a constant or pulsed current drive? If it's pulsed you'll have to capture the event with a latch. My guess is that it's a steady state current.

    Chris
     
  13. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
  14. JackP

    JackP

    8
    0
    May 8, 2017
    So I finally got the circuit working using a RC filter with a diode to filter out the 4k signal. Fed the filtered signal into a transistor and drove a relay.

    All appeared to be working, but after leaving the circuit running for a few hours it appears the USB polls the mouse every few hours and wakes everything up.

    Finally bit the bullet and just programmed a PIC to do everything
     
  15. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    Glad to read you've PIC'd your way through this. Though I'm surprised that the TV polls the mouse. Seems logically backward.

    Good luck,
    Chris
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-