66% or better

Suspend in motion


Reader [Brien Schultz] didn’t like his laptop suspending every time he closed the lid to move around the house or to a different work area, so he turned that feature off. Of course that just led to him forgetting to put the thing to sleep when he really needed to, like when he was walking around all day with it in his backpack. To solve his self inflicted problem (common cause of many hacks) he wrote a .NET program to monitor the laptop’s accelerometer. The accelerometer is usually used to park the hard drive heads in case the laptop is falling (it’s also used for hilarity). If BedTime detects that the laptop is in motion, but is not being used it starts a countdown and eventually puts the laptop to sleep. Brien isn’t using the “sleep after X minutes” option because it would put the machine to sleep while it was open and he was just distracted for a few moments. Demo video after the break.

Comments

  1. giskard says:

    cool, but everytime i see something like this i have to ask why in the hell would anybody use .net unless it was absolutely necessary

  2. Ross Peters says:

    Absolutely brilliant! I have also forgotten to turn off my laptop >< and this is an almost flawless method to solve it. Putting accelerometers to a real good use… now just to make a laptop version of a wiimote…

  3. Crash says:

    Eliot, where have you been?

  4. binary says:

    Wicked!, but….does it run on Linux :-P ?

  5. crgwbr says:

    cool & useful; a combination almost never seen on hack-a-day.

  6. Forrest says:

    it seems kind of counterintuitive. why not just make it go to sleep after a preset time when it is closed? how does the motion sensor help?

  7. Justin says:

    That is really cool. I would love to see a Mac version made.

  8. Tyler says:

    Pretty cool, but he referred to Linux as a “filthy penguin”. Geek card revoked.

  9. YoYo-Pete says:

    This is a really great product. ::Applause::

    My suggestion is to add a feature that allows it to go into Hibernation instead of sleep. As sleep does use power and it will drain over time.

    P.S. I have to agree with #3. I still havent figured it all out as a developer, but from a system viewpoint, it’s supposed to make everything easier.

    #4, it requires Dot.Net Framework, so no linux.

  10. momotarosan says:

    here is a blog on the use of accelerometer for controlling Google Maps http://bulknews.typepad.com/blog/2006/06/control_google_.html

  11. Jeff says:

    #8: What about the Mono Project? I haven’t got that up and running yet, as I just switched to Ubuntu a few weeks ago, but it may well work on Linux with some tweaking…

  12. Eliot says:

    I’m still in charge over here, but I work fulltime at Netscape.com and just come over to fill in for Will from time to time.

  13. japroach says:

    “it seems kind of counterintuitive. why not just make it go to sleep after a preset time when it is closed? how does the motion sensor help?”

    I don’t really get the point of it either. OK you close the lid and its moving, so it sets a 5min timer to go to sleep (long enough to get somewhere within the house).

    Now you close the lid later but its not moving, should it sleep then as well? Seems like it should.

    The idea and execution is cool, but it isn’t exactly a “brilliant” hack.

  14. Patman says:

    yeah i wouldnt say that linux is the best OS out there, but it ain’t some crack-dealin’ weed-smokin’ pimp! I think that because of its 3rd party capabilities Linux isnt that bad (granted of course that you have Windows XP or Vista on your computer as well.)

    sure beats Mac’s iCrap series!

  15. Trimzulu says:

    You guys are missing the point. He DOESN’T want the laptop sleeping when he just shuts the lid. A lot of people use their laptops as their primary computers. I shut my screen a lot while still running applications in the background. Sleeping would kill those, this lets me not sleep all the time while still being able to pick up my laptop and go without worrying about the battery being dead when I get there.

  16. Mikoangelo says:

    Why, oh why, not just set a sleep timer to ~3 minutes if the lid is closed?

    And what if I were to close the lid, and put the computer over in the corner of $somewhere, only to forget it for a couple of hours? Problem unsolved!

  17. Ok, so I finally got binaries and source uploaded. This is ALPHA!!! It might not work properly, I haven’t tested it properly yet.

    Binaries for ZIP people…
    http://www.suite304.com/BedTimeAlpha.zip

    And for the WinRAR people…
    http://www.suite304.com/BedTimeAlpha.rar

    Source for my .Net homies…
    http://www.suite304.com/BedTimeSource.zip

    If you want to help me make this better I’d appriciate it. This version is very basic and simple (as you will see).

  18. Burnzee says:

    Great Idea. Pity I can’t get it to work. Got Toshiba Satellite A100 running Xp. Only eight months old.

  19. I LOVE how linux does hardware. They did things right a long time ago.

  20. Oh, and towards the convo on this running on Linux, Apple, etc. …This program is so simple I could easily write it in C, C++, Java, etc. so I don’t think platforms will be a problem. I just need to get specs on all the APIs/drivers for accelerometers.

  21. Kori says:

    That can be but not sure!

  22. Johannes Geiger says:

    This is creat idea. I’ve tryed to find a solution for FSC Notebooks. Google gives me these helpfull links:
    http://nich.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=amonth%3d3%26ayear%3d2007
    http://geekswithblogs.net/dirksblog/articles/54935.aspx (german)
    http://msdn2.microsoft.com/En-US/library/aa363216.aspx

    finaly with that Information it was posible to write/modify a simple sample code.

    /* Reads Acceleration Sensor Values out of FSC Liefebook T4215
    and perhaps other FSC Notebooks that work with Shock Sensor
    Utility ( FJSSGUI.exe + FJSSDMN.exe )
    Sensor Description:
    http://www.fujitsu.com/sg/services/computing/pc/einfo/shock-sensor/

    Thanks to Nicholai Yu who did de reverse engineering:
    http://nich.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=amonth%3d3%26ayear%3d2007
    and MSDN for their example source which I’ve just modified a little bit.
    http://msdn2.microsoft.com/En-US/library/aa363216.aspx

    To Port this to other HDD Sensors try http://www.rohitab.com/apimonitor/ and monitor
    the DeviceIoControl calls from an existing Sensor App.

    Note: This code is only tested on one maschine.
    !!!!!!Use it on your own risk!!!!!! and report if it works.
    Sorry about my bad english, have fun with the app.
    (I hope sombody built some nice tools or games like a port of this
    http://www.weiblespiele.de/images/79050.jpg for tablet PC ;)

    Some Keywords for Google:
    Shock Sensor Utility, hdd, harddisk, shock, Fujitsu, source, c,
    accelerometer, acceleration, motion, gyro, tilt, pan, protection
    */

    #include
    #include
    #include

    BOOL GetAccel(char *AccValue)
    {
    HANDLE hDevice; // handle to the drive to be examined
    BOOL bResult; // results flag
    DWORD junk; // discard results

    hDevice = CreateFile(TEXT(“\\\\.\\PhysicalDrive0″), // drive
    0, // no access to the drive
    FILE_SHARE_READ | // share mode
    FILE_SHARE_WRITE,
    NULL, // default security attributes
    OPEN_EXISTING, // disposition
    0, // file attributes
    NULL); // do not copy file attributes

    if (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive
    {
    return (FALSE);
    }

    bResult = DeviceIoControl(hDevice, // device to be queried
    0×220208, // operation to perform

  23. G-lant says:

    Hey this seems like an amazing idea. But I have one question. Im getting my new Mac laptop soon, will this work with Mac?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s