Relay card 8fa +Power-Manager
I've made software for managing of the 8fa relay
card (approx. 40 EUR), from www.conrad.de with posix commands via
a serial port:
relais.c
README (german)
Tested with Linux, should work with every posix conforming
operating system and Cygwin.
The 8 relays can be used up to 250 V AC, 5 A.
The pictures below do show the 8fa in a Power-Manager (approx.
40 EUR), also from conrad, with a serial port plug socket which is isolated
from the chassis. The 8fa ground is connected with a (560 Ohm) resistor
to the protective earth conductor to avoid floating and a high ripple
current:







Building this relay box takes about one hour and less than 100 Euro.
The 8fa relay card can also be powered from the Firewire bus, instead from
an AC adapter.
Update July 2007
I found the bug that using the program (relais) only with the -s or -r parameter did not
work correct and eleminated that bug.
Because the 8fa has no power LED i added one with an integrated series resistor
(for 5 V):

For viewing the power LED and the status LEDs i added a (quick and dirty) window, made of two
self-adhesive transparent foils which are glued together:

For anti-interference and electrical safety i marked the two power wires at the connecter plug so
that the wire with the phase (P) is switched by the relays and the neutral line (N)
is not switched:

For using this feature, you have to measure where the phase and where the neutral line is in
the plug socket.
For discharging of the devices at the AC outputs, e. g. devices with an
anti-interference capacitor or an EMI filter without a discharge resistor,
i added a (2.7 MOhm) discharge resistor from the N wire to the protective earth conductor:

and also a discharge resistor (2.7 MOhm) from each P output to the protective earth conductor:

This ensures a discharging of every wire of the devices at the AC output
to the protective earth conductor when N and P are connected right and the relay
or associated switch is switched off.
A typical application of such a relay card is powercycling a network device such as a Router, DSL
Modem, PC, etc. which will hang every now and then.
An example are DSL routers which do hang instantly when they try to resolve
ULRs longer than 50 bytes; e. g. from ebay:
http://www.tecchannel.de/netzwerk/extra/402395/
Another example can be found here (in german): http://www.schlager.bz/projekte/powerplug/
Powercycling the DSL modem also helps against many DSLAM bugs and against
a modem hangup because of too many connections, e. g. caused by a Weberver like
Apache or an Onion Router like Tor; this can be found in the Tor documentation.
Because sometimes the cause of the hanging is in the OS or a driver, the software which
manages the modem must also have a software watchdog for a reboot.
Therefore i'm using the script checkdsl.sh together with this
/etc/inittab line:
12:2345:respawn:/root/bin/checkdsl >> /var/log/checkdsl 2>&1
and some lines in /etc/crontab like this:
-7 0 * * * root /root/bin/stopdsl.sh
-7 12 * * * root /root/bin/stopdsl.sh
with the scripts stopdsl.sh,
modemon.sh, modemoff.sh and
modem_powercycle.sh.
The first script checkdsl.sh does a modem power cycle after every 5
consecutively unsuccessful dial-up tries and a reboot after 31 consecutively unsuccessful dial-up
tries. With this configuration and a medium quality DSL connection checkdsl.sh
does about two modem powercycles per week and a reboot after about 50 days
uptime with an Sphairon AR871. Since i'm using an AVM Fritzbox 7170 with DSL
laboratory firmware i have only about one powercycle per week, no more than one
powercycle in a row and therefore no reboot.
By default, after power up, the relays of the 8fa and most other relay cards
are off. This can be changed by replacing the monostable on-off switching relay
by a monostable commutating relay and using the deault-on output. But this
inverts the output behavior and the driver has to be adjusted.
A description of some other relay cards can be found here: http://www.bksoft.de/licht24pro.htm
Update January 2008
An alternative is using a remote controllable multiple socket outlet
via ethernet, because at the beginning of 2008 they do cost only about 120 Euro:
MS SDL PM211MIP :: Infratec Master/Slave Steckdosenleiste IP
At the vendor itself the PM 211-MIP
does cost 145 Euro:
http://www.infratec-ag.de/index.php?option=com_wrapper&Itemid=341&lang=en
At reichelt.de you can also find a dimmable socket outlet with an ethernet
interface, the ALLNET ALL3076 (99 Euro).
Multiple socket outlet with Ethernet, Webserver, ssh Server etc., which also do
monitor and/or log the current/power consumption and AC voltage are availible
from vendors like Raritan, Rittal and Infratec, e. g. at the (german) e-tailer
Fröhlich +Walter:http://www.f-u-w.de/de/storefront.aspx?katalogID=236&kido=231.
You can see the prices via "Demozugang".
Later Updates
February 2008: With my USB-RS232 adapter (USB to Serial Adapter) with an Pl2303
chip (driver pl2303) i've got the problem
that this adapter does nothing after somes hours and a user (Stephan R.)
reported defect checksums and lost bytes with such an adapter while
communication with the 8fa works without problems over an onboard serial port.
I'm using an USB to Serial Adapter with an FTDI chip (driver ftdi_sio, chip
FT232BM) without problems.
March 2008: Because of the bad connection with dozens disconnects per day, i switched from doing
deterministic DSL reconnections via crontab to disconnects via a countdown in the checksl
skript. The countdown gets resetted by every new connection.
Via Telnet i can see that the FritzBox often hangs with a load greater than 10;
it seems the firmware has a buil-in fork bomb.
On my main client PC i'm using a skript which detects the disconnects
and shows a parallel countdown on this PC. Now the disconnects from my router
do vary, but i can see when it will do the next planned disconnect.