Controlling Lights with .NET
- Posted: Oct 31, 2006 at 3:39 PM
- 6,505 Views
- 11 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
| This article demonstrates how to control lights from your computer using custom applications written in Visual Basic and Visual C#. |
|
|
Difficulty: Intermediate
Time Required:
1-3 hours
Cost: $50-$100
Software:
Hardware:
Download: Lost!
|
|
Video Tutorial: Controlling Lights with .NET
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:
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.
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.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
Summer is just around the corner, with lots of free time to explore new ideas. Here are some fun ways
To control lights via the USB, you can get ambient light system from http://www.a-r-e.nl
It comes with an Automatic code generator for C#, C++, and VB among others.
You can also turn it on/off via the Microsoft remote control.
Do you kwon where I can buy a X10 serial controller for italy ?
The link for the code is dead please someone tell me where the new link is. Thanks guys
looking into this for you
He i was wondering if the CM11A needs any driver? I have been playing with mine and I can never seem to get the controller to send anything.
Nope, it is a serial port device. If you have a Serial to USB adapter, that may require a driver however
oops... just figured out that I can download it from tony's blog as well: http://www.northrup.org/downloads/x10lights-cs.zip
For VB use this link:
www.northrup.org/.../x10lights-vb.zip
Do you know of anybody making a library for the replacement of the CM17A ... CM19A ( usb rf PC Transceiver ... )
Thanks
Marc
@Marc this is an old article, right now we have zero plans to update it. If you'd like to create an updated version of it, please contact me and we'll chat on what you're thinking of doing
Remove this comment
Remove this thread
close