Sunday, August 15, 2010

Park in the shade

Last Summer I worked at an office building in California. It was a pretty normal 9-5 programming job. My car would roast out in the parking lot. I started parking in the shade, but by 5 pm, the car was back in direct sunlight. Apparently, the shade moves throughout the day. Rather than park where the shade is at 9am, I set out to park where the shade would be by 5 pm so my car would cool off a bit. After some trial and error I figured out which parking spots where good to park in. It as always the spot next to where the shade currently was. Usually the one on the east side, but it was always hard to figure out which direction was which.

I took a class last fall called History of Creativity. We had a final "Creativity" project which could be anything we wanted that we could somehow relate to something we studied. I decided to build a webapp. "Park in the Shade" I called it.

I got an A!

I used Google App Engine and Python as the backend. The calculations start with a zipcode, and convert that to latitude and longitude using a look up table. The angle of altitude and angle of azimuth are then calculated using the given time interval, and the graphic is manipulated accordingly.

Friday, August 13, 2010


So lately I've been playing with a new toy: The Arduino. It's a microcontroller prototyping board. Quite fun. I bought a kit which came with all sorts of sensors and LEDs/motors/etc.

So the first real project (other than making lights blink in fun patterns) was a thermostat for our air conditioning. Here's a little description of the layout:

Temperature Sensor - basically a thermal resistor. Every degree Celsius translates to a 5mV change in voltage.
Potentiometer - a variable resistor, most frequently used in stereos for volume control. (Think walkman wheel control)

8 LEDS (4 Green, 4 Red) - This is my crude display for binary/ hex data. The red lights display one hex digit, the green the other. This displays the current value the potentiometer is set at (the triggering temperature);
Servo Motor - I have this motor set to turn 100 degrees in the event that the temperature is too high (turning on the A/C) and turn back if it drops down again.

The code is pretty simple. Read in the values, tweak the numbers a bit so they are in the range we want them to be. Then there's a simple if/else statement dealing with the temperature. I have it polling every second, but in reality I could probably lower it to once a minute.


EDIT: after leaving it to run overnight, I found it not working in the morning. My wife suggested that it drained the battery. After looking at it, I think having it poll so often uses way too much power. I switched it to be powered off of USB instead, and changed the polling interval to 5 minutes.


Servo myservo;
int leds[] = {2,3,4,5,6,7,8,9};
int control = 1;
int temp = 0;
int pos = 0;
int sensorValue = 0;

void setup(){
for (int i = 0; i < 8; i++){

void loop(){
sensorValue = analogRead(controlc);
int maxTemp = sensorValue / 10 + 10; //(use F values between 10 and 112)
float temperature = analogRead(temp) * .004882814;
temperature = (temperature - 0.5) * 100 * 1.8 + 32; // convert to F
if (temperature > maxTemp){
} else {

void writeFF(int a){
int values[8];
for(int i = 0; i < 8; i++){
values[i] = a % 2;
a = a / 2;
for (int i = 0; i<8;i++){

Wednesday, August 11, 2010

CouchDB..... Relax....

I just signed up for a free account at to play with couchdb.

I started using couchapp to manage my project.

In less than 50 lines of javascript ( with lots of whitespace) I built a simple, yet functional chatroom.

I didn't bother to adjust the default couchapp template.

Check it out.

New Blog

So I am starting a blog. It's not a place for social commentary. It's not a place for family photos. I'll let my wife handle that. This blog exists as a place to dump ideas. To post about projects. To discuss new "toys" in both the software and hardware worlds. Feel free to tell me my idea is terrible (please include some details) or tell me what you like about it. Please make suggestions for improvements. Thanks!