Hello all...
I am
Michael Kidd-
I designed the following circuit for my Route66 player... First, I'll start with discussing how the circuit works, then how to configure your r66 box to work with the circuit, then I'll give ya the schematic. First download the latest version of upsd. This software monitors the serial port for signals from a ups system ( or my circuit ) to let it know the power status. When the 'Acc' line of the circuit goes hot ( i.e. you start your car, and the accessory wire has power, or you can hook it to the antenna out of your car stereo ... the blue wire... ) the circuit powers up the computer via K1. Note: K1 remains powered via CR2 and contacts of K2 after it is first energized... => Locking! Ok... so, the computer fires up, and starts the upsd software from your standard init scripts. At this point, the relay K3 is still on ( cause the Acc wire is still hot ) which shorts pins 4 & 6 to pin 1 => The computer knows power is good. When you turn off your car ( or power down your stereo ) the Acc line loses power and pins 4 & 6 are no longer shorted to pin 1 via the K3 contacts. This tells the software ( upsd ) that the car is off. Upsd sends a signal to the init system of the linux box ( which is included with all SysV initialization routines ) that power is going away. After a time ( determined by the number in your inittab .. explained later ) the linux box shuts down. I made my time to be 10 minutes. This usually gives me enough time to pump gas, run in and pay for it, and get back on the road with no down time on tunes. Now then, if the Acc goes hot again before the box starts the shutdown process, upsd sends another signal to the init routine that says 'Power is good' and the computer stays on. Otherwise, the computer shuts down. At the end of the shutdown cycle, the system send a signal via pin 7 to the circuit which starts the 555 timer count down. Now, the K5 relay is there to energize K4 which locks itself on. A little messy I know, but it works ok.. The Q1 transistor is there to act as a digital switch because the power of the serial port isn't enough to power the relay. So, the 555 timer powers up and counts down ( with the resistors I have in the circuit, You can adjust the delay from 0 to about 23 seconds. ) Giving the system enough time to finish its shutdown, then energizes K2 via the output pin 3 on the 555 timer. ( the diode CR3 is to reduce the kickback current of the relay so it doesn't harm the 555 timer ... inductive kick for you technical types.. ) When K2 is energized, the contacts open which removes power from K1. Thus, the system turns off... ( BTW. K4 which locks itself on... well, it looses power here also and resets since it's main line power is on the switched output of K1.) And, there you have it. Oh ya.. You really don't need LED1, but it's nice to see if the circuit is powered up, or down. And you don't really need LED2, but it lets you know when the 555 timer is energized ( therefore, counting down. ) R1, R2, & R3... well, they are just a little voltage divider network for LED1... and R5 & R6.. HAVE to be there... they control biasing of the transistor Q1. So, if your gonna ditch something, it can be LED2, LED1, R1, R2, & R3. Ok, ok... if you redesign the circuit to be solid state... and not use all these silly relays, by all means, share it... I'd do it, but this circuit drained my memory of circuit knowledge as it is.

Setup:
NOTE: This info is for RedHat and RedHat based distros... Mileage may vary elsewhere..

Unpack, compile and install upsd

tar -xzvf upsd-x.x.x.tgz
cd upsd-x.x.x
./configure
make
cp upsd /usr/bin
cp upsd.conf /etc
cp upsd.init /etc/rc.d/init.d/upsd

cd /etc/rc.d/rc3.d
ln -s S90upsd /etc/rc.d/init.d/upsd


The last line is crucial for the system to actually start upsd on startup. If you use RedHats setup utility to configure which services start on system boot, you can add the following line to the top of the /etc/rc.d/init.d/upsd file

# chkconfig: 3 90 90

Also, you do have to edit the /etc/rc.d/init.d/upsd file to configure your actual serial port... Its the line that says:

daemon upsd /dev/ttyS0

Modify the ttyS0 to whatever port this circuit will be on.
To get the system to shutdown the external circuit... ( and therefore power itself down ) you must add the following lines to your /etc/rc.d/init.d/halt script.

if [ "$command" = "halt" ]; then
   /usr/bin/upsd -k /dev/ttyS0
fi


Again, if your device is not on ttyS0, you'll have to modify this. These lines need to go right before the

eval $command $HALTARGS

line...

And now, the circuit!



  

Schematic IDDescriptionRadioShack
Part #
K112vdc Coil 10amp Relay275-248
K29vdc Coil 2amp Relay275-005
K3,K4,K512Vdc Coil 1amp Reed Relay275-233
CR1 - CR650V 1A Micromini Silicon Diode276-1101
LED1Bi-Color Orange/Green LED900-1550
LED2Red 12v LED276-209
R1,R2,R5,R6270 Ohm Resistor271-1112
R347 Ohm Resistor271-1105
R40 - 100k Ohm Potentiometer271-284
C1.01 microFarad Capacitor272-1065
C2220 microFarad Capacitor272-956
Q1NPN Silicon Transistor276-2058
555555 Timer276-1718
 Circuit Board276-170
 Various snips of wire... 
Well, That's all for now. Enjoy!