Using a COM port control lines to execute a shutdown routine

Discussion in 'Programmer's Corner' started by Llamarama, Dec 10, 2011.

  1. Llamarama

    Thread Starter Active Member

    Feb 1, 2010
    Hello everyone, I have built a simple mini itx computer over the past few days that runs off a 12V SLA battery. I have devised a simple circuit that monitors the battery's output level via a comparator. The logic goes low when the battery voltage reaches 11.5V, from a fully charged voltage of roughly 13V.

    I was wondering if it was possible to use the COM port's control lines and a level converter of some kind (Probably a signal transistor) to automatically shut down the computer safely rather than just let it brown out.

    If this is possible, can anyone give me any pointers as this will be my first project to use any code. I'm more of a hardware kind of guy. :)

    Thanks for any help :)

    EDIT - What would be the best language to use? would some kind of Javascript, Python script or a good old fashioned Batch script be best?
    Last edited: Dec 10, 2011
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    You could probably use the cable and software from an APC SmartUPS, most people don't connect the auto shutdown feature.

    Then it would just be a matter of finding what signals are on the phone jack side to initiate shutdown via the APC power software on the machine. Windows supports power down via UPS through serial port as well, though I don't know what the protocol is.

    Some searching should lead you to the answer to that one.
  3. Llamarama

    Thread Starter Active Member

    Feb 1, 2010
    Thanks Thatoneguy, I heard that some UPS's use limple switching to indicate what state they're in, but now that I have a name to wo with it's made it much easier! Many thanks! :)
  4. FBorges22

    Senior Member

    Sep 11, 2008

    Here is a link describing the APC's protocol.

    You could write a small program to monitor the battery condition and initiate the shutdown procedure.

    Few years ago I worked on a project similar to this. I could help with this one, sending a few tips, if you wish.
  5. Llamarama

    Thread Starter Active Member

    Feb 1, 2010
    Thank's for that Fborges! That's certainly made things easier. I'm working on this with my Computer Science professor at Uni so now that we know the protocol we should probably be able to work something out! :)