Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Automatically turn on PC when power is back?

- - - - -

  • Please log in to reply
23 replies to this topic

#1
prathapml

prathapml

    Follow the rules please :-)

  • Patrons
  • 6,791 posts
  • OS:Windows 8 x64
  • Country: Country Flag
Here's the situation.
I live in an area where the electricity supply is highly unpredictable. Power might blackout for only 2 minutes, or there might be a 7-hour powercut in a single day without any warning. So one of my home machines is supplied by an APC 650VA UPS (for power regulation and backup, with USB monitoring, pretty decent for home). The UPS is capable of giving backup power to this PC for 20 mins. I have configured 'Power Options' to turn off monitor in 2 mins, and to put the computer into 'Sleep' mode if its running on battery for more than 5 mins.

All of this has been fine so far, but lets say I want to call this PC my download machine (because of low power consumption). Now at this point, two concerns arise. One, to power off the PC in time in case of a powercut, which is taken care of by Windows' own Power Options. Two, the PC needs to 'sense' when the power (mains, AC power) is back, and turn on and get back to where it was.

That second concern is what is seeming quite complex right now. I can confirm that the APC UPS (link to specs underlined) pretty much works like a laptop battery, which means it can inform the OS when power is off and power is back. But if the PC is 'put to sleep' during a powercut, there is no OS sitting there to realize that the power is back! So I went looking in the BIOS, for a way to turn on the PC, but all it seems to offer is "Power State after power failure" with the options "Off, On, Last State". But this option is relevant only if I don't already have a UPS to manage the power situation (thank heavens, else the electricity issues here would have killed my PC long ago). I'm trying to automate this because these power failures happen all too often in a single day, and at daytime I am usually not at home to turn the PC on manually.

Therefore, that's where I'm stuck. I mean, powercut happens, PC goes into sleep mode. Power comes back, PC is still stuck in sleep mode. I'm looking for a way to somehow wake it up automatically when power is back. If you think there's a solution, please do post here, just about any suggestion is welcome. I'm hoping someone has an idea about this.
Posted ImageCheers !!!   Donate to MSFN and Help Keep This Site Running
||Please Read the Forum Rules||  Etiquette   || Welcome to MSFN - Forum Basics || Before posting
prathapml :: MSFN Supermod :: Private Message me if you ever have a problem while at MSFN


How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag
A question:
How do you get the PC "out of sleep" or "turn it again on" manually?

I mean, by pressing "any key", by "left or right clicking" the mouse, by pressing the "on/off" button of the case (I am assuming the PC has an ATX supply), or how?

jaclaz

#3
prathapml

prathapml

    Follow the rules please :-)

  • Patrons
  • 6,791 posts
  • OS:Windows 8 x64
  • Country: Country Flag
Hi jaclaz,
You are right, the PC has an ATX power supply. I turn it back on manually through either pressing the on/off button of case, or by pressing the "Wake up" key on my keyboard (standard feature in no-name multimedia keyboards with 115 keys). The BIOS offers options to wake up by pressing any key on keyboard or by a mouse-click, but I've currently disabled that option, because I felt that people at home might accidentally wake up the PC when I actually want it to sleep. But I could enable that option if it can somehow automate the wakeup procedure when power comes back.....
Posted ImageCheers !!!   Donate to MSFN and Help Keep This Site Running
||Please Read the Forum Rules||  Etiquette   || Welcome to MSFN - Forum Basics || Before posting
prathapml :: MSFN Supermod :: Private Message me if you ever have a problem while at MSFN

#4
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag
Remember that I am much more on the "electromechanical" side than on the "electronics" one when it comes to technical knowledge, but most probably what I am suggesting is also the simplest workaround, possibly an smallish electronic circuit based on the same idea could be easily made.

Get two wires out of the PC connected parallel to the on/off switch button, let's call them "switch" wires.
Get two wires out of the PC connected to 0 and +12V (as an example from a floppy or HD connector), let's call them "power" wires.
Have TWO relays, first with 240 V AC coil and second with 12 V DC coil.

Connect the two "switch" wires out of the PC to the normally open contact of first relay.
Connect the coil of first relay to mains (outside of the UPS) through a normally closed contact of second relay.
Connect the coil of second relay to the "power" wires.

I hope the above is clear enough, if you need I can draw a small schematics for it.

The principle is the following:
1. mains go out
2. mains returns, the coil of first relay is attracted, "virtually" pressing the power button
3.the ATX power gives +12 V, thus attracting the coil of second relay, which makes first relay go back to "open"
4. when mains goes out again (loop to 1. above) the 12V go out, closing the circuit to the coil of first relay, thus making it ready to send a "pulse" to the power switch when mains will come back

You will have the (very little) power consumption at the +12 V level when the PC is switched off as a side effect.

A capacitor may be needed to allow for some "wait" and avoid possible "bumps" due to mains going out and back in a very short time. :unsure:


jaclaz

#5
mark

mark

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 851 posts
@jaclaz-That sounds like a marketable item.


Mark

Posted Image


#6
jcarle

jcarle

    MSFN Master

  • Developer
  • 2,579 posts

@jaclaz-That sounds like a marketable item.


Mark

It's not... for a very simple reason. What's to guarantee that the PC would turn on? What if the power was back and a 2nd pressing of the power button was required? As the idea is presented, if power was restored and the relays actived (essentially pressing the power button) and the PC was still off, there would be no 2nd pressing of the button, the button would just stay stuck to ON.
Posted Image
Posted Image

#7
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag
@jcarle

Yep, but of course, designing a very small electronic board with a minimal "intelligence" and able to "loop" checking for the PC being on would be easy.

My post was just a basic idea of how this can be made the "poor man's" way, with something that you may find in your backyard "laboratory" in your preferred junkyard, or even in the litter bin. ;)

jaclaz

#8
rendrag

rendrag

    grrrrrr

  • Member
  • PipPipPipPip
  • 687 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Am I missing something here? Prathapml, have you tried the "On" option in the BIOS? I don't have the BE650's, but in my office we have Smart-UPSs (SUA1500RM2U), and I set up a schedule where each night they automatically shutdown the servers, then turn themselves off. Before we arrive in the office the following day, the UPSs turn back on, and in turn the servers turn back on as well because I set the BIOS option to "On" after power fail.

The Power State after Power Failure will react even if the OS was shut down properly because power failure on motherboards occurs if the motherboard loses power, not the OS. That's why you have a "Last State" option - if the PC was already off, leave it off... if it was on, turn it back on.

Give the ON option a shot and see how that works out.

The only scenario where this won't work is if the Battery Backup shuts your PC down, but the power comes back on before it shuts itself off. Since the computer hasn't lost power, the Power Failure option won't kick in.

Edited by rendrag, 25 September 2008 - 06:50 AM.

ASUS M4A78T-E | AMD Phenom II X4 905e 2.5GHz | 4x 2GB A-Data DDR3 1600 RAM | Saphire Radeon HD 7950 | 256GB Crucial M4 SSD | 1TB Western Digital Black | 256GB Seagate Barracuda | Samsung DVD Burner SH-S222L | 22" Samsung 226BW LCD | Creative Gigaworks S700 5.1 speakers


#9
prathapml

prathapml

    Follow the rules please :-)

  • Patrons
  • 6,791 posts
  • OS:Windows 8 x64
  • Country: Country Flag

.....because power failure on motherboards occurs if the motherboard loses power....

....Since the computer hasn't lost power, the Power Failure option won't kick in.

Thanks rendrag, but thats exactly the problem in this case. The PC/motherboard never does truly "lose power" because it only goes into sleep mode, and even then the UPS is supplying it with power 24 hours a day.

I might have to do it the way jaclaz is suggesting, it does seem workable. But then I'm lazy and wonder if there's an easier way to do it, through software or something? :P

The PowerChute software that comes with the APC UPS does not seem to offer any such functionality. So I then looked to see whether I could use Wake-On-LAN signals from my other desktop can solve this (the other desktop has a really huge battery to back it up, but its graphics card is power hungry so can't use it as download machine). But WOL only seems to work if the PC to be "woken up" is switched off or hibernated. The "sleeping" PC isn't able to be woken up, because as far as the network card knows, the PC is already "awake". Moreover, since I won't be at home, I need to send WOL signals over the Internet to my DSL router, which will forward the same to the sleeping PC, but WOL-over-Internet works very spottily if at all it works. And in any case, I have no way of knowing when power comes and goes if I'm not at home, plus WOL would again make this a manual way of doing it.
Posted ImageCheers !!!   Donate to MSFN and Help Keep This Site Running
||Please Read the Forum Rules||  Etiquette   || Welcome to MSFN - Forum Basics || Before posting
prathapml :: MSFN Supermod :: Private Message me if you ever have a problem while at MSFN

#10
rendrag

rendrag

    grrrrrr

  • Member
  • PipPipPipPip
  • 687 posts
  • OS:Windows 7 x64
  • Country: Country Flag
How soon after a power outage do you have the APC shut your computer down? If it doesn't run all the way down, then as you've noticed, it rides out the outage. If you have it run all the way down, it shouldn't have enough power to ride out the outage and should shut off... that will create the power failure your PC needs to see to have the BIOS option kick in

ASUS M4A78T-E | AMD Phenom II X4 905e 2.5GHz | 4x 2GB A-Data DDR3 1600 RAM | Saphire Radeon HD 7950 | 256GB Crucial M4 SSD | 1TB Western Digital Black | 256GB Seagate Barracuda | Samsung DVD Burner SH-S222L | 22" Samsung 226BW LCD | Creative Gigaworks S700 5.1 speakers


#11
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,702 posts
  • OS:Server 2012
  • Country: Country Flag

Donator

Hmmm does your BIOS support Power On by Timer? I have seen this option before but don't know how to use it.
MSFN RULES | GimageX HTA for PE 3.x | lol probloms
msfn2_zpsc37c7153.jpg

#12
jcarle

jcarle

    MSFN Master

  • Developer
  • 2,579 posts
I have an idea... if you like to do a bit of wizardry...

If you use a router, such as the Linksys WRT54GL, which gives you access to an SSH session, then you can login to your router and do work from there. It's possible to add a serial port to the WRT54GL (the PCB traces are there, you just need to solder a header). Using the serial port, you could attach a small serial controlled switch which you could attach to your PC. So, once everything was setup, you could something like "1) Login to your router using SSH then 2) run a command such as 'hitpower' that would flick the serial switch."
Posted Image
Posted Image

#13
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • OS:Windows 7 x64
  • Country: Country Flag

That sounds like a marketable item.

No. You don't want the hands of any average consumer near 240 volt mains! And any basic screw-up on their part (a single wire wrong) and they can fry their PC or worse (death is very much a possibility here, and you could easily be sued over it). And there are regulations and laws to respect when it comes to selling such items. It would have to be something safe, with proper protection/isolation/grounding/etc.

It's not... for a very simple reason. [snip]

There's plenty more reasons. Say, if you ever want to turn off/shut down your computer. This would automatically restart it. Then all kinds of issues possible in case of power bumps, brownouts and what not.

Yep, but of course, designing a very small electronic board with a minimal "intelligence" and able to "loop" checking for the PC being on would be easy.

Well, making a truly good product wouldn't quite be that easy for most people. Instead of just relays, some might be tempted to go with logic gates, timers and what not, but in the end, the best way to do it is using a microcontroller which would monitor the power and act accordingly. But still... Think protection against transients, isolation (and safety in general), perhaps monitoring when the user presses the power button to shut the PC down (and even then -- what about when you go start > shutdown? it couldn't know for sure; you'd likely have to just assume, seeing the PC turned itself off, without losing mains power). And then *good* code for the power monitoring during various events which most people couldn't easily simulate themselves... And you have to keep in mind not all countries use 240 volt power either (e.g. all of north america). There's a LOT of things that comes in play here.

(I work with embedded systems for a living)

I have an idea... if you like to do a bit of wizardry...

If you use a router, such as the Linksys WRT54GL, which gives you access to an SSH session, then you can login to your router and do work from there. It's possible to add a serial port to the WRT54GL (the PCB traces are there, you just need to solder a header). Using the serial port, you could attach a small serial controlled switch which you could attach to your PC. So, once everything was setup, you could something like "1) Login to your router using SSH then 2) run a command such as 'hitpower' that would flick the serial switch."

That's a pretty good idea, but it could be even simpler. If you have a WRT54GL, I'd hunt down a MIPS version of the "wol" binary (or compile one yourself). Then I'd schedule (cron job) a shell script that would ping the box say, every 5 minutes, and if it's not responsive, send a "magic packet" to it using the said wol binary (of course WOL must be enabled in your BIOS). Nothing to build/modify/hack/connect or anything. Only takes a couple minutes to setup, and it's real easy to test (once you get the wol command line right, try a simple script, then setup the cron job, turn PC off, and see if it kicks in/works).
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#14
jcarle

jcarle

    MSFN Master

  • Developer
  • 2,579 posts

That's a pretty good idea, but it could be even simpler. If you have a WRT54GL, I'd hunt down a MIPS version of the "wol" binary (or compile one yourself). Then I'd schedule (cron job) a shell script that would ping the box say, every 5 minutes, and if it's not responsive, send a "magic packet" to it using the said wol binary (of course WOL must be enabled in your BIOS). Nothing to build/modify/hack/connect or anything. Only takes a couple minutes to setup, and it's real easy to test (once you get the wol command line right, try a simple script, then setup the cron job, turn PC off, and see if it kicks in/works).

That's a pretty good idea but there's a simple flaw in the cron job, doing a voluntary shutdown would have the machine wake up by the cron job five minutes later. I'd take your idea and simply suggest that the wake on lan binary be scripted with the proper parameters in a batch file (do they have batch files in linux?) that could be executed via an SSH login.

ie: Box is down, log in to the router using SSH and then run the WOL batch file.

If you want to get really creative, you could execute the WOL directly from the router's web interface if you modified, say, the administration page that's served by the internal web browser.
Posted Image
Posted Image

#15
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • OS:Windows 7 x64
  • Country: Country Flag

doing a voluntary shutdown would have the machine wake up by the cron job five minutes later

I completely forgot about that one. Yes, you can script things (not using batch files though), but it might be tricky to make a script "know" when you actually mean to wake the machine or not.

One could get pretty creative, and make the computer reconfigure the router (sending commands over telnet or ssh, or deleting/creating/renaming a file over SCP/FTP or such which the script would look for before sending magic packets) on a voluntary shutdown so it doesn't send the magic packets anymore (not until you re-enable it when booting up).

SSH or telnet or the web interface works fine for WOL, but that's not automated unfortunately, he'd have to keep checking periodically if the box is up, and waking it up manually.

I don't think there's an easy answer unfortunately.

Edited by crahak, 25 September 2008 - 08:48 PM.

Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#16
jcarle

jcarle

    MSFN Master

  • Developer
  • 2,579 posts
It would seem that in reference to post #9 from the OP, running the script manually would not necessarily be a problem as long the OP could turn on the PC from an exterior location remotely.

Edited by jcarle, 25 September 2008 - 09:18 PM.

Posted Image
Posted Image

#17
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • OS:Windows 7 x64
  • Country: Country Flag
I have to admit I had completely skipped over that part. If it doesn't have to be automated then sure, it's a great deal easier. telnet/ssh/web admin interface works fine for WOL indeed.
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#18
prathapml

prathapml

    Follow the rules please :-)

  • Patrons
  • 6,791 posts
  • OS:Windows 8 x64
  • Country: Country Flag
Hmm, I would like it to be automated though, because even if I login to my router remotely, I have no way of finding out whether the power is back (because the router is backed up by a much larger battery and never loses power).

That power circuit suggested by jaclaz does sound workable, but I worry about power surges which might kill the PC (common in my area), and also because it does bring in a few complications of its own as mentioned by others above. So I'm back to the table again!
Posted ImageCheers !!!   Donate to MSFN and Help Keep This Site Running
||Please Read the Forum Rules||  Etiquette   || Welcome to MSFN - Forum Basics || Before posting
prathapml :: MSFN Supermod :: Private Message me if you ever have a problem while at MSFN

#19
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag

That power circuit suggested by jaclaz does sound workable, but I worry about power surges which might kill the PC (common in my area), and also because it does bring in a few complications of its own as mentioned by others above. So I'm back to the table again!


The suggestion was about the most basic something you could do.

Nothing prohibits you from using optocouplers or opto-isolators:
http://en.wikipedia....i/Opto-isolator

As well, nothing prevents you to operate through a self-powered device using a power adapter converter from mains (not connected to the UPS).

And again, nothing prevents you from controlling a simple "robotic arm" that simply pushes the power button, a LEGO one would do, if they make a cd-changer, you should be able to make a lousy button-pusher ;):
http://redfrontdoor....cd-changer.html
http://www.mocpages.com/moc.php/32433
http://it.youtube.co...h?v=gDZtokFTMss
http://www.techeblog...d-changer-robot

jaclaz

#20
jcarle

jcarle

    MSFN Master

  • Developer
  • 2,579 posts

Hmm, I would like it to be automated though, because even if I login to my router remotely, I have no way of finding out whether the power is back (because the router is backed up by a much larger battery and never loses power).

You could query your UPS for that.
Posted Image
Posted Image

#21
rendrag

rendrag

    grrrrrr

  • Member
  • PipPipPipPip
  • 687 posts
  • OS:Windows 7 x64
  • Country: Country Flag

You could query your UPS for that.


the Back-UPS UPS would have to be connected to the device your attempting to query from or it couldn't shut down the PC. I don't think it would work through a USB splitter, although it would be interesting to see

Edited by rendrag, 29 September 2008 - 09:31 AM.

ASUS M4A78T-E | AMD Phenom II X4 905e 2.5GHz | 4x 2GB A-Data DDR3 1600 RAM | Saphire Radeon HD 7950 | 256GB Crucial M4 SSD | 1TB Western Digital Black | 256GB Seagate Barracuda | Samsung DVD Burner SH-S222L | 22" Samsung 226BW LCD | Creative Gigaworks S700 5.1 speakers


#22
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag
This might not be of ANY use for you, but since I stumbled upon it by chance, I am posting it so that it may be of use to aome other members with similar (but not SAME) problem:
http://users.telenet...ff/poweroff.htm

Poweroff is a small program that allows you to control the power state of your pc.

It can power off, shutdown or reboot your pc, log you off, lock your workstation, go to standby or hibernation mode and even wake up another pc.

All actions can be done locally or on a remote pc (if they are running poweroff).

The action can be performed immediately or scheduled, by using a built-in scheduler.

All actions and options can be controlled by command line options. This way, you can easily integrate poweroff in your batch files.

It should run on Windows 95/98/Me/NT4.0/2000/XP, each with its own limitations. Beware that I haven’t tested the program on these operating systems, but in theory it should work on all of them…


jaclaz

#23
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag
I know it is a big BUMP, but just happened to find this:
http://www.remotepow...om/rps-atx2.htm
so the original idea wasn't as bad as it may have seemed ;).

jaclaz

Edited by jaclaz, 14 June 2011 - 01:36 PM.


#24
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,042 posts
  • OS:none specified
  • Country: Country Flag

Another huge BUMP :w00t:, but related :yes:, extremely simple and possibly useful (even if not specifically in this situation) in other similar situations:

http://www.pealefami.../tech/captrick/

 

jaclaz


  • Tripredacus likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN