Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to check if a laptop is on (in standby)?

Status
Not open for further replies.

bigal_scorpio

Active Member
Hi to all,

Maybe this is a simple thing to do but I can't figure out how to do it.

I thought checking if the USB ports had power would work but they stay powered even in standby! So any ideas would be appreciated.

Al
 
Come on guys I am really stuck here. :(

Hi again,

I really need to find some way of detecting if a laptop is running or in standby, I tried USB as I said and there is no serial port to test.

The only options I can see are the LAN port or modem port, but I don't know if any would be viable in the different states.

Any ideas?

Al
 
I don't know anything for sure. Try pinging your Ethernet port.

What exactly are you trying to accomplish and for what purpose?
 
You can go into device manager and set the USB root hub power management properties to allow the computer to turn off the USB power to save power.
Dale
 
Some machines support "wake on lan" and by sending it a "magic packet" you can wake the machine up. Easiest way is to ping the machine and it you don't get a reply assume it's asleep. If you want to wake it up send the magic packet.
 
I unusually check for the little LED light that turns on when it's in standby =)
 
Hi guys,

My problem is that I am using the laptop as a carputer, its in the back of the car running my touchscreen in the front.

What I need is the laptop to come out of sleep when the ignition is on and go to sleep when its off. This was easy enough to do with a PIC and works ok until the ignition is switched on and off quickly (if the car doesn't start first turn for instance) and then because the waking/standby cycle takes about 10 seconds the whole thing can get out of sequence.

I tried the USB solution at first but even when the box that says "allow windows to turn off this device" is ticked the USB power remains ON during standby, I'm guessing that the actual device is sent a shutdown code, as ALL the laptops I have tried still have the power on even when in standby!

So I need something I can phisically measure which changes in standby.

Pinging and such is out of my scope I,m afraid and there is no light that comes on during standby on my laptop! The green power light simply flashes instead of being on steady. :(

There is a Firewire port on the laptop but I have never used this and don't know if this would be any different from USB in the way it is powered and there is a TV out mini din port I can access.

What I need is to somehow interface one of these outputs (if there is one) with my PIC to stop the on off sequence getting out of step.

Keep the suggestions coming guys...........Al
 
What I need is the laptop to come out of sleep when the ignition is on and go to sleep when its off. This was easy enough to do with a PIC and works ok until the ignition is switched on and off quickly (if the car doesn't start first turn for instance) and then because the waking/standby cycle takes about 10 seconds the whole thing can get out of sequence.
How about programming your PIC with a delay time greater than the amount of time it takes your laptop to go into/out of sleep mode. When the ignition is turned on, have the PIC take the laptop out of sleep, but then it will wait at least 10 seconds before attempting to put the laptop back into sleep. Same for ignition off going back to sleep.

Maybe also have a pre-change delay, so that:

1. If you turn ignition on and then off quickly (e.g. to roll up/down your windows without starting the car), the laptop stays asleep.

2. If you turn the car off and on quickly (say you drive a stick and stalled it and need to restart), the laptop stays awake.

3. Once the ignition has been on for 10 seconds, the laptop comes out of sleep. If the ignition is then shut off, the PIC will wait an additional 10 seconds to ensure the laptop is out of sleep before it goes back to sleep.

3. Once the ignition has been off for 10 seconds, the laptop goes into sleep. If the ignition is then switched back on, the PIC will wait an additional 10 seconds to ensure the laptop is asleep before it wakes it back up.
The green power light simply flashes instead of being on steady. :(
There you go. Wire the power LED to an input on your PIC, or use a photodiode/phototransistor/LDR taped over the LED, and have it sense the laptop's state that way. If the light is on steady, the laptop is awake. If it's flashing, it's on standby. If it's off, it's shut down. Then you can send whatever signal is appropriate to wake it up/put it to sleep/power it up.
 
Last edited:
Hi kpatz,

There you go. Wire the power LED to an input on your PIC, or use a photodiode/phototransistor/LDR taped over the LED, and have it sense the laptop's state that way. If the light is on steady, the laptop is awake. If it's flashing, it's on standby. If it's off, it's shut down. Then you can send whatever signal is appropriate to wake it up/put it to sleep/power it up.

I like that idea very much! But I am unsure how to get the PIC to know the difference between the flashing which is about 1 second on then 1 second off etc and steady on?

I am no genius with programming and just scrape by with the basics, which coincidentally is what I use (MikroBasic) and I think that is beyond me, can you or anyone else point me in the right direction code wise to do it?

Thanks Al
 
It should be pretty simple, feed the LED output from the laptop into a PIC input line, poll the I/O line say 5 times a second, if you get 10 I/O port readings that are all high (2 seconds with the LED on) you know the laptop is on. It'd be pretty easy to do.
 
It should be pretty simple, feed the LED output from the laptop into a PIC input line, poll the I/O line say 5 times a second, if you get 10 I/O port readings that are all high (2 seconds with the LED on) you know the laptop is on. It'd be pretty easy to do.

Hi mate,

Yes that sounds just the job, my trouble is I never can think of these simple methods, I'm more of a solder and components type and the programming is hard to follow sometimes.

Anyway I'm off to give it a go now, thanks..............Al
 
Little code projects like this are perfect opportunities for you to learn to code better. It should be very simple and if you have trouble people will gladly help.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top