How To: Turn Your House Lights On & Off Using the Internet

Turn Your House Lights On & Off Using the Internet

Haven't you ever wanted to live in a futuristic home? I think that homes are headed towards an era where they will be controlled by our computers and smartphones. No longer will you have to find your keys to unlock your door, or wait until you get home to monitor your security, because X10 is here.

X10 allows powerline modules to communicate via the existing 120v AC wiring in your home. Simply plug or wire in an X10 compatible module into your AC supply and it can communicate with any other X10 device in your home, giving you remote control of virtually any light, appliance, or other contraptions that you may have invented. No special costly rewiring is necessary.

X10 has been around since the '70s, so it is a tried and true tested technology. Up to 256 different addresses are available so that means at least 256 different devices can potentially be controlled. X10 hasn't been implemented in homes yet for reasons that I do not know. It's a great technology, and can allow us to do an infinite number of automated tasks in our homes.

Today, Null Byte is going to take a hack at controlling our home lights via our computers with the X10 kit.

What You Need

  • The X10 FireCracker (for communication to the computer) and the TM751 receiver (for the power jack). You can purchase the kit from the X10 website for $24.99.
  • An Apache web server with PHP installed. You can find a tutorial here for setting up Apache on both Linux and Windows.
  • Light.exe, a program that sends signals over the com. port. Once the signals are received, it then reads and adjusts the light connected to it accordingly. It even has support for dimming lights.

Step 1 Create a Web Interface

After you connect the X10 equipment and have everything installed, with a light connected, we need to create a webpage to host on our server that sends signals over the com. port.

  1. Open up a text editor.
  2. Paste this HTML and PHP code into it.


if(isset($_GET['light'])) {
   if ($_GET['light'] == "on") {
      system("light.exe c1a1+");
   if ($_GET['light'] == "off") {
      system("light.exe c1a1-");

<a href="index.php?light=on">On</a> /
<a href="index.php?light=off">Off</a>


3.  Save the document as index.php. Make sure you save it as type "all files", or you will end up with double file extensions. Throw the index.php file and light.exe into your Apache directory.

Step 2 Enable Port Forwarding

We need to forward the port that Apache runs on so that we can access this webpage from an external network (unless you do not desire to run it away from home).

  1. Click Start. In the search, type cmd and hit Enter. In the prompt, type ipconfig, and it will list your default gateway and IP address. Take note of both.
  2. Go to the router configuration page. The default address is Type that in your browser address bar, or the one you got from the previous step.
  3. Type in your Username and Password for the router. Default is usually admin:password.
  4. Click Port Forwarding somewhere on the page—all of them look different. Here is how mine looked:Mastering Security, Part 2: How to Create a Home VPN Tunnel
  5. For me, I needed to click Port Forwarding on the router page. Set the host to your computer's IP address that we previously noted, and the port to 80.
  6. Go to What Is My IP Address and write down your IP. This IP is the address that we need to access the site and control the lights.

Step 3 Test the Page

Open up your new webpage and simple click the link that says on to turn the lights on, and off for off. How easy!

Controlling your home via the internet and impressing your friends is well worth the price tag!

Be a Part of Null Byte!

Just updated your iPhone? You'll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what's new and changed on your iPhone with the iOS 17.5 update.

Photo by Thomas Hawk 


X10 systems are great. But I think it's not a standard installation in new home construction because it's too expensive. Let's say you have 20 lights you're installing in a new home, each controlled by a separate switch. You can buy a twenty pack of regular single-poles for five bucks, which is a lot cheaper than buying specific X10 compatible switches to be controlled via the radio signal, which you'd be lucky to get at $10 each. That's a $195 difference just for light switches. Maybe if X10 modules and switches were cheaper, it'd be more common in newer installations.

Plus, you need to buy all the gear to control the switches, at least a couple transceivers and a controller, whereas for regular switches… you just need the switches. Also, it costs more for X10 receptacles and modules that control appliances and lights with ballasts.

X10 installations are more common outside of North American, where they have 240v systems in homes. In 120v systems, it gets tricky because you need to make sure the transceiver and module are on the same phase. Granted, it should be an easy task to get right in new home construction. This problems is really only for add-on modules, like the one in your kit.

Yeah, that's true. I just really don't see why things like this aren't implemented in homes now. It is such an old/cheap technology, yet convenient beyond belief. It wouldn't be hard to make something to control all of the devices (maybe via a UUID or MAC) and then just have a transceiver on each outlet to control things. I could see future homes even having one controller and each outlet just has a computer in that takes command from the controller. Such simple ideas, why aren't they being used :(.

Yeah... I'd love to see it implemented as the standard in new home constructions, if it could be done well. X10 is the least costly home automation system, compared to others, but it has fallbacks. Interference in the lines can generate noise, making it hard for the signal to make it to the receiver modules, and anything that runs a motor can make this "noise" in the line. And it doesn't help that the common residential wiring used is unshielded, meaning items not even connected to the same line can cause interference. Interference can even come from outside the home. Also, X10 is relatively slow, so it's not as quick as flipping on a light switch. X10 is definitely one of the best options for retrofitting, but I can see why it hasn't hit new home construction yet. Someone willing to spend the money on a smart home would probably prefer something with less fallbacks.

Share Your Thoughts

  • Hot
  • Latest