Wednesday, December 30, 2009

Tracking Commute Times

A couple years ago I rigged up some GPS tracking on my car. I have a Garmin GPS 18 OEM hooked up to a laptop which sends this data over my phone to a custom site I created. There's tons of interesting analysis that can be done with this data but the one that has the highest proportion of my mind share is analyzing my commute (since I do it every day).

One function that I implemented in this site is a "path search". Basically it lets you define two points and then finds all of the paths between those points with relevant statistics like how far you drove and for how long. I did this for my commute to get a graph of durations by when the commute started. Blue is to work and red is from work.

Its pretty obvious the effect of rush hour on both the outgoing and incoming routes. The discrepancy in the duration of the two directions is interesting and most likely caused by the 5 (count them ... 5) lights I have to go through in the 1/4 mile it takes to get onto the freeway from my house. The offramp on the way back skips most of these.

Another set of interesting conclusions that can be gained from this is information about when and how long I work. I rarely leave before 9 and this is good because traffic gets significantly better by then (like a 2x shorter commute according to this graph).

  • Average Arrival Time: 9:47 AM
  • Average Time at Work: 9.46 hours
  • Average Departure Time: 7:14 PM
Both the arrival and departure times make sense with what I'd say prior to this if asked. For some reason I never subtracted the two since the average time at work seemed higher than I would have guessed.

Technologies: PHP, Google Docs, MySQL

Using a Traffic Light as a Bike Light

The sun sets earlier in the winter meaning I've started spending more time riding in the dark. When riding in the dark, its important to stay safe by being visible to cars. Visibility in turn correlates with how big / obnoxious your lights are. As a result, I decided to make the "safest" bike light possible using a 9" traffic light I picked up at a local surplus warehouse.

The whole thing is powered by a $20 UPS that I picked up at Fry's. To get it to blink, I opened it up and put a solid state relay in line with the output from the battery. This is then controlled by a small blinker circuit. This should last about 6 - 8 hours of continuous usage. Pretty good for one a couple hours work.

Technologies: Arduino, C, A/C Electronics, Basic Electronics

Analyzing My Security System Data

I have our security system hooked up to a computer and log every event (window opened, door closed, motion sensor tripped). This lends itself well to some interesting end of year data analysis.

There's one motion sensor downstairs in the connected living room / dining room / kitchen that gives us a good idea of whether or not anything's going on at the house.

We're mostly doing stuff downstairs Saturday, Sunday and Monday. The weekends aren't surprising since all of us work but Monday is a little interesting. Why is it different than any other week day?

We run pretty late hours. If you want some quiet time to yourself downstairs, your best bet is "early" in the morning from 6am to 8am.

In the beginning of 2008 we switched one of the five house mates. Since the person that left ran pretty late hours, it seems like the curve shifted backwards a bit.

The security sensors are also on the doors and windows. Interestingly there are significant spikes in external door usage at 12pm and 10pm. Maybe this is the preferred time for people to leave and return.

We open windows more often than close them during the day. We tend to close windows all at once at night time.

PG&E tracks our electrical and gas consumption on an hourly basis using a SmartMeter. Our downstairs activity seems to correlate with the fluctuations in our energy consumption. This is possibly because of the lights, kitchen equipment and TV downstairs.

We don't use our air conditioner (super expensive in a 3600 sqf house). Instead we open the windows when it gets hot outside. The average temperature data is from the National Weather Service.

But we do use the heater and the gas fireplace when the temperature drops.

Technologies: Python, MySQL, Google Docs