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

Saturday, July 11, 2009

Making a Giant Pop Up Card

For her birthday, my girlfriend offhandedly requested a pop up card, preferably home made. Up for a challenge I decided to follow through with it.

Now my spatial reasoning is pretty horrible. I have trouble solving those 2x2 Rubik's cubes. So I was pretty worried about doing a good job coming up with a design myself. However, it was easy enough to find some instructions online. This site had a number of options with clear step by step instructions. After browsing a little, I ended up selecting the pig mainly because I liked how it looked and she was born in the year of the pig.

Now the fun part. I like to be obnoxious when giving presents so its important to me that the gift be as unnecessarily large as possible. As a result I wasn't able to print out the guides on card stock like the instructions suggested. Instead I stuck around at work and used the projector to trace the pig cuts on the pink card stock.


Once I had traced the cuts and folds, I cut out all the pieces to spec. In addition I took a piece of foam core and scored it down the middle so it became a foldable card. This was harder than it sounded since I didn't have a ruler to find the middle line. As a result, I had to cut pieces of paper using the paper cutter to 5" increments which when placed together on the foam core, indicated where to score.

Finally, it was time to assemble ... well almost. After test fitting some of the pieces, I was thoroughly confused how it was all supposed to fit together. There's that poor spatial reasoning again. Not wanting to ruin the pieces I had spent so much time tracing and cutting out, I printed out the guides on some printer paper and decided to make a quick mock up of the final thing.

With the mock up completed successfully, all that was left was to assemble the final thing. You can see how big it is compared to the mock up and tape in the foreground.
Overall this turned out very well. My girlfriend was surprised to say the least and I was happy with the way it all came together. In addition to the pop up center piece, I ended up adding a bit more decoration, wrapping the whole thing, and topping it off with an obnoxiously large bow. Here's a gallery of all of the pictures I took.

Technologies: Paper, Glue

Saturday, August 30, 2008

Fixing Netgear GS108 Network Switches

I woke up this morning and much to my dismay the internet appeared to be down on my desktop. Strangely the wireless still worked so I went into the network closet and noticed one of the network switches seemed unhappy. All of the port status LEDs were blinking in unison. Googling for the problem yielded this comment on a blog post which pointed blamed two of the capacitors. Sure enough, this was the problem.


Apparently Netgear had under estimated the voltage these should handle so a 6.3V 1000µF piece wasn't enough. Down to Halted I went and grabbed some 10V 1000µF capacitors. I grabbed my trusty desoldering wick, soldering iron, and solder and replaced the busted caps with the new ones I had purchased.


With that all together I plugged everything back in and to my delight it started working again! Now hours later (I wish Halted were closer) I can start my day.


Technologies: Basic Electronics, a soldering iron

Monday, November 26, 2007

Me as a Simpsons Character!

I went to a talk today given by Raymond S. Persi (Emmy Award-winning show director), Edwin Aguilar (Assistant Director), and Francis Dinglasan (Senior Animator) from The Simpsons! They talked a lot about the process behind each episode and what their input is. While I missed out on getting the free book, they stuck around after the talk to draw some pictures. I stuck around too and Francis Dinglasan drew me as a Simpsons character!

When I got home I busted out my mediocre Photoshop skillz, cleaned it up, and colored it in.


Now it'll be a great Facebook picture :)

Technologies: Photoshop

Thursday, November 15, 2007

Simple Serial Port Thermometer

I wanted an easy / cheap way to record the temperature in my room, near my bass (to prevent cracking), in Mike's terrarium (to keep him alive), and throughout the house. I found a blog post describing exactly how to do this for less than $1 in components. So last weekend I stopped by HSC in Santa Clara and picked up the necessary parts.

1 Thermister (1K Ohm or more)
1 Capacitor (100 uF or more)
1 Diode (D6520 though many others will work)
1 Female DB-9 (Serial Port) Connector and some wire (from an old Ethernet cable)

A resistor's resistance varies with temperature which we attempt to minimize in normal resistors. A thermister is a special case where this effect is not limited. Therefore if we can measure the resistance of the thermister we can figure out the temperature.

In this circuit we charge the the capacitor through the resistor. We can time how long it takes the capacitor to charge using the serial port. From that we can extrapolate the temperature. So I soldered it all together, wrote a program to measure the charge time, calibrated it and got the finished product below!


Now I can install these all over the inside and outside of my house, in my car, and anywhere else I have a computer. For those who know me, that's everywhere! Over the past two days I put the lead outside and recorded the temperature every minute. I ended up with a pretty cool graph.


I've marked night and day and we can see the temperature fluctuate with sunlight. However, despite what the graph says it did not get to 85° F yesterday! The graph shows a sharp increase at 12:47 PM and erratic data for the next 3ish hours (highlighted). As it turns out, this comes as a result of direct sunlight hitting the thermister (hence why the news always reports temperature in the shade).

Next steps for me are to automatically generate graphs like this online and write an Instructable describing the process in a bit better detail.

Technologies: Basic Electronics, Python