Turn on lights/appliances with your Android alarm clock (using Raspberry Pi and X10).

Being the type of person who likes to automate everything (if it can be scripted it should never be done by hand), I wanted to create a system for automatically turning on my apartment lights in the morning.

There are lots of ways one could do this, likely the easiest would be a lamp timer, but that’s a little too mundane.  So I created a solution using a Raspberry Pi, and X10:


  • A linux based computer; I used a Raspberry Pi since it’s low powered.
  • A serial port; I used a USB to serial adapter, they are fairly easy to find online.
  • The FireCracker CM17A serial X10 transmitter, an X10 Transceiver, and as many X10 Lamp Modules as you’d like.  I got them as a kit with a remote control.
  • An Android phone with the Tasker app.


First download and install the recommended Raspberry Pi operating system.  When setting it up, I’d recommend setting the SSH server to start automatically, and setting a static IP (or add a rule to your DHCP server to always give it the same IP).  Once it is setup, we need to install BottleRocket, a command line application for controlling the FireCracker CM17A unit.

sudo apt-get install bottlerocket

Since we are using a USB to serial adapter to attach the CM17A, we need to specify its location to bottlerocket, normally “/dev/ttyUSB0″.   Plug in the X10 Transceiver and test if it works by running the following command to turn on all the lights:

br --port=/dev/ttyUSB0 --ON

Now we need a way for the phone to talk to the Raspberry Pi, there is a huge number of ways to do this, I did it with a simple web server.   Specifically I used apache2 and php5.

sudo apt-get install apache2 php5

Once the web server is up, create a short php script to control bottlerocket using some GET variables. (Ideally you could create a proper RESTful interface, but I was lazy.) Call this file “var/www/br/index.php”:

    $number = $_GET['num'];
    $house = $_GET['house'];
    $action = $_GET['action'];

    if ($number < 1 || $number > 16) {
        echo "error in number";

    if (preg_match('/^[a-p]{1}$/',$house) != 1) {
        echo "error in house";

    if ( $action != 'on' && $action != 'off' ) {
        echo "error in action";

    echo shell_exec("sudo /usr/bin/br --port=/dev/ttyUSB0 $house$number $action");

Also we need to allow the webserver user, in this case “www-data” to run br using sudo to it can get access to the USB controller. To do this run visudo and add the line:

www-data ALL=(ALL) NOPASSWD:/usr/bin/br

This isn’t the best practice from a security point of view, but for a simple server running on a local network, it should be fine.

Now you can test the script by turning off your first lamp by visiting the following webpage in your browser:


Where [raspberrypi-ip] is the IP Address of your Raspberry Pi on your local network. You can turn the light back on using:


Now on your Android phone get Tasker to visit the webpage when the phone’s alarm starts; I’m assuming if you made it this far, you can figure out how to do this :)

So there you have it: a way to turn on lights (or even appliances) in your house whenever your phone alarm goes off.  The best part is, once this is set up you don’t have to touch it again.   If you change the time you wake up, all you have to do is change your alarm time, and it will just work.

Posted in Site Info | Tagged , , , , | Leave a comment

Localizing Aurora with ISS Image Time Series

This year I participated in the NASA International Space Apps Challenge with Laura Culp and Fangda Li.  We worked on the Aligning the Stars challenge, and created the method shown in the video below.  More information can be seen on our project page.   We won one of the two “best of” awards at the Toronto Space Apps event; so our project goes on for judging at the international level by NASA.   Results should be announced on May 22nd, 2013.

Posted in Site Info | Leave a comment

GPU Accelerated Ray Tracer

My final CS 488 project was to extend a basic ray tracer (which we had written for an earlier assignment) to include a number of additional features.   Here are a few of the images I rendered to demonstrate some of those features.

The most interesting part of the project was using CUDA to do GPU Acceleration of the ray intersection algorithms.  I learned a lot about CUDA algorithm structure, and how to manipulate data so that it could be efficiently processed by the GPU.

Reflections, Additional Primitives, and Texture Mapping



Refraction Index = 1.5

Refraction Index of 1.5


Texture Mapping

Texture Mapping


Bump Mapping

Bump Maping


Depth of Field and Soft Shadows

Depth of Field


GPU Acceleration Speedup Graph

GPU Speedup

Posted in Projects | Tagged , , , | Leave a comment

Tests of the LumoPro LP160 with a Canon 60D, and a Canon 320EX off camera.

I recently purchased a small strobist lighting kit from Midwest Photo Exchange; a very bare-bones kit with just one LP160, a light stand, an umbrella, and the gels and random  stuff that comes with the kit.  Overall it was one of the cheapest, and best photography equipment purchases I’ve made.

I currently also own a Canon 320EX Speedlite, which has some nice features, if also some major limitations (no manual mode unless controlled by a camera directly, which isn’t a big deal now, but when I move to radio triggers, I won’t be able to use it with them).

Of course, I want to be able to use both my 320EX and LP160 at the same time.  The obvious way is to just mount my 320EX to my 60D, set it to manual or ETLL and set the LP160 to ‘S’ or ‘Si’ mode.  This has worked well in my tests, however I’d like to be able to shoot with my 320EX off camera.  This is easy to do if I just use the 320EX, since the 60D can send a proprietary preflash signal to fire the 320EX, however it gets interesting when you add the LP160…

According to the product page, with camera firmware version 1.05: “In ‘S’ mode, syncs EXCEPT on full power.”, using a 580EX II as the master, and a 430EX II as the slave.

This wasn’t very helpful to me since I don’t have those flashes, and my firmware is 1.09, so I ran some tests with the 320EX off camera, and here are my results:

Camera SettingsLP160 SettingsResult
Flash mode: Manual flash
Wireless func: External only
'S' ModeEntire system fails. (1)
Flash mode: Manual flash
Wireless func: External only
'Si' ModeLP160 fails to sync.
Flash mode: E-TTL II
Wireless func: External only
'S' ModeLP160 syncs, but fires twice, so will NOT work at full power.
Flash mode: E-TTL II
Wireless func: External only
'Si' ModeLP160 syncs up to full power,
PROVIDED the 320EX fires at a high power level. (2)


(1) The LP160 went off, but too soon, and in doing so somehow disrupted the signal to the 320EX, which then failed to go off.

(2) If the 320EX only needs to fire at low power (or is set to fire with low power using an ETTL bias, i.e. setting flash output to -2.0), then the LP160 fails to fire at all in this setup. I suspect that the LP160 thinks that the actual flash is another preflash unless it’s quite powerful.


It appears it is not possible to use the LP160 in conjunction with the 320EX off camera in manual mode.  This is disappointing, though I should point out manual flash will still work so long as you attach the 320EX to the camera directly.

The Lp160 will sync with the 320EX off camera when using ETTL.  However there are two catches: 1) if the LP160 is put into ‘S’ mode it will fire twice, it does sync, but not at full power. 2) if the LP160 is put into ‘Si’ mode it will only fire once and sync, but only if the 320EX goes off with enough power.

I hope this is useful to people who are considering using the LP160 with their 60D and existing Canon flashes off camera.  My plan however is to leave Canon flashes behind, and go with radio triggers and more LP160s.

Posted in Photography | Tagged , , , , | 1 Comment

Over 5,000,000 points on Folding at Home

To view my full stats click here.

Posted in Random | Leave a comment

Flickr Based Photo Gallery

Since I started this blog I have constantly run into the problem that adding photos to it is difficult.  In the early days I did it all by hand, in the last year or so I have used a gallery plugin for WordPress.  However, even with the gallery plugin, I had a hard time managing my photo collections with it.  In addition, I could not find a nice way to for users to just browse all the photos on my site, or select a subset which was interesting to them (i.e. macro, city, cats, etc).  An obvious solution was to do one post per photo, and tag them, but that could lead to a huge number of posts.

My solution now is simply to separate my photo management from my blog.  I now have a Flickr account, which I will post all my photography to, and organize my photos with.  My blog will still show my photography, but it will pull it directly from Flickr, using WordPress plugins.  In this way I hope to be able to post more work, without the pain of creating new posts each time I have new photos I want to share.

This will also allow the “blog part” of my blog to return to being more of a programming blog without getting watered down with photo posts.  However I still want to show my latest photography, so the first part of my “blog feed” will always display the latest two (or so) photos I have taken.

The Photography link now goes to a gallery which shows all my latest photos.

Since I am still in the process of adding photos to my Flickr account, some of the photos on my blog are not yet in the new Flickr based gallery.  Therefore, I am keeping the old photography page around for a little while.

Posted in Site Info | Leave a comment