How to switch power sockets using a modified internet router
I managed to use the relay, that comes built-in with most internet routers, in the present case a T-Com Speedport W500V, to switch the power of a 230 volts AC power socket on and off. Since all routers have GPIO, they are all in principle capable of switching relays. Software-controlled relay switching can be very useful, especially thinking of home automation and all that kind of remote control stuff.
The relay is controlled by the router's firmware through a GPIO pin and can be switched by console tools or even via a nice web interface. All you need is a suitable Linux firmware, to gain the full control over the router's hardware (e.g. Bitswitcher or OpenWRT).
Maximum load of the end device connected to the switched socket is 2A at 250VAC. If you connect both switches of the relay to one socket, the maximum load should add up to 4A (2A on each switch). Don't exceed the maximum load, not to overheat the rather thin wires.
- in different routers, relays of the same type but from different manufacturers were used:
- they are switched by a 5.5VDC on-board GPIO signal (relay resistance: 160 Ohm)
- 2 relay sockets are in place, both are connected to GPIO, but only one comes actually equipped with a relay
- Fotos are on GitHub: https://github.com/matthiasbock/Bitswitcher-GPIO/tree/master/pictures/Speedport%20W500V%20switching%20power%20sockets
Quick'n'Dirty: The telephone cable variant
If you don't want (or can't) solder a cable onto the router's mainboard, there is also this nice possibility: Use a modified telephone cable!
- disrupt the connection between the switched side of the relay and the mainboard's circuits, e.g. by removing the black diode and the two yellow SMD capacitors (mainboard's back side, close to the relay sockets)
- get a telephone cable, TAE on one side and RJ11 on the other
- cut the telephone cable in half
- connect the two TAE pins, that are connected to the switched side of the relay on the mainboard, to one of the two 230VAC power source pins
- connect the two RJ11 pins, that are connected to the switched side of the relay, to the power socket, that you wish to switch
- connect the other 230VAC power source pin and also the protection pin (yellow-green striped) to the power socket
That was it!
Now the relay, which normally switches the telephone stuff, switches your power socket on and off. Be careful with the maximum current! You're using the thin mainboard's connection lines, which will heat up quickly upon high continuous currents. If you smell plastic and/or your router starts to smoke, the current is too high. Switch off immediately then, not to cause a fire!
- system: Bitswitcher, an alternate Linux firmware for the W500V
- Pin 7
Software: scolopender's tutorial for Bitswitcher modification
- check out the latst version of bitswitcher from the SourceForge repo
- add extio.c to bitswitcher/dev_tree/bcmdrivers/opensource/char/board/bcm963xx/imp1
- in the same folder patch the Makefile:
obj-y := board.o cfiflash.o bcm63xx_flash.o bcm63xx_led.o extio.o
- extend bitswitcher/dev_tree/bs_extra/start_scripts/preinit.sh by
mknod /dev/extout0 c 200 0 mknod /dev/extout1 c 200 1 chmod 666 /dev/extout* mknod /dev/extin0 c 200 2 chmod 444 /dev/extin*
- patch Makefile to disable VoIP or
- scolopender has already done it in 2011: http://www.ip-phone-forum.de/showthread.php?t=236541
- check out the GitHub project: https://github.com/matthiasbock/Bitswitcher-GPIO
- sparkfun.com: Controlling Big, Mean, Devices