things you can do

At around 2 o’clock in the afternoon my cubicle and those around it begin to heat up. By then, the sun has spent a good hour beaming directly onto the side of the building near where I sit and the building’s occupants begin to toast lightly. I purchased a nice desk fan to keep myself cool, but I tended to leave it on when I wasn’t there. Not only did I waste power — when I left, my body wasn’t there to block the breeze and I’d freeze my poor cube mate.

The solution? Buy a Bluetooth-enabled phone, Bluetooth USB dongle for my workstation, an X10 kit for power automation, and use the phone as a proximity beacon so that the fan turns off when I leave.

No, really. I did this. My screen even locks itself and asks for a password when I step away.

dragonfly

A little rationalization is required, however. I didn’t buy the Treo specifically for this project. My poor Samsung A660 died in an electronic fury—it quite literally screamed as the speaker blew out–and I needed a replacement. A friend’s Treo was the only Sprint phone that ever got decent service in my apartment, plus I always liked my Palm Pilot, so I figured getting one would be a win. I would even be able to sync my contacts and planned events wirelessly using Bluetooth.

What really amazed me about all this was how these technologies plugged together like Legos. I knew that with Bluetooth I’d be able to read the signal strength between my computer and my phone, and I knew that there were simple command line tools for controlling X10 devices. It should be as simple as,

state = near
loop forever
  strength = get-strength(treo)
  if strength >= threshold and state == far
    state = near
  else if strength < threshold and state == near
    state = far
    turn x10 device A1 off
  end
end

It’s almost that easy. The X10 part is easy—simply plug in the X10 devices and apt-get bottlerocket on Debian or Ubuntu to get the X10 control packages.

The Bluetooth part was a little more challenging. The Treo has two Bluetooth modes: “Interrupt me when a Bluetooth event occurs” and “Let Bluetooth work in the background but disable PCS Vision.” The former mode lets you surf the web, but it doesn’t let you do anything while Bluetooth is connected. The latter puts Bluetooth in the background, but all of the web interaction is disabled.

It only took me two hours to figure out the Treo strangeness described above, and I’m not sure if I really want to keep it in the mostly-useless, Bluetooth-background mode. A fun project, nonetheless, and it’s pretty cute to hear the click of the fan turning off when I walk away from my cube.

© Ian Langworth