Project: webLightSwitch
The webLightSwitch project is a simple web-based interface for me to control the INSTEON lights within my house. I created the project to make a simple but useful system to use my home automation components.
Components
Here are the current components of my system:
BeagleBone
I wanted to use a BeagleBone because it is little and therefore doesn’t consume too much electricity. It has a USB host interface to allow it to communicate with the INSTEON gateway device. It has an Ethernet port to allow it to hook up to the Internet. It runs Linux so I can feel comfortable writing the necessary software to communicate with the INSTEON gateway device.
Smarthome USB INSTEON PowerLinc Modem
The Smarthome USB INSTEON PowerLinc Modem, abbreviated as PLM, plugs in to an electrical outlet. It transmits and receives INSTEON messages through the electrical wiring running through the house and via RF. (For those people familiar with X10, the INSTEON protocol is a next generation protocol that designed to be more reliable than X10 messaging.) The device also has a USB interface allowing a computer to transmit and receive INSTEON messages.
Smarthome INSTEON SwitchLinc Dimmer (Dual-Band)
The Smarthome INSTEON SwitchLinc Dimmer (Dual-Band) is wired into the household electrical wiring, replacing the existing light switch. It provides local control to turn on and off the outside lights on my house. It can also respond to INSTEON messages to turn on and off.
Smarthome LampLinc – INSTEON Plug-In Lamp Dimmer Module (Dual-Band)
The Smarthome LampLinc – INSTEON Plug-In Lamp Dimmer Module (Dual-Band) plugs in to an electrical outlet. It has a two prong outlet that a lamp is plugged into. This device provides local control via small buttons on its side to turn on and off power to the lamp. It can also respond to INSTEON messages to turn on and off.
Implementation
The BeagleBone is a relatively new device. When I received the device, I noticed that node.js was being used by the BeagleBone team to provide a JavaScript-based programming environment via Cloud9 and a library called Bonescript. This led me to decide to develop webLightSwitch as a node application written in JavaScript. I found that node would allow me to communicate with the PLM using node-serialport, a node module which provides access to serial ports. The PLM’s USB interface is an FTDI serial interface. The BeagleBone’s Linux version has the FTDI drivers built in so that plugging the USB cable into the BeagleBone causes the OS to create a serial device, like “/dev/ttyUSB0
“. The node-serialport API can transmit and receive serial data over the serial device. (Note that when installing node-serialport a small Unix C++ program is created to allow the JavaScript code to access the underlying serial device.)
In addition to sending and receiving serial data to the PLM, node can be used to implement a web server. So I created a simple JavaScript program, webLightSwitch, that provides a simple web interface to turn on or off the lamp or outside lights.
The program has some configuration options that can be changed to customize the program to control different/more/less INSTEON devices. The “On” and “Off” “buttons” are actually links. The webLightSwitch processes the HTTP GET request and finds the query parameter that identifies which device to control.
As seen in the screen shot above, which was taken from my Android based phone, the web interface is implemented using jQuery Mobile. I specifically wanted to be able to use my phone to control the outdoor lights so that I could turn them on and off from outside the house. Using jQuery Mobile provides a touch-optimized interface very easily. And the interface works quite well on my Kindle Fire tablet too. Using the Kindle Fire tablet I can turn the lamp on and off very conveniently when I go into the living room to read.
Source code: https://github.com/cubeinhabitant/webLightSwitch
Video: webLightSwitch Show & Tell
Did you have any problems to install the node-serialport true npm?
No, I had no problems installing node-serial through npm.
From a terminal window on the BeagleBone I just typed the standard:
npm install serialport
(Of course, npm was also installed on the BeagleBone.)
Cool project. I’m thinking about doing something similar.
Where did you get the info on the insteon protocol that you are sending to the serial port?
Hi, very impressive, thanks for sharing!
Would you be willing to sell a preloaded unit, ready to just plug & play? My techy skills are limite:(
I look forward to hearing from you,
Thanks,
> Where did you get the info on the insteon protocol that you are sending to the serial port?
This page has some informative links to Insteon protocol information: http://www.madreporite.com/insteon/insteon.html
In particular, this link has information about the Insteon commands: http://www.madreporite.com/insteon/commands.htm
So, for instance, here is a code snippet to turn a particular device, the “Nightstand” address (0x01, 0x02, 0x03), ON (0x11) to a full (0xFF) on level.
I hope this helps, David.
> Would you be willing to sell a preloaded unit, ready to just plug & play?
Replicating this particular project using the components described does require a bit of technical know-how.
Here are links for where to find the hardware and software described in the project post.
The INSTEON PowerLinc Modem is the critical component to control the actual INSTEON LampLinc (or other INSTEON controller). The BeagleBone could be replaced by any computer that has a USB host interface to connect with the INSTEON PowerLinc Modem.
If you are looking for a more “consumer” experience you may want to look into the “SmartLinc – INSTEON Central Controller”: http://www.smarthome.com/2412N/SmartLinc-INSTEON-Central-Controller/p.aspx
I have no experience with this device, but looking at the documentation the “Central Controller” is a plug-in device similar to the PowerLinc Modem but instead of a USB interface it has an Ethernet interface. You hook the Ethernet interface up to a WiFi router. You then communicate with the Central Controller via the Internet or WiFi. Smarthome provides an iPhone and Android app that also interacts with the “Central Controller.”
I hope this helps, Joseph.