Hi Folks,
Your expertise and wisdom may help me clarify thoughts on the following.
I'm contemplating buying a couple of UPS units, at the very cheap end, so no comms to the computer which could be used to initiate a programmed shutdown if the mains goes off.
So in turn I'm contemplating rigging a little circuit which would supply a signal to a serial port while the mains was on. The germ of the idea is to use one of those very cheap power converters which can deliver a DC voltage chosen from (say) 3V, 4.5V, 6V, 9V, 12V, and set it up so as to put say 12V between 2 pins on a serial port, when plugged directly into the mains.
Then it would be easy to have a little script running in the background which would monitor the lines on the serial port, and initiate a shutdown if the voltage dropped to zero for (say) more than a minute.
That's the bare bones of the idea, and indeed enough to define a basic soldering-iron job!
But I'm not sure I'm being circumspect enough here, so would welcome comment!
With thanks, and best wishes to all, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 31-Oct-06 Time: 20:26:50 ------------------------------ XFMail ------------------------------
Hi Ted
On Tuesday 31 October 2006 20:26, Ted Harding wrote:
Then it would be easy to have a little script running in the background which would monitor the lines on the serial port, and initiate a shutdown if the voltage dropped to zero for (say) more than a minute.
That's the bare bones of the idea, and indeed enough to define a basic soldering-iron job!
Throwing a couple more ideas in to the pot..
Both the serial port and the parallel port can be set up to trigger an interrupt on a change of state - A tiny $trivial kernel module could sit quietly in the background waiting to be triggered.. This module need do nothing more than to initiate your shutdown script in usr space.
Using interrupts has the advantage that you don't have to schedule a script to poll the status of a port... Why, it is even possible to write a user space program to handle the interrupt mechanism and saves you from the joys of programming in kernel space.
Which ever way you go, parallel port, or serial port, please use a plugin card and/or opto-isolators. Should anything nasty happen with the el-cheapo PSU, you won't lose the ports on the motherboard.
hrmm... Another idea if you're a whiz with the iron... The serial port can supply a few milliamps of +/-12V - Use this to power a small amplifier, the input being a pickup coil v.close to the cable feeding the UPS. Tuned to 50Hz, the signal would disappear in the event of a power failure.
Some reading material: http://people.redhat.com/twaugh/parport/parportbook.ps.gz has some info on user space interrupts with the parallel port..
Regards, Paul.
On Tue, Oct 31, 2006 at 08:26:53PM -0000, Ted Harding wrote:
I'm contemplating buying a couple of UPS units, at the very cheap end, so no comms to the computer which could be used to initiate a programmed shutdown if the mains goes off.
I'm wondering exactly how cheap you are looking at? given that you can get refurb UPS units (with new batteries) off ebay (or similar) so cheaply now which have serial or usb ports i'd think by the time you'd done the required fiddling just buying a recon unit with a serial port would be much cheaper/easier?
Adam
On Tue, Oct 31, 2006 at 09:30:34PM +0000, Adam Bower wrote:
On Tue, Oct 31, 2006 at 08:26:53PM -0000, Ted Harding wrote:
I'm contemplating buying a couple of UPS units, at the very cheap end, so no comms to the computer which could be used to initiate a programmed shutdown if the mains goes off.
I'm wondering exactly how cheap you are looking at? given that you can get refurb UPS units (with new batteries) off ebay (or similar) so cheaply now which have serial or usb ports i'd think by the time you'd done the required fiddling just buying a recon unit with a serial port would be much cheaper/easier?
Or indeed new:
http://www.ebuyer.com/UK/product/77131
(admittedly I bought mine when it was about £25 inc P&P)
Works with nut and will tell you voltage and so forth quite happily.
J.