Search Site

Sponsored Links

Integrating Lava Lamps to CruiseControl

By Pak-Tjun Chin, on 31-10-2008 10:51

Views : 5846    

Favoured : 205


Overview

Over the past couple of weeks or so, I came across an article in the Internet, Pragmatic Automation, that showed how easy it was to integrate red and green lava lamps to radiate the status of their scheduled build for CruiseControl . This got me really excited as the idea of having a couple of hot bubbling lava lamps next to the continuous build server was cool!

In this article, I'd be sharing my experiences on getting the lava lamps to work, which was not as easy as I thought...read on.
 

What You'll Need

The first thing you'd need is X10 automation equipment. I went to the on-line store recommended by Pragmatic Automation but realised that they do not deliver to Australia. Thus, I Googled for local stores that stocked home automation products and came across Envious Technology that stocked up on all the X10 components that I needed:
  

Item Code

X10 Component

Price (incl.GST)

CM19 X10 Radio Frequency Transmitter/Receiver module for PC AUD $44.00
TM3 Radio Frequency Transceiver Interface Module AUD $37.40
LM12 Lamp Module Receiver - plug in AUD $37.40

The total amount worked out to be AUD$131.97, in which I happily paid with my Corporate Card (my people leader --> not so happy). The items were shipped the ext day and I got the package a few days later.
 

 
X10 Box X10 Transceiver Module
The delivery package
X10 Transcevier Module
 
X10 Lamp Module X10 RF Transmitter/Receiver
X10 Lamp Module X10 RF Transmitter/Receiver
 
Note that I do not receive any commission from Envious Technology. If you are able to source for similar products anywhere else, please feel free to do so.

Now, what are the above X10 automation devices for? Well, the RF Transmitter/Receiver module, a.k.a. FireCracker Computer Interface, sends and receives Wireless Radio Frequency (RF) signals from your PC to an X10 Transceiver. This device adheres to the FireCracker (CM17A) Communications Specification. However, I would like to stess that the model number of the device I bought is not a CM17A, but a CM19A model. CM19A is similar to a CM17A bar one difference. CM17A models have a Serial (RS232) interface whilest CM19A models have a USB interface.

The article from Pragmatic Automation uses a CM17A model that allows for code utilizing Java Communications API to send bits out over the serial port and into the Firecracker Computer Interface. So, why did I not purchase a CM17A model? Apparently, I have been informed that the CM17A model is not suited for usage in Australia due to different current frequency requirements of the model. Thus, I went for the CM19A model. Further in this article, I will share some of the issues I had with integrating to the FireCracker Computer Interface via a USB interface.

You would need to obtain a copy of the xfire software that contains a executable to a Windows application which allows for X10 device control.

The couple of other X10 devices are pretty self-explanatory. The X10 transcevier module interfaces up to 16 RF devices and remotes to your X10 system. It also doubles as a plug-in appliance Receiver module. The X10 lamp module allows for automated control to your plug-in lamps.
 

Next, I went looking for lava lamps. I went to a few lighting shops as well as some retail outlets like Target but could not find any. Finally, a work colleague asked me to go to a What's New chain. I went down to one of its outlets at Knox Shopping Centre and got myself a couple of lava lamps, one green and one red, AUD$29.95 each.

Note that I do not receive any commission from What's New. If you are able to source for similar products anywhere else, please feel free to do so.

Warning:  The lava lamps tend to get pretty hot. Do not touch the lamps until they have sufficiently cooled down.

 
  Green Lava Lamp Red Lava Lamp
Cool green lava lamp Cool red lava lamp

You'll need to download a copy of Open Object Rexx.

Finally, you'd need the follwing application package, x10.zip, that includes a CruiseControl publisher plug-in and an implementation of an X10 device controller via a Rexx programme.

That's all you'll need to get yourself started.
 

 X10 API

Burnt LCD Monitor
Burnt LCD monitor

Before we look at the fun part of getting the lava lamps hooked up to CruiseControl, I would like to share my experiences on developing a set of Java APIs that allowed for CruiseControl to publish build status to the lava lamps.

Initially, I was hoping that I could easily re-use some code that was readily available in the cyberspace. I looked and looked but could not find any API that catered for the RF Transmitter/Receiver module (CM19A model). All catered for the CM17A model. As mentioned before, the major difference between the two models was that the CM19A had a USB interface whilest the CM17A could interface via either Serial or USB.

I then attempted to write some code that transmitted a series of bits to the RF Transmitter/Receiver module. I must have sent some wrong sequence out as the next thing I knew, I heard a pop and one of my LCD monitors got burnt. For the sake of not burning my second LCD monitor (and then having to explain to my people leader why I need a couple of new LCD screens), I stopped my experimentation in this.

Sitting at my cubicle grumbling out loud and wallowing in self-pity, one of my colleagues at nab, Michael Tanzer, popped his head over and asked me if he could help. I was more than happy with whatever help I could get. After explaining the problem statement to Michael, he proposed developing a script based off Open Object Rexx that would allow for it to take control of the xfire application as a Windows object.

Thereafter, all I had to do was to write code that implemented the net.sourceforge.cruisecontrol.Publisher interface and some other code that translated build status into its visual representation via the lava lamps.
 
X10 Class Diagram
X10 API Class Diagram
 
 
X10 Sequence Diagram
X10 API Sequence Diagram
 

Ready, set, bubble!!!

Now for the fun part. How do we get the lava lamps to bubble?!!

 
X10 Transceiver Module X10 Lamp Module

Step 1: Transcevier Module

Step 2: Lamp Module

 

 

xFire Software X10 RF Transmitter

Step 3: xfire software

Step 4: RF Transmitter

 

  1. Plug the red lava lamp into the Transcevier Module. Ensure that the device Housecode is set to 'A'. Now, the Housecode could be set to any alphabet from A-P. You just need to ensure that any Housecode that you set is consistent across all your X10 devices for the purpose of the exercise. Note that the device's unit code is hard-coded to 1. Thus, this device 'listens' on A1. Thus, you would be able to send on and off signals to A1 that would trigger the red lava lamp on and off.
  2. Plug the green lava lamp into the Lamp Module. Set the device Housecode to 'A', it it's not so. Then, set the device's unit code to 2. Viola! The green lava lamp would now be 'listening' on A2. Easy-peazzy!
  3. Install the xfire software. Follow the prompts accordingly.
  4. At some point during the installation, you would be prompted to plug in the USB RF Transmitter/Receiver.
  5. Ensure that evertyhing is working by playing around with the xfire application. You should be able to switch the lava lamps on and off. Cool, eh? Well, there's just a bit more to do.
  6. Install Open Object Rexx.
  7. Unzip the x10.zip package to your C:\ drive.
  8. Copy the x10.jar from the dist folder to your \lib directory.
  9. Updated your CruiseControl config.xml file to have the following entries:
  • Within the <project> element, include a new <plugin> element, '<plugin name="x10publisher" classname="com.thenational.edia.x10.X10Publisher"/>'.
  • Within a project's <publishers> element, include a new <publisher> element, '<x10publisher passDeviceCode="A2" failDeviceCode="A1"/>'.
  1. Restart CruiseControl.
 

Now that we have completed setting up, it's time to see what this whole article is all about. Once a build request is triggered, you'll see some log entries like the following in the CruiseControl DOS console:

[cc]Aug-09 13:23:51 Project - Project vol2-build: now building
[cc]Aug-09 13:23:51 jectController- vol2-build Controller: build progress event now building
[cc]Aug-09 13:23:51 ScriptRunner - Buildfile: projects\cc_vol2_main_view\eda_vol2\build.xml
[cc]Aug-09 13:28:10 jectController- vol2-build Controller: build result event: build successful
[cc]Aug-09 13:28:10 Project - Project vol2-build: merging accumulated log files
[cc]Aug-09 13:28:10 jectController- vol2-build Controller: build progress event merging accumulated log files
[cc]Aug-09 13:28:11 Project - Project vol2-build: build successful
[cc]Aug-09 13:28:11 Project - Project vol2-build: publishing build results
[cc]Aug-09 13:28:11 jectController- vol2-build Controller: build progress event publishing build results
[cc]Aug-09 13:28:12 X10Publisher -
Turning pass device (A2) on; fail device (A1) off...

[cc]Aug-09 13:28:12 ControllerRexx- rexx c:\x10\rexx\FireCracker.rex A2 ON
[cc]Aug-09 13:28:14 ControllerRexx- rexx c:\x10\rexx\FireCracker.rex A1 OFF
[cc]Aug-09 13:28:16 Project - Project vol2-build: idle

In no time, you'll be feasting at the sight of green lava bubbling:

Build Successful

Build successful


Cool?!! Now, I will be naughty and break the build:

[cc]Aug-09 13:33:08 Project - Project vol2-build: now building
[cc]Aug-09 13:33:08 jectController- vol2-build Controller: build progress event now building
[cc]Aug-09 13:33:09 ScriptRunner - Buildfile: projects\cc_vol2_main_view\eda_vol2\build.xml
[cc]Aug-09 13:37:22 jectController- vol2-build Controller: build result event: build failed
[cc]Aug-09 13:37:22 Project - Project vol2-build: merging accumulated log files
[cc]Aug-09 13:37:22 jectController- vol2-build Controller: build progress event merging accumulated log files
[cc]Aug-09 13:37:22 Project - Project vol2-build: build failed
[cc]Aug-09 13:37:22 Project - Project vol2-build: publishing build results
[cc]Aug-09 13:37:22 jectController- vol2-build Controller: build progress event publishing build results
[cc]Aug-09 13:37:22 X10Publisher -
Turning pass device (A2) off; fail device (A1) on...

[cc]Aug-09 13:37:22 ControllerRexx- rexx c:\x10\rexx\FireCracker.rex A2 OFF
[cc]Aug-09 13:37:24 ControllerRexx- rexx c:\x10\rexx\FireCracker.rex A1 ON
[cc]Aug-09 13:37:26 Project - Project vol2-build: idle


Oh...oh...we're in trouble...who broke the build???

Build Failed

Build failed

Conclusion

Getting the lava lamps to work gave me a great sense of joy and satisfaction. What was perceived to be a straight-forward implementation became somewhat of a challenge. Now, to convince my people leader to approve funding for one of those large one-line electronic LED signs...

Credits

I would like to thank Michael Tanzer whom developed an Open Object Rexx programme which allowed for the control of a Windows-based application. This allowed me to implement a X10 device controller interface that was able to turn a lava lamp on or off.


Last update: 03-11-2008 15:02

Favoured Print Send to friend

Quote this article on your site

To create link towards this article on your website,
copy and paste the text below in your page.




Preview :


Friday, 31 October 2008

Powered by QuoteThis © 2008


Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! JoomlaVote! Google! Live! Facebook! StumbleUpon! Yahoo! Free social bookmarking plugins and extensions for Joomla! websites!
Attachments:
FileDescriptionFile sizeLast Modified
Download this file (x10.zip)x10.zipJava package that contains a CruiseControl publisher plug-in and an implementation of an X10 device controller via a Rexx programme.774 Kb31/10/08 21:41
Comments
Add New
+/-
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."