## Monday, May 7, 2012

### DIY: Custom Graduation Photo Cards

 The final result of my DIY photo card adventure
Since I'm graduating this May, I decided to send out a special graduation thank you note to my friends and family. I started using the photo card creator on the Walgreens website but quickly got frustrated with the lack of customization tools. Specifically, I wanted custom fonts and also to change font colors within a text box. Being an incurable DIYer, I thought to myself: "I can make this myself in GIMP and customize it all I want!"

What size card? I started with the assumption that the card would be 5x7 inches, but I changed my mind when I realized I only had letter envelopes (4 1/8 x 9 1/2) which wouldn't fit a 5x7 card. So, I switched to a 4x8 inch card which would fit in a letter envelope. Ultimately, the website where I ordered my prints supplied me with envelopes for free so this was all for naught, but I'm still glad I went with the 4x8 format.

What resolution? For photo prints, you need a pretty high resolution for the photo to look good. For my 4x8 card, the GIMP "canvas" was 2880x1440 pixels.

What design? I came up with a template for my card:
 General template for graduation photo card (2880x1440 px)
In general, pictures on the right and text on the left. I thought that four pictures of myself looked a bit vain, so I made the smallest frame an "object" picture. For my object, I used a cool picture of the golden gate bridge. The  outside black border is 20 pixels and the inside "framing" is 10 pixels.

You might notice a blank black area on the far left side which seems unused. This is a actually a buffer area to make sure the text won't get cut off during printing. The size of buffer you need depends on who you're ordering prints from. With pictures, having the edges cut off is not not the worst thing in the world, but text becomes unreadable with missing letters. I would say a good rule of thumb is to reserve 6% of the total width and height for a buffer. That is, 3% of the total width reserved on both the left and right and 3% of the total height reserved on both the top and bottom. Trust me, it's better to be safe than sorry (see below):
 Edge text cut off on prints=FAIL!
How to put it together? I'm no GIMP expert, so perhaps someone can offer a better way to do it. But I simply created a black "frame" layer with transparent squares at the photo locations. This part took a bit of planning and some back-of-a-napkin calculations, but it wasn't too hard. As a sidenote, I found "Guides" to be especially helpful to line things up appropriately. Try selecting one of the transparent squares and going to Image>Guides>New Guides From Selection. This will create four Guides; one for each side of the square.
 GIMP-tastic photo editing fun
Once you have the frame completed and the pictures you want picked out, open the pictures as new layers. Then you need to adjust the pictures to the right size and frame them in the square the way you want.

The main paragraph of text is simple - just use the text tool. One tip: make the fancy text stuff on a separate GIMP canvas and import the final product into your card canvas. I did that for the "Thank You" header and the major and school overlay at the bottom.

Where to print it? It was surprisingly hard to find a site that will make 4x8 custom prints. I finally stumbled upon artscow.com and ordered from them. They have an elaborate client card designer, but all I did was upload my image, place it on a card and select "Apply to All." I ended up ordering 30 cards and it cost about \$15 including shipping.

I received my package in the mail about 2 weeks later, sent from an address in Hong Kong. The package included all of my cards, nicely wrapped and 30 envelopes to send my cards in. I was very satisfied with the whole process.

Did it save money? No.

Did it save time? No.

Was it worth it? Yes.
 Another view of the final product

## Wednesday, May 2, 2012

### Interesting Infrastructure: Caltrans and Music Notes

These photos are from Cotati, CA in the northern bay area. As you can see, Caltrans incorporated a music note motif into their new overpass project. Since Cotati is sort of a hippie town, and also home of an annual Accordian Festival, it fits the local vibe. The motif has a treble clef sequence and a bass clef sequence, and they appear on the sound walls, the retaining walls and on the actual overpass. I alternate between thinking this is really cool and thinking it is a huge waste of money, but here are the pics anyway:
 Sound wall in final stages of project
 Overpass with alternating design

## Friday, March 30, 2012

### GIMP: Adding New .gpl Palette

Palettes are very useful if you want to have a consistent color scheme. I find that having good colors readily available helps in the creative process as well. You can find great user-created palettes for free at kuler.com (link) and colourlovers.com (link); using these palettes can give your project a very professional look.
 Palette dialog

The easiest way to import a palette is to simply drop the file in the the file system GIMP created when it was installed. On Windows XP, the file would be: C:\Documents and Settings\<fill in user name>\.gimp-2.6\palettes. On Mac OS X, it would be: Users/homefolder/library/applicationsupport/ GIMP/palettes. I am not familiar with the location on other operating systems but if you look around a bit it should be obvious. Note that the file must have the file the extension .gpl to work. Also, you must restart GIMP for the palette to show up.

An alternate way to add palettes is to use the user interface. Since this does not depend on the file structure, it should be valid for all operating systems. From the image window, go to Windows>Dockable Dialogs>Palettes and click to open the Palettes dialog. On the Palettes dialog, click on the little arrow on the top right. This brings up a menu where you go Palettes Menu>Import Palette. From here, you simply select "palette file" as the source and browse to the desired .gpl file.

FYI, I used GIMP 2.6.11 for this tutorial.

 Import New Palette dialog

## Wednesday, March 21, 2012

### Arduino: Sending Hex Bytes to Serial Devices

I have been working on a project which involves an Arduino communicating serially with an LCD display device. Through a lot of trial and error, I finally figured out that when you want to send a HEX-encoded byte from the Arduino, you need to use the Serial.write() command rather than the Serial.print() command. The Serial.print() command works find when you are sending an ASCII byte but it will not work when you try to send a HEX byte. The right and wrong ways are below:
//Serial.print('U');  <----right (ASCII)
//Serial.write('U');  <----also fine (ASCII)
//Serial.print(0x55); <----WRONG! (HEX)
//Serial.write(0x55); <----right (HEX)


Similar problem and solution: http://www.arduino.cc/playground/Learning/SparkFunSerLCD

## Thursday, March 1, 2012

### STK 200: First Program (LED Blink)

For this program, you should already have AVR Studio 5 and AVRISP-U installed on your computer. If you don't, visit my previous post Getting Started Programming Guide (link). This is a simple program which simply makes the built-in LEDs to blink. I'm going to use C for this program because the code looks really simple. The assembly version is not really difficult either but we'll keep it simple for now. Note that AVR Studio 5 has a built-in C compiler. You might remember for AVR Studio 4, you had to download AVR GCC and integrate it. If you downloaded AVR Studio 5, you already have the C compiler.

What will the program do? If you look at the STK 200, there is a row of 10 LEDs numbered from 0 to 7 then "ISP" and "ON." These are the built-in LEDs. Our program will make the LEDs numbered from 0 to 7 blink on and off at a rate perceptible to the human eye. In microcontroller terms, this means physically connecting the LEDs to PORTB and sending alternating HIGH/LOW signals to PORTB. Note that is all output - no input. If you don't know what PORTB is, check my Basic Layout Guide (link).

Step 1 - Create a new project: Go ahead and open AVR Studio 5. From the startup screen, go to File>New>Project... and you should see a New Project dialog box. At the top left of the dialog box, select the C templates and then choose "C Executable Project" in the middle of the screen. At the bottom, fill in "blink" as the name and this should automatically fill the solution name field with the same text. Also, make sure that the "Create directory for solution" box is checked. This checkbox will not affect your code at all, but it will keep your AVRStudio folder better organized. Look at the picture below and make sure your screen looks the same:
 STK 200: New Project Dialog Box

## Friday, February 17, 2012

### STK 200: Getting Started Programming Guide

To start programming the STK 200, you need to download some software. Namely, you need AVR Studio and AVRISP-U. I talked about the basic layout of the board in a previous post (link), so check that out if some of the terms I am using are unfamiliar. I broke the process into three steps below.

Step 1 - Download AVR Studio 5: I started programming with AVR Studio 4, but if you are starting today, you might as well start with the new AVR Studio 5 release. The program is built using the Microsoft Visual Studio Shell (VSS) so the user interface is very similar to Visual Studio. I suppose this can be a good thing for those who like Visual Studio and a bad thing for those who don't. Overall, it seems to have a lot of convenient features such as IntelliSense and debugging interface.

So to get the software, go to the AVR Studio 5 page (link) from Atmel and download the software package you need. I recommend downloading the package that includes VSS and .NET 4.0. The software is completely free but you do have to fill out a registration form. The installer is pretty big (the one including VSS and .NET is over 600 MB).
 STK 200: AVR Studio 5

## Tuesday, February 7, 2012

### Interesting Infrastructure: Mouse shaped wetland

Check out this satellite imagery from Petaluma, California, a city of about 60,000 people in the northern bay area. The city completed construction of a new wastewater treatment plant, the Ellis Creek Water Recycling Facility, in 2009 and they included some polishing ponds which had a very interesting shape. Environmental artist Patricia Johnson worked with the city and their consultants to make this wetland park a unique piece of artwork. The shape is a reference to the harvest field mouse, an indigenous species in the area near the Petaluma River. You can see the actual treatment facility towards the top right of the image.
 Mouse shaped wetland: Raw image
 Mouse shaped wetland: Mouse outlined

## Wednesday, February 1, 2012

### STK 200: Basic Layout Guide

The Kanda STK 200 has a lot of really cool features. But when I first got the board, I didn't even know where to begin. This post goes over the board's basic layout and the main features that it includes.

I/O: Really, the core function of a microcontroller is Input/Output. In fact, out of the ATmega32's 40 pins, 32 pins are set aside for I/O. They are organized into four 8-pin ports named PORTA, PORTB, PORTC, and PORTD. The STK 200 makes it really easy to access these ports by giving them each headers. The board even labels the headers using the standard naming convention established by the AVR family (PORTA, etc.). Each header includes it's own VCC and GND, which devices almost always require. LEDs and switches are probably the most common form of I/O; conveniently, the STK 200 has 8 LEDs and 8 switches built into the board. You can dedicate ports to the LEDs, the switches or both using a 10-pin ribbon cable provided with the board and pictured below. PORTB is lined up with the LED input header and PORTD is lined up with the switches output header for an easy connection.
 STK 200: I/O

## Friday, January 20, 2012

### STK 200: Switching Microcontrollers

When I bought my Kanda STK 200, it was shipped with an ATmega8515 microcontroller. While the 8515 is a fine microcontroller, I wanted to replace it with an ATmega32 due to the latter's more robust features.  Namely, the ATmega32 has 32KB of flash memory compared to the 8515's 8KB. Also, the 8515 has no built-in analog to digital or digital to analog conversion while the 32 does. If you are also interested in switching the microcontroller on the STK 200, here is a quick guide:

Sockets on the development board: When you look at the board, you can see various sockets. Check out the following image to see the available sockets and what their name is:
 STK 200: Sockets on the Development Board

## Wednesday, January 18, 2012

### Fundamentals of Engineering/EIT Exam Strategy

I wrote some general tips for the Fundamentals of Engineering Exam in a previous post (link). Here are test taking strategies to go along with those.

 FE Exam: Multiple Choice
Overall strategy: Become an expert in the subject areas that you are most familiar with and know the basics of all other subjects. There is a reason the engineering profession is split into specialties (civil, mechanical, etc); there is so much to know that it is almost impossible to be an expert in everything. Furthermore, we all have our own ways to solve problems. Those thought processes might work especially well on certain subjects and not so well on other subjects. I found that it is much more productive to focus on the subjects that I have a background in rather than try to learn an unfamiliar subject from scratch.

Guessing: The entire test is multiple choice with four possible answers. This means that if you completely guess, theoretically you have a 25% chance to get the correct answer. Further, if you are able to eliminate one of the possible answers, you now have a 33.3% chance to pick the right answer. Eliminating two possible answers leaves you with a 50% chance and, according to my study manual, a passing score on the FE Exam is a bit less than 50%. So, theoretically, if you were able to eliminate two possible answers for every question on the test, you should pass. Of course, this is not practical. In reality, there are some questions where you absolutely know the answer and some questions where you have no idea, but this does highlight the effectiveness of strategic guessing.