Internet Light Switch

Internet Light Switch - Description

This project is a device I built which allows the user to turn the lights in my bedroom on or off from the internet. The device connects to the power supply and parallel port of a computer and allows voltage to be sent from the parallel port to a transistor using science which opens up its gate to allow voltage from the power supply of the computer to flow to the desired device. In this case, the voltage is connected to a relay which is connected to the light switch in my room. The computer runs a server which activates the port upon receiving a connection from the internet.

This project consists of multiple parts: The device, and the server. The video to the right provides an overview of the project; the text below provides a more detailed explanation.

The Device

The device portion is independent of the server portion and can be reused for other tasks. Its purpose is to keep open a transistor while a 5 volt signal is output from the parallel port (or from any device capable of outputting five volts, such as batteries).

Internet lightswitch device.

The device consists essentially of two resistors and a transistor. The transistor is the small black piece in the middle. The transistor is connected to a pin on the parallel port on the input end. Another end of the transistor is connected to a plug I soldered which can plug into the standard power supply of a PC. This plug is designed to connect the 9v rail of the supply to the transistor. The last end of the transistor is connected to a relay in the wall. A relay essentially works as an electromagnet which, when turned on by a flowing voltage, will mechanically cause a switch to be pulled -- in this case, the switch bridges the light switch.

When voltage is received from the parallel port on the input end of the transistor, because of physics and other science the voltage from the power supply flows through the transistor to the relay in the wall, causing its mechanical switch to turn the light on. When the voltage is removed from the parallel port pin, the transistor closes, causing the voltage to from the PC's power supply to no longer flow to the relay, so the switch will turn off.

The translucent connector plugs into the PC's powersupply, the black connector plugs into the wire soldered to the relay in the wall, and the two silver metal pins on the sides clip onto the parallel port cable pins.

The Server

In order to allow the user to activate the parallel port voltage from the internet, a server application runs to listen for connections.

The server is written from scratch in C++ and constantly listens for connections on a specific port, and then forks the connection. The server does not usually respond to connection attempts, but upon receiving a connection on the port, the server will run a function which writes directly to the parallel port on the computer so that voltage is sent to the device.

The server does not check at all what information is sent from the client. It will activate the device no matter what, as long as a connection attempt was received on the correct port. The server will negate the current state of the voltage being sent through the device -- if the device is currently deactivated, the server will activate it, and if it is activated, the server will deactivate it. Repeatedly attempting to connect to the server will turn the lights on and off over and over.

Because the information in the connection attempt is not parsed, the device can be activated with the simplest connection -- even from old flip phones from the 90's. However, there is also no security so the server is not practical for actual use other than to build it and then make a website describing how I built it. In fact, my dad won't let me even keep it connected because he says it's a fire hazard.


Internet Light Switch Demonstration Video