This would be my first post here. I'm a
A+ Certified and an active
MCDST. Though I've seen enough idiots who hold these certifications; so it doesn't mean much.
I think I can give helpful input to this discussion.
I don't see why you guys are doing crazy stuff like the huge schematic MATRIXPC posted; when all we want is for the computer to shut off when the car does.
We should just have the serial port monitor ACC voltage and in the absense of such voltage execute shutdown through the operating system. Why mess with relays, components and the power pin headers on the motherboard at all when this can be 100% software driven ensuring a safe and graceful shutdown all the time?
And why pay, when I'm giving you the SOURCE CODE to a probably working program at the bottom of this post?! Compile the program for your computer yourself!
Here's a simple C program that would do the trick in Linux. In Windows, you might have to use some weird API, and surely windows.h, primarly why I hate Windows. It's a pain in the *** to program in.
This program must be run in root. I haven't had a chance to compile and test this program yet on a serial port to see if it works, but it'll have to run under root (since it uses the shutdown command.)
To get the serial port going, just plug in a +3vDC - +12vDC ACC wire in to pin 8 of your serial port. This program will do the rest. (You may have to ground the ports ground to your car chassis, and this is for sure if you're using an inverter)
To compile and run this program just save this code in a file called controller.c -- and type gcc -o controller controller.c -- To start this program simply type ./controller and you're set!
You might want to change this program so after it detects the absense of ACC it will start a countdown (5 minutes?) and at the end of such a countdown have it check again for ACC. If ACC is STILL not present, THEN do the shutdown command. This would be useful if you stop at 7-11, shut the car off, go inside, and them come back out -- since 5 minutes of the PC running off the battery wouldn't drain it (and so when you came back with your Slurpee, you wouldn't have to start the machine back up)
I came up with this idea pretty much myself; and my philosophy is KISS.
Code:
/*Copyright (C) 2006 Jonathan Kelley
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
You should be able to grab a copy of the license at http://www.gnu.org/copyleft/gpl.html
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
TO DUMB THIS LICENSE DOWN FOR THOSE WHO NEVER
HEARD OF THE GNU/GPL LICENSE BEFORE; IT CONTAINS
THESE 4 MAIN POINTS.
1) Not establish proprietary rights in the software (Once you
write it, everyone gets to enjoy it; altough the software
derrived from this code can be sold commercially);
2) Provide the source code (or access to the source code)
along with the object code. (Basically, requires you to reveal
or "open source" exactly how you make the software do
what it does upon user request);
3) That any programs based off, or using this code must also
be licensed by the GPL in full and include in the software
notice that the code is subject to the GPL (So that everyone
downstream can be warned); and
4) Accept the GPL code without warranties of any kind (You
got it for free, so you cannot complain if it does not work). */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <termios.h>
/* Main program. */
int main(int argc, char **argv)
{
int fd;
int status;
int set_bits = 6;
/* Open monitor device. */
if ((fd = open(argv[1], O_RDWR | O_NDELAY)) < 0) {
fprintf(stderr, "ar-2: %s: %s\n",
argv[1], strerror[errno]);
exit(1);
}
int x = 0;
for ( x = 0; x < 100000; x++ ) {
ioctl(fd, TIOCMSET, &set_bits);
ioctl(fd, TIOCMGET, &status);
if (status & TIOCM_CTS)
puts("ACC Voltage is present. Do nothing");
else
puts("ACC Voltage has been lost! Start shutdown process.");
system("shutdown -h now");
}
close(fd);
}