Roul Salazar, Ph.D.

JHL Technologies, Inc.

 

Home Automation using .NET and Flash

  • Using .NET, asp.net to control X10 devices
  • Using Flash as a front end with .NET
  • Good business as people doing it (electricians, builders), not programers
  • Flash is nice to make "cool" interfaces.
  • VB.NET nice but C# can also be deployed using MONO on Linux.

 

Control anything

  • Lighting, blinds, windows, 97 different types, alarm, video, hvac, etc…

 

Multiple technologies

 

  • X10 - www.x10.com
    • Older, 256 devices
    • Uses AC wires
    • Classic X10 is one way but bi-directional version enabling status messages sent back to the user.
    • There is a wireless version of X10 is also populare.
    • Starter kits include a wireless tranceiver and remote control. Pro - $49.99
  • UPB - www.pcslighting.com
    • Universal Powerline Bus, 65k devices
    • Now bi directional
    • Need to get rid of surge protectors inside, put it on the input to the house
  • Z-Wave - www.zen-sys.com
    • Very nice, wireless unless you have a neighbor with the same code
  • Wthernet/Wi-Fi
    • Different vendors
  • Proprietary Home Automation
    • DON’T DO IT… just throwing money out the window

 

Sites to fine products and other information

 

X10 will be used for the demos

  • Starter kit
    • Radio frequency remote control
    • Tranceiver that plugs into an AC wall outlet
    • Lamp / appliance control modules
  • There is almost any x10 device that you can think of! We spent a LONG time talking about all the different types and versions of these devices.
  • Most devices between $10 and $30
  • Specialized devices can rise to over $100

 

X10 System

  • Has 2 basic components
    • One or more modules  that receives signals
    • A transceiver to send commands
  • Each device has a house code and a unit code
    • Make sure you write them down
    • Normally all local devices have the same house code
    • House code - A-P - 4 bits
    • Unit codes - 1-16 - 4 bits
    • To make a 8 bit codes
    • House codes might be used to divide into zones, bedroom, living room, etc..
    • If you make identical codes on two devices, they will both be controlled at the same time. Say two lamps would both go on and off.

 

  • Transmission
    • At every zero point crossing of the AC waveform, there is 200 msec during which X10 can send a 120khz 5 volt signal.
    • Pulse coded to carry unit codes and commands
    • Surge suppressors interfere with the xt10 modules
    • Suggest getting a house wide surge suppressor, ends up being cheaper than purchasing separate suppressors.

 

  • API's - Some of them suck!
    • Raul has written a few for different standards to make a nicer interface

 

  • Protocol
    • There are a set of fairly simple commands
    • Serial parameters, max rate is 4800 bps, no parity, 8 bits, stop bits
    • 2 bytes Header: code
      • 0-22 dims amount
      • Bit 2 always 1
      • Defines if following byte is function (1) or address (0)
      • E/S if following byte is extended transmission (1) or standard (0)
    • Function only operates for the house code

 

  • 1 byte checksum
  • 1 byte Acknowledge
  • 1 byte interface ready to receive
    • X55 says it is ready

 

  • ASP.net
    • Just select address, command on web page, post back and send codes from server when page is posted back.
    • Sample app turns the light in front on and off. Unfortunately the dimmer (brighter / dimmer) was hard wired to a different device for this presentation.

 

  • Firecracker Class
    • Shows a firecracker class with a 30 msec delay between commands (this is not a "speedy gonzales" protocol.
    • Implements a singleton
    • He used a RS232 class written by Corrado Cavalli, see www.itworks.it, Raul likes this, it is not perfect but pretty close! Note that .net 2.0 will have a serial class built in.
    • Simple sequence of  opening serial port, send commands, sleep for 30 msec, etc..
  • Used in simple console application
    • Console app
    • Create class, get an instance
    • Use the class to send a "turn on" command for example
    • Uses console app to run and turn on program and turn off program in same directory as the communcation.dll and the x10unified.dll (firecracker)

 

  • Flash implementation
    • Use the same communication and x10unified dll's
    • Fscommand and fscommand2 in flash to invoke these
    • Fscommand <name of program to execute>
    • Cannot look at flash code because license expired. Will send us the code….
    • Must add commands in fscommand subdirectory (for execution security)