Personal Kiosk Project, Part I

One of the things I've been wanting to build is a personal touch screen kiosk-like thing where I can quickly access information (weather, movie times, etc) as well as listen to music, make a phone call, view photos and various other things. I recently had the opportunity to play with a Eee Box PC at work, so I thought this was a great platform on which to build this kit. The Eee Box features a 1.6GHz processor, an 80G hard disk and 1GB of RAM (although I ended up upgrading to 2GB).

After purchasing the Eee Box, the next thing I needed was a decent touch screen. These can be rather expensive. I hunted around for a while, but in the end I just got lucky. I found a 3M M150 15" touchscreen on Ebay for a real bargain. This has a really nice capacitive touch screen, embedded speakers/microphone and supports both Linux and Windows. Many monitors have mounting screws on the back for mounting on walls, or for attaching thing clients. The Eee Box also comes with a mount specifically for this purpose, what a great combo!





M150 Touchscreen with Windows

I first started testing the touch screen and implementing things using Windows. Because I work for Microsoft I actually had access to try Windows7. Amazingly, it worked pretty well, and the touch screen drivers - designed for Vista of course - worked perfectly. I ultimately ended up using Ubuntu because I had other things I wanted to toy with, but there was no technical advantage here. One hint: use the 32-bit version of Windows and the driver. Since this was a Eee Box with 2GB RAM this was a no brainer, but I can say that the 64-bit driver doesn't work nearly as well.

This was an interesting project for me. I've always been a fan of Linux, but I encountered some very interesting challenges/annoyances with this project that I hadn't foreseen. After prototyping this project in Windows and Linux, I found that it would have been far easier to use Windows, even the pre-beta Windows7 I had would have worked just fine. Ubuntu is great, but I just ran into a bunch of little annoying issues (which I'll outline later).

M150 Touchscreen with Ubuntu

One major problem I ran into with Ubuntu were the touch screen drivers. The originl driver for this screen was distributed as a kernel module (with source code), and a closed source XF86 driver. The kernel module didn't compile properly under recent kernels, so I had to do a little hacking to get the module compiled. Sadly, even when I got the module compiled, the XF86 module wouldn't load properly with the Xorg version distributed with Ubuntu 8.04 or 8.10.

So, I emailed 3M and asked for help. Amazingly, they responded by providing me an unreleased driver. This new driver removes the need for a kernel module, and has an updated driver that is supposed to work with Xorg. Unfortunately, the driver does not work properly with the version of Xorg distributed with Ubuntu 8.10, but does work with Ubuntu 8.04 (Xorg version 1.4.0.90). This updated driver is now available on 3M's website.

So, that's great. Now I have a working, and fairly recent version of Ubuntu with a killer touch screen! Woot! But wait, this was quite an effort. Why is it that I was able to get the touchscreen working immediately with an older driver and a pre-beta version of Windows (Windows7), but had a difficult time with Ubuntu - and it still doesn't work with 8.10? I suppose one could blame 3M for this, but I don't think they deserve all the credit. We all know kernel developers (and apparently Xorg developers) don't have much sympathy for closed drivers, and so break interfaces and change things quite often. I can't argue if this is right or wrong, all I can say is that it's fricken annoying sometimes.

The Interface

After getting the touch screen working, most everything else was pretty easy. I got the Intel driver working with Ubuntu 8.04 and Compiz-Fusion. Interestingly, this was a bit of a task in 8.04, but worked out of the box in 8.10. There's a big bug report about this, but the long/short of it is that one needs to explicitly disable LVDS in the xorg.conf file.

Wireless was also a hassle, but again it worked fine after installing a new driver (pretty easy, plenty of posts and reports about this issue as well). I then installed the Avant Window Navigator, which is a launcher/task bar replacement. This provided a nice-looking launcher for all the applications to which I wanted access.

After configuring Avant, I then installed these nifty things called Screenlets. This provides an architecture for folks to write little applications that sit on the desktop, similar to Vista Gadgets or OSX Dashboard. Very handy for things like weather and stock reports.



Annoyances

Ultimately I'm pretty happy with the outcome. Besides the aforemented driver issues with the touch screen, Intel video and wifi, there are a couple Linux-specific things I still need to solve.

The first is the most idiotic. Of course, I don't want to leave this thing turned on all the time, so I would like it to got to sleep after some time. GNOME, unfortunately, will sleep even when playing internet radio (or Pandora or similar) via Firefox. There are plenty of bug reports as well about this involving VLC and other media players. Apparently the fix is to have the application inform GNOME that it should not sleep. Wait, what? So, every application that could possible play music/video needs to inform the GNOME that it's doing so? Shouldn't GNOME just detect this? Seems backward to me. Yet another thing I wouldn't have ever had to deal with in Windows.

One solution might be to periodically test to see if the sound is working and send a message to gnome-power-manager to not sleep. One can check the sound card via a shell script like the following:

    if cat /proc/asound/card0/pcm*/sub0/status | grep -qs RUNNING ; then
echo "Sound is running!"
fi

I haven't tested this yet, however, but if I do I'll post a followup on this. Unfortunately, sleeping is mostly a moot point since after waking up the sound no longer works at all... great.

One other annoying thing is that in order to make a phone call through Ekiga, I cannot just pause the internet radio or Pandora or whatever. I actually need to close the browse. Annoying, but not a huge deal.

Anyway, this is an awesome project. A little pricey, but a really handy tool to have around. I've already coded up a script so that this little box reads the news to me in the morning, and audibly tells me the weather and other information. The possibilities are limitless!


Calculate Moon Phase Data with PHP II

A little while ago I posted the code to a PHP-based moon phase calculation program, which was a translation of the Perl Astro::MoonPhase module. This application can calculate the phase of the moon for a particular date or set of dates, and is much more accurate than other PHP-based moon phase calculation programs I've seen.

Thanks to Alexander Cicovic, I noticed a silly error in the phasehunt() function that caused it to loop infinitely :-/ While I was digging into the code, I decided to also add the phaselist() function that was added to the latest Astro::MoonPhase module, version 0.60.

The moonphase.inc.php script can be easily include()'ed into your PHP apps. Also for bonus points I updated the moonphase.php sample script to include an example all three functions (phase, phaselist and phasehunt). So, here they are below:

moonphase.inc.php -- Moonphase Functions
moonphase.php -- Sample Code

Enjoy!

Update: This script is now available as a PHP class.


Model Rocketry Awesomeness

The Build

I've recently re-discovered an old hobby of mine; model rocketry! On a whim, a buddy of mine (John Kew) purchased a couple model rockets from a local hobby store. I purchased a rocket called the Big Daddy, which is a rather large rocket that accepts D and E sized engines. John went with a multi-stage rocket that, although was probably more technically advanced, was not nearly as totally sweet and awesome as the one I chose.

Anyway, the build was rather trivial. A little hot-glue and an hour or so and it was all together. Here's what the finished product looked like:


Instead of just purchasing a typical launch controller and launch pad, John and I decided to have a build-off. I built a totally cool looking detonater... uh, I mean, model rocket igniter thingy. It's a pretty simple device. Just a single circuit with a cutoff switch, and some wires to connect to the igniter on the rocket engine.





John built a pretty awesome launcher as well. Instead of a spiffy custom case he used a lamp cord, a wall socket, a light switch and a Staples Easy Button. I'll try to get some pictures of that formidable contraption posted a bit later.


The Launch

Unfortunately, I don't have any photos of the launches. John's wife Sarah took a few, I'll try to get those posted later on.

The only place in King County at all that allows model rocketry is called 60 Acre Park in Redmond, WA. I had purchased a number of various D and E sized engines to try out. In short, all the launches went more or less without incident, except that there was a bit of a wind and the Big Daddy suffered from serious windcocking (where the rocket hooks into the wind). We adjusted the launch rod as best we could, but that did not really help much. Luckily, the parachute deployed properly each time and was able to drift the rocket back into the park ;)

I think over the next year I'll dig deeper into this rocketry thing. Perhaps I'll build a 10,000+ foot rocket, or send some helpless GI-JOEs into orbit...


Happy Halloween!


The drill press makes pumpkin carving a bit easier.


The page is just a place I can link to that includes a few tidbits about myself. I'll probably update this page occasionally.


Work Stuff
Taking it home with me




Online Profiles
Invading my own privacy


Personal Projects
Stuff that matters


ParaDB -- Paranormal Reporting Database

Space Weather Archive

Sentry Firewall


Chewie

Other Contributions


My Google Health Profile

Last week someone sent me word about a new service from Google called Google Health. I'm sure a lot of folks are rightfully a bit dubious about this service, but luckily their privacy policy is pretty clear about how they share your data (it appears they won't, basically). So hopefully they'll follow that policy and folks will find it to be a valuable service.

One has to wonder, of course, what is their angle? Google is first and foremost an advertising company. Search and data analytics is just a means to this end. So are they planning on flashing ads about Paxil to folks who suffer from depression? Probably.

In any case, check it out and see what interesting things you can do with your medical history. The Internet is a great place to reinvent yourself - for example, according to Google, I'm now officially a 30-year old dwarf with a severe allergy to cabbage juice.


SambaXP 2008

This last April I had the opportunity to attend SambaXP in Göttingen Germany. This was my first time in Germany, and I have to say I like the place a lot. Unfortunately, I didn't have a whole lot of time to explore. I spent most of the time in Göttingen where the conference was. But that, too, was a nice place to visit. I just wish I spoke any German at all.

I flew into Copenhagen, Denmark (btw, business class RULES), and then hopped over to Hamburg. From there it was about a two-hour train ride down to Göttingen. Pretty easy overall, even for a sleep deprived traveler like me.

SambaXP was just great. Microsoft was there in force, with engineers and architects to meet and exchange information with the Samba team. I felt I was watching a bit of history as Andrew Tridgell of the Samba team asked the Microsoft employees in the audience to stand up, and be recognized. That was nice. Microsoft has gone beyond what any regulatory agency has asked. The Samba Team (and the world) now has open access to 30,000+ pages of documentation and new friends in Microsoft with which to collaborate.

Anyway, enough preaching. Here are a couple photographs I took at Germany. I actually didn't take all that many, unfortunately.


Train station in Hamburg, Germany



Germany at ~120MPH



I've Arrived!


My Job

I find it's sometimes difficult to explain my job to my friends and family. For the past three years I've worked at the Open Source Software Lab (OSSL) at Microsoft. Most of my family members don't really know what open source is, and even fewer know why Microsoft has such a lab. I'm afraid it would take quite some time to explain all the details. But for those who are curious about where I work and what I do, I wrote a short article on port25.technet.com about the OSSL called Inside the OSS Lab.

Port25 also has many other articles that might shed a bit more light on the OSSL.


Space Weather Archive

Many folks may not know that I'm a bit of a fan of space weather. I've spent a considerable amount of my nerdy free time digging through the archives at the Space Weather Prediction Center (formerly the Space Environment Center) website. The SWPC is a division of NOAA, and is responsible for collecting data and monitoring events related to space weather. This includes monitoring changes in the Earth's geomagnetic field, and collecting data about particle and electromagnetic radiation (such as x-rays) that are constantly being hurled at us by the Sun.

The SWPC utilizes data from ground stations, as well as a number of satellites, particularly the GOES satellites, to collect and archive space weather data. This information is then used to assist in predicting space weather, and alerting the world to significant space weather events such geomagnetic or solar radiation storms. The SWPC website includes an education section for those interested in learning all about space weather.

Well, enough about that. In this blog I wanted to write about a web-based application called the Space Weather Archive that I built to assist myself and others in easily accessing historical space weather information. The application is available here, and is free for anyone to use. The archive goes as far back as 1996, primarily because that's when the archive on the SWPC FTP archive begins :)

Usage of the tool is fairly straight forward. Simply input a date and click "Submit". The result will include both geomagnetic and x-ray data, as well as links to the actual data and plots from the SWPC archive. Once caveat is that the data for a particular day will not be available until the following day. This is because the SWPC compiles the data and generates a summary file once per day (for the previous day's data), which we use to retrieve some of our information.

There are also other methods we can use to query the Space Weather Archive using a GET request, and passing arguments so that it returns plain text data. This would be possibly be useful to those interested in querying the archive from within their own applications. But before I get into that, I want to write a bit more about the data from which this data is mined.

The SWPC archive is available via FTP, but probably more conveniently over the web at http://www.swpc.noaa.gov/ftpmenu/. If you explore the archive you can see that there is A LOT of data there. I myself spent many hours in here looking for the correct data I wanted to study. The archive includes both text files with columns of data, as well as plots in .gif format. Older data is stored in what they call the warehouse. Folks wanting to access data more than a year or so old will need to look in here.

Much of the data from previous years is compressed as .tar.gz files, which makes it a bit more difficult to immediately access. They tend to do this around the first week of January. For this reason the Space Weather Archive I built actually pulls data from my own mirror that contains the uncompressed archives. This just makes sense anyway. It's faster and easier on the SWPC website.

So I mentioned earlier that we can also query the Space Weather Archive using just a standard GET request. To do this one must simply pass the year, month and day to the application in the URL:

http://www.aghostonline.org/weather/archive/sec_history.php?format=0&year=2008&month=05&day=04

The format=0 portion tells the Space Weather Archive to output the data in text format, rather than the default HTML. The output of the above URL looks like the following:


Date: 2008-05-04

Geomagnetic Kp: 1:2:3:3:1:2:2:2
Geomagnetic Ap: 8
Geomagnetic Summary: Semi-Quiet
Geomagnetic List: http://www.aghostonline.org/weather/archive/SEC_DATA/2008/SGAS/20080505SGAS.txt
Geomagnetic Plot: http://www.aghostonline.org/weather/archive/SEC_DATA/2008/2008_plots/kp/20080504_kp.gif

Xray (1.0-8.0 Ang): 3.7300e-09 W/m^2
Xray (0.5-3.0 Ang): 5.3916e-09 W/m^2
Xray High: 9.5000e-09 W/m^2
Xray Low: 3.7300e-09 W/m^2
Xray Peak: Normal
Xray Summary: <B Class (Normal)
Xray List: http://www.aghostonline.org/weather/archive/SEC_DATA/2008/2008_XRS_5min/20080504_G10xr_5m.txt
Xray Plot: http://www.aghostonline.org/weather/archive/SEC_DATA/2008/2008_plots/xray/20080504_xray.gif


Thats it! The information includes x-ray and geomagnetic data for that particular day, including links to the actual data files and plots. The output format should make important and parsing into another application relatively easy.

I hope you find this data as interesting as I do. If you do end up using the Space Weather Archive for your own application, please feel free to drop me an email and let me know :)


Calculate Moon Phase Data with PHP

While developing ParaDB, I wanted to be able to calculate the phase of the moon given an arbitrary date and time. The only PHP software I found for this was the moon-phase class available from phpclasses.org. In my tests, however, I found it to be a bit less accurate than an equivalent Perl module I had used in the past called Astro::MoonPhase. So, I went ahead and just translated the Perl module to PHP.

The PHP version can be downloaded here. Feel free to expand on it, or rewrite it as a PHP class. If you use it in anything interesting, please let me know :)


Usage

The PHP moonphase functions work much like their Perl counterparts. Below is sample code returning a number of variables. This should be pretty familiar to those who have used the Astro::MoonPhase module:


require( 'moonphase.inc.php' );

$date = '2008-05-05';
$time = '20:36:00';
$tzone = 'PST';

// Usage: $data = phase( seconds_since_1970 );
$moondata = phase(strtotime($date . ' ' . $time . ' ' . $tzone));

$MoonPhase = $moondata[0];
$MoonIllum = $moondata[1];
$MoonAge = $moondata[2];
$MoonDist = $moondata[3];
$MoonAng = $moondata[4];
$SunDist = $moondata[5];
$SunAng = $moondata[6];


To add to this example, you could then translate the phase into an easy-to-read format:

$phase = 'Waxing';
if ( $MoonAge > SYNMONTH/2 ) {
$phase = 'Waning';
}
print "$phase\n";


You could even make this a bit more useful by using $MoonIllum:

// Convert $MoonIllum to percent and round to whole percent.
$MoonIllum = round( $MoonIllum, 2 );
$MoonIllum *= 100;
if ( $MoonIllum == 0 ) {
$phase = "New Moon";
}
if ( $MoonIllum == 100 ) {
$phase = "Full Moon";
}

print "Moon Phase: $phase\n";
print "Percent Illuminated: $MoonIllum%\n";


More information can also be found with the Astro::MoonPhase documentation.

moonphase.inc.php -- Moonphase Functions
moonphase.php -- Sample Code

That's it, enjoy :)

Update: This script is now available as a PHP class.