Subject: RE: Detecting a closed circuit
To: 'Kevin Sullivan' <ksulliva@psc.edu>
From: Rose, Brian <Brian.Rose@icn.siemens.com>
List: netbsd-help
Date: 12/05/2002 12:42:05
Note: this is just some off-the top of my head thinking. My facts may be a
little mixed up, but the concept should be sound.

Pin 10 on a parallel port triggers the associated interrupt when brought to
ground.

You could make a simple circuit something like this.

    --------------------- Pin 14 Autofeed (normally +5V)
    |
 Resistor (330 Ohm)
    |
    --------------------- Pin 10 IRQ
    |
    |
  Relay
    |
    |
    --------------------- Pin 18 GND
    

While the relay is open it will be at +5V. When it closes, pin 10 will be
brought to ground and your interrupt should be generated.

As far as the software is concerned, there are many ways to approach it. I
wrote a DOS program back in the day to do a similiar task. You may be able
to write a program that runs in the background waiting on input from
/dev/lpt1 (or whatever it is called). When you get input (when the interrupt
is triggered), then you can assume that the relay is closed and take
appropriate action.

The interrupt line should be a one-shot, so if it is held down for 10
minutes, you will only get one interrupt.

The hardware should be OK. No too sure about my software advice, tho.

Good luck and don't forget to post your solution!

> -----Original Message-----
> From: Kevin Sullivan [mailto:ksulliva@psc.edu]
> Sent: Thursday, December 05, 2002 10:59 AM
> To: netbsd-help@netbsd.org
> Subject: Detecting a closed circuit
> 
> 
> The UPS in our machine room provides a pair of wires which 
> are an open 
> circuit when on line power and a closed circuit when on 
> battery power.  I'd 
> like to detect this on a NetBSD/i386 box so sysadmins can be 
> notified via 
> pager when we go onto UPS.  I'd prefer if it could be detected on two 
> different boxes for failover, but one box would work.
> 
> Does anyone have any suggestions for how this could be done?
> 
> 	-Kevin
>