fit-PC2 FTW!

by April 3, 2012 12:09 PM

fit-PC2 Box Front

This is a picture of the box top for my new toy. Thanks to a comment from a friend on one of my past posts, I've been looking for a reason to justify buying one. Exactly as his comment suggests, I've grown tired of having to leave my beast of a desktop running to serve as a home server and to host the radio I use to interface with my remote sensor network.

I love this little thing! It's small, quiet, and uses practically no power. I got the fit-PC2 Value model, which comes with everything I need: 1.1 GHz CPU, 1 GB RAM, Ethernet, DVI display port, 6 USB ports, and an empty internal bay for a 2.5" SATA HDD. I already had a 100 GB 7500 RPM drive I could use (left over from a past upgrade on the wife's mac).

fit-PC2 Next to our Time Capsule

Here you can see the fit-PC sitting next to our Time Capsule for a good size reference. I used the Time Capsule as the router for the fit-PC's ethernet. The little thing in the middle is the XBee radio I use to communicate with my garage door opener.

It sits there next to the router drawing very little power, making no noise, and hardly even warms up. I would even go as far as saying it looks pretty cool too - it lives in our living room on a small table next to the TV.

Communicating with the XBee

The OS I decided to put on it is Ubuntu. This means the .NET console application and the ASP.NET application I used on my development box wasn't going to cut it (without getting Mono involved of course). Instead I went with the classic LAMP stack (the 'P' being PHP in this case).

For the time being, I'm not listening with the radio which means I'm no longer getting temperature readings. Instead I'm just using it to open and close my garage door. I did this because I'm hoping to move from using XBee/ZigBee to 6LoWPAN in the future (more on that another time). For that reason I didn't see the need to much time into this. I just wanted to be able to continue operating my garage door opener with my phone!

For anyone interested, this is the PHP code I'm using to open the serial port and send the XBee messages to the remote XBee controlling the garage door opener. The php_serial.class.php that I'm including was pulled from here.

<?php
if ( isset( $_POST["btnSubmit"] ) ) {
ini_set( "display_errors","On" );
include "php_serial.class.php";
$serial = new phpSerial;
$serial->deviceSet("/dev/ttyUSB0");
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");
$serial->deviceOpen();
$serial->sendMessage("\x7E"); // Frame start
$serial->sendMessage("\x00\x10"); // Frame length
$serial->sendMessage("\x17\x00"); // Frame type (AT command)
$serial->sendMessage("\x00\x13\xA2\x00\x40\x86\x97\xCB"); // Destination address
$serial->sendMessage("\xFF\xFE"); // 16 bit dest addr (unknown)
$serial->sendMessage("\x02"); // apply AT command immediately
$serial->sendMessage("\x44\x31"); // "D1"
$serial->sendMessage("\x05"); // HIGH
$serial->sendMessage("\x92"); // checksum
sleep(1);
$serial->sendMessage("\x7E"); // Frame start
$serial->sendMessage("\x00\x10"); // Frame length
$serial->sendMessage("\x17\x00"); // Frame type (AT command)
$serial->sendMessage("\x00\x13\xA2\x00\x40\x86\x97\xCB"); // Destination address
$serial->sendMessage("\xFF\xFE"); // 16 bit dest addr (unknown)
$serial->sendMessage("\x02"); // apply AT command immediately
$serial->sendMessage("\x44\x31"); // "D1"
$serial->sendMessage("\x00"); // OFF
$serial->sendMessage("\x97"); // checksum
$serial->deviceClose();
}
?>

Enjoy!

Tags: , , ,