Maker Pro
Maker Pro

Trying to detect wake/sleep from USB port

JackP

May 8, 2017
13
Joined
May 8, 2017
Messages
13
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?
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
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
 

JackP

May 8, 2017
13
Joined
May 8, 2017
Messages
13
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.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
What exactly do you want to trigger when your android wakes up?
Hacking a mouse might be your ticket.
Chris
 

JackP

May 8, 2017
13
Joined
May 8, 2017
Messages
13
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.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
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
 

JackP

May 8, 2017
13
Joined
May 8, 2017
Messages
13
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 :)
 

JackP

May 8, 2017
13
Joined
May 8, 2017
Messages
13
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
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
<snip>
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.
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
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
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
EDIT Ha! We doubled!
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
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
Since this should be doable please post your schematic of how you've been using a transistor & relay tapped into your mouse LED.

Chris
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
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
 

JackP

May 8, 2017
13
Joined
May 8, 2017
Messages
13
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
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Finally bit the bullet and just programmed a PIC to do everything
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
 
Top