Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Controlling Lights with .NET

  This article demonstrates how to control lights from your computer using custom applications written in Visual Basic and Visual C#.
Tony's Blog

Difficulty: Intermediate
Time Required: 1-3 hours
Cost: $50-$100
Software:
Hardware:
Download: Lost!
  • Video Tutorial: Controlling Lights with .NET

    Download Video

    Overview

    In the first DIY Tech video, I discussed the basics of the X10 home automation technology, and showed you how to add and replace switches to intelligently control lights in your home. In this video, I take it a step further and show you how to control lights from your computer using custom applications written with Microsoft Visual Basic 2005 Express Edition and Microsoft Visual C# 2005 Express Edition.

    To do this project, you'll need to buy a CM11a serial controller to connect your computer to your X10 power line network. Plug it into your computer's serial port, and then plug it into an available electrical outlet. That's all you need to do to control your lights from your computer by using the software that's included with the controller, but that software's not very flexible, and it certainly can't match the power of the .NET Framework.

    To enable you to communicate with the CM11a controller from .NET applications, you need a library. The most reliable library I have found is at CraigsCreations.com When you create your project, you'll need to add a reference to the X10 library and to the included serial port library. If you're not sure how to do this, don't worry, because I walk you through the process step-by-step in my videos.

    Now that you can control your lights and other appliances from a .NET Framework application, the creative possibilities are limitless. I've always been fascinated with devices that physically show real-life information, like the BT Ambient Orb. However, I'm frustrated with their limitations:

    • They can't be controlled from your local computer, but instead must be configured from a Web site
    • They can't be directly controlled by custom applications
    • They require you to pay a monthly fee for access to some types of data

    So, for my project (available in both C# and Visual Basic), I decided to build my own lamp to visually show how well a stock is performing. I took a very binary approach, as shown in Figure 1. Naturally, any colored lights will do-you can even build your own glowing orb by placing red and green strings of Christmas lights in an opaque plastic sphere.

    If the stock is going up, my application turns the green light on. If the stock is going down, it turns the red light on. To retrieve the stock information, my application queries the Delayed Stock Quote Web service at XMethods.net.

    This is a very simple demonstration that you can either build yourself or customize to your own needs. By adding just a few lines of code, you can use the red and green lights to indicate the weather forecast, traffic patterns, the number of visitors to your blog, or whether Slashdot has been updated. You can also turn lights on or off in varying degrees by using X10 dimming capabilities. That's the amazing thing about writing your own code-the power to control the exact behavior of your software.

    Get started now by downloading either Microsoft Visual Basic 2005 Express Edition or Microsoft Visual C# 2005 Express Edition, and then watching my video.

     

  • Follow the Discussion

    Remove this comment

    Remove this thread

    close

    Comments Closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
    or Contact Us and let us know.