Running Routes in Google Earth

This is the beginning of what I hope will be a continuing series of posts on running routes and viewing them in Google Earth. I’ve become an avid runner over the past couple of years, and combined with my (time-consuming) fascination with Google Earth, recently found you can export runs from to Google Earth Keyhole Markup Language (KML & KMZ) files. This then allows the 3D viewing of routes as well as additional elevation profile information.

Why blog and post these Google Earth Running Routes? They provide:

  • Running routes viewable in three dimensions
  • Precise routes even in heavily wooded areas that would otherwise obscure the path
  • Precise lengths
  • Elevation heights and elevation slopes for individual peaks
  • View of all routes in relation to each other when sufficiently zoomed out

The vast majority of routes will be from the Northern California San Francisco Bay area, because that is where I am located. As I occasionally make forays elsewhere I will include those as well. I am also very open to guest posts with their own running routes. First up is a five mile run in the Santa Cruz Mountains in the Quicksilver Almaden County Park, San Jose. This route is in the northern part of the park and includes the Senador Mine, Guadalupe, Cinnabar, New Almaden, and Mine Hill trails. The elevation gain/loss is 1298′. The KMZ is here.

The Quicksilver Almaden CP is one of my favorite places to run as it’s close to my home, is popular with hikers and runners, includes both (usually dry) grassy as well as heavily wooded areas, and has a variety of terrain with altitudes ranging from 285 to 1730 ft. Load up Google Earth and from the File menu in the upper left select “Open…”. Locate the downloaded KMZ file and double-click on it. Enjoy in 3D splendor! Right click on the path and select ‘Show Elevation Profile’ and you should see something like the following:

Clicking and dragging through the Elevation Profile graph will select that region and show the elevation details for that region. This is useful for determining the percent slope of a particular hill.

3D TicTacToe – 3. Programming the Arduino To Play

The continuation of my 3D TicTacToe LED Matrix project.  See Introduction and Part 2.

Download the code directly here: LED_Matrix_TTT4.pde

Some general notes:

1. The AI is based on game theory taken from a book I read about 20 years ago. Unfortunately I don’t remember the name of it. It uses a Minimax algorithm as well as Alpha-beta pruning to decrease the number of nodes that need to be evaluated. Wikipedia offers a concise description of these with many external links. I spent about a month learning the algorithms and coding them, so I’m sure they can be greatly enhanced, especially since more than 20 years has past. However, I am proud to say that pitting this program up against another 3D TTT I found online, that mine trounced the other.

2. I wanted the LED matrix cube to be constantly displaying the player LED spot selection, the current cube moves, or the computer thinking (LEDs going on and off). In order to do this, even while the Arduino is off doing other things, I needed to use interrupts.  Using the MsTimer2 library I was able to set up a routine, disp_LED_cube, that was called every 200 ms with 1 of 4 states:

  • state 0: Default display of all moves
  • state 1: setting up player’s move
  • state 3: blinking last computer move
  • state 4: computer “thinking”

3. The current program uses a keypad to make the moves. The keys 1-4 are for selection of the player’s move. It first uses a ‘wall’ to select the z-direction, with the keys moving the wall. After the proper wall is selected, the ‘5’ key will then lock-in that wall, and display a column that represents the y-direction. Again, the 1-4 keys allow for the selection of the wished-upon column. Player then pushes ‘5’ key to lock-in column. Finally, user selects for the specific LED in column they wish to use as their move. Pressing the ‘5’ key will begin the Arduino deciding its move. I’m currently working on code to use a thumbstick rather than the keypad.

4. The code is GPL. Please use it as you like and definitely improve upon it. I would, of course, really like you to credit me for the work I’ve put into it should you use it.

Continue reading ‘3D TicTacToe – 3. Programming the Arduino To Play’ »

3D TicTacToe – 2. Developing The Protoboard To Control The Matrix

The continuation of my 3D TicTacToe LED Matrix project.  See Introduction and Part 1.

The 4x4x4 LED matrix is controlled by a Maxim MAX7219 display driver IC.  Using the MAX7219 reduces the number of Arduino pins needed to control and power the matrix from 16 down to 5.  The 3D TicTacToe sketch uses the Arduino Matrix library by Nicholas Zimbetti and simple coding from his hello_matrix sketch.  This library should already be included with all up-to-date arduino installations.  The design of the protoboard is based on Michael Margolis’s Arduino Cookbook project 7.13 “Controlling an Array of LEDs by Using MAX72xx Shift Registers” and the Maxim MAX7219 datasheet.

Shopping List:

  • printed circuit board
  • MAX7219 display driver IC
  • 33 kΩ resistor
  • 0.1 μF capacitor
  • 10 μF capacitor
  • 24 AWG solid wire in various colors (I used 22 AWG and the resulting LED matrix / protoboard connection is extremely stiff)
  • box with lid (I used a $2 white cigar box from Michaels)



To power the matrix connect the Arduino’s 5V pin directly to the MAX7219 V+ (pin 19) and through a ~30 kΩ resistor to ISET (pin 18).  I used a 33 kΩ resistor on mine.  Connect the Arduino’s GND to the MAX7219 GND pins (4 and 9).  Insert 0.1 and 10 μF capacitors between the 5V and GND to prevent noise spikes.

To control the matrix connect Arduino pins 4, 5, and 6 to the MAX7219 pins 12 (LOAD), 13 (CLK), and 1 (DIN), respectively.

The anode wires of the LED matrix will be connected to the MAX7219 SEG pins A-G, plus SEG DP, while the cathode wires will be connected to DIG pins 0-7.  Use 24 AWG wires that are long enough to reach where they need to go on the LED matrix.  Mine were a bit long at ~20 cm, but the extra should fit in the box you use or can be trimmed later.  I suggest using one color for the anode and a different color for cathode.  Solder 8 wires of one color to SEG pins A-DP and the 8 other wires to DIG pins 0-7.

If you want a nice looking 3D matrix display you’ll want a box to contain the Arduino, protoboard and wires, and a top for the LED matrix to sit on.  I used the same printout as used to drill the board holes to determine where to drill small holes in the cigar box top for the wires.  You’ll only need the seven side holes, but make the corner hole about 1.5x as big as the others.  Once the wires are soldered to the protoboard, thread them through the appropriate holes of the cigar box top.  Connect the wires to the appropriate lines on the LED matrix.  You’ll probably want to attach the wires temporarily to the LED matrix for testing before permanently soldering them.

Below are shots of the protoboard.  I know they’re difficult to make out with the gaggle of wires everywhere, and so I’ve taken shots from various directions.

Shot A:

shows 33 kΩ resistor from pin 18 to 5V, and pin 19 straight to 5V.

Shot B:

difficult to see pins 4 (buried) and 9 to GND

Shot C:

MAX7219 pins 12 (LOAD) and 13 (CLK)

If you have any questions, need further assistance or require additional pictures or diagrams, please let me know in the comments and I’ll do my best to address them.

Up Next: Programming the Arduino To Play 3D TicTacToe


3D TicTacToe – 1. Creating the 4x4x4 LED matrix

1. Creating the 4x4x4 LED matrix

The continuation of my 3D TicTacToe LED Matrix project.  See Introduction.

The matrix is based on an 8×8 LED matrix design, where it’s been divided into fourths and wired to work on four levels. Here’s a diagram of an 8×8 matrix: 8x8 LED matrix The structure of the 3D matrix is entirely composed of the anode LED leads soldered together, the cathode LED leads soldered together and a few extra wires to make connections. Here’s a picture of the semi-final product (note: from a previous build):


Four 4×4 LED matrices need to be created. Practically any LEDs will do, as I initially just used the cheapest ones I could find, but the current build is using 350 MCD yellow ones (see shopping list). Note also that different LEDs have different lead lengths. You want lengths that are 25 mm or more. I tried using shorter length LEDs, but the resulting matrices were too small to work with. My 4×4 matrices are modeled after the above 8×8 matrix. There’s an project by Electronics Man where he suggests drilling holes in a board to place the LEDs properly aligned at the correct distances from each other. I used his example to make the board and securely place the 16 LEDs for soldering. However, I believe his overall LED matrix design is different from mine, and will likely not work with the circuitry and software used in my project. Here’s an OpenDocument drawing template of the 21 mm-spaced LED matrix holes that I printed out and taped on the board. I then used a punch to make a small dent at each of the sixteen points before drilling. I used a hand-powered drill starting with the smallest size drill bit and worked up in bit size until the LEDs fit snugly into the holes.

Fit the LEDs into the holes with the cathode (shorter) leads above the anode leads at about 45 degrees.


Bend the cathode leads down right at the base and push them so they’re all pointing to the top of the board.


There should be plenty of space between the anode and cathode leads. Now with small needle nose pliers bend the anode (longer) leads about 3 mm above the LED base – perpendicular to the cathode leads. They should be well above the cathodes.


Adjust all of the leads so they overlap appropriately and solder them together. Gently prod out the LEDs from the other side of the board, and you should have a very stable 4×4 matrix. Make three more identical matrices, except two should have the cathodes pointing down instead of up.  The two pointing down are levels 1 & 3, the the two pointing up are levels 2 & 4.

The four matrices now need to be soldered together. I differentiate between the LEADS (the extra lead sticking out that’s not soldered to the next lead) and the LINE of soldered-together leads. It’s not straight forward so consult the following:

Top Level 4 Anode Leads:  attach to anode line of Level 3.  Bend the leads down so they can be soldered to the level below.  Note that you can attach additional anode connections anywhere along the Level 4 anode line to the corresponding anode line below it on Level 3 – this will add support to the structure (see picture below).

Top Level 4 Cathode Leads: attach to cathode line of Level 1 (bottom).  Do this last, after all of the other levels have been soldered together.  You’ll need to use wire to make the connections long enough.  I recommend 24 AWG.

Level 3 Anode Leads: leave alone for now.

Level 3 Cathode Leads: attach to cathode line of Level 2.  As before, bend the leads down so they can be soldered to the level below, and attach addititonal cathode connections to support structure.

Level 2 Anode Leads: leave alone for now.

Level 2 Cathode Leads: leave alone for now.

Bottom Level 1 Anode Leads: bend leads up to solder to Level 2 line.  Attach additional anode connections to support structure.

Bottom Level 1 Cathode Leads: leave alone for now.

I’ll admit soldering the levels together is much more of an art than a science.  It’s warping a single 8×8 matrix into 4 levels and you need to be careful to solder the correct leads and lines. I still haven’t developed a technique that I’m really happy with.  This picture shows the final soldered together structure including a support attachment: 

Once all of the levels have been soldered together, and a few structural connections added for stability, the wires that connect the matrix to the controlling prototype board can be added.  I used 8 green for the cathodes and 8 red for the anodes.  Make the wires long enough to reach the board – I suggest starting with 25 cm to be sure it’s long enough.  Use somewhere around 24 AWG solid (not stranded) to make it somewhat pliable.  Solder these wires to the leads above that were left alone.  Finally, clip all extraneous leads and wires off the matrix.  Finished matrix: 

Up Next: Developing The Protoboard To Control The Matrix


3D TicTacToe on a 4x4x4 LED Matrix

Here’s a project that I’ve been working on for over a month. It’s an Arduino controlled and AI-playing version of TicTicToe, where the “board” is a 4x4x4 matrix using 64 LEDs. Now, LED matrices have been done before with sizes anywhere from 3^3 to 8^3 (…). And 3D LED matrix versions of TicTacToe have also been done (…). But, I believe this is the first 4x4x4 LED matrix of TicTacToe that actually plays the game against you. And unless you’re very, very careful, it will beat you.

The project has several parts to it:

  1. Creating the 4x4x4 LED matrix
  2. Developing the protoboard to control the matrix
  3. Programming the Arduino to play 4x4x4 TicTacToe
  4. Figuring out how to select player moves


In the next several posts I’ll go over each aspect of the project, so that if you’re interested you can create your own (and hopefully modify to make even better!). The source code for the game-playing AI is included as well. Note that I’m new to soldering, wiring and electronics in general, so it took me dozens of hours to design and put together a functioning semi-final product. There were frustrating hours where the LED matrix was unstable and some LEDs weren’t lighting up; I destroyed two $8 MAX7219 ICs I’m guessing from either static electricity or short-circuiting; I initially used cheap 26 AWG stranded wire where the thins strands short-circuited the matrix; etc. Also, I made extensive use of Michael Margolis’s Arduino Cookbook, especially for controlling the matrix and putting together the electronics. It’s a great book and I highly recommend it.

Shopping List

(I used mostly Jameco because it’s local, but of course there are dozens of other great online stores to get these from):

  • Arduino Uno, Jameco #2121105
  • LEDs x64, Jameco #333622 – you’ll probably want 70+ for testing, mistakes; the leads on these are 1.1 cm, the longer the better
  • MAX7219 IC, Jameco #312160
  • keypad, Jameco #2082206
  • printed circuit board, Radioshack #276-150
  • 330k ohm resistor
  • 10 μF capacitor
  • 0.1 μF capacitor
  • 24 AWG solid wire in various colors
  • box with lid (I used a $2 white cigar box from Michaels)

Check out the upcoming posts for more details…

Video of it doing its thing:

What Matters 2 Up & Running

What Matters 2 was down for several months due to a complete server overhaul, and technical issues with virtual hostnames.  The good news is that it’s back.  Also, I’ve recently acquired an Arduino Uno and become completely addicted to it and electronics in general.  In fact, the main reason this site is back up and running was the desire to include Arduino and other “Maker” projects on it.  My plan is to do lots of Arduino posts of various projects of mine and others, Arduino news and Arduino-related things.  The larger community of Makers is also of great interest.  In fact the 2011 Bay Area Makers Faire is May 21 & 22, and I am very excited to be visiting it for the first time.  Expect more posts on it!


XBMC on the Acer Aspire Revo 1600 HOWTO

So you’ve heard about running XBMC on the Acer Aspire Revo 1600 and you need more info. You’ve come to the right place! This is an attempt to give a HOWTO on taking a new Revo, installing Ubuntu Karmic 9.10 and XBMC, and tweaking it so that the Nvidia Ion graphics chip does the decoding (VDPAU) for smooth playing of even HD videos. Also, it includes setting up audio over HDMI.

As you’ve probably heard, the Revo gives you more than your usual money’s worth by including an onboard Nvidia Ion graphics chip. The Nvidia engineers have very kindly released drivers which allow the graphics chip to do the video decoding rather than bogging down the rather slow Intel Atom 230 CPU with the chore. This results in only ~20% CPU utilization with near flawless playback of HD videos, instead of 100% CPU overload and very choppy video. A $200 computer that can do this is a very good deal.

I recommend a full install of Ubuntu Karmic 9.10. Other sites have instructions for installing a “minimal” gnome setup. I think this is silly. It strips the system of a host of useful applications, while providing non-discernible “improvements”. With the normal full installation of Ubuntu not only will you be able to play video and audio (movies and music) files, but should you choose, also browse the Internet, do email, perform normal office tasks (word processing, spreadsheets, presentations) and more. Provided, the Acer Revo is not a powerhouse and I wouldn’t recommend it for editing photos or videos.
Continue reading ‘XBMC on the Acer Aspire Revo 1600 HOWTO’ »

Developing RAW Photos under Ubuntu

I just spent way too much time trying to figure out how to process RAW photos under Ubuntu. There’s tons of discussions and websites with very little concrete information. After much digging it comes down to just this:

sudo apt-get install gimp-ufraw
(typed in a terminal window)

Gimp will now see and open RAW files. The RAW files will first open up into a UFRaw plugin dialog. In this dialog you can adjust color balance, exposure, curves, etc. Selecting ‘OK’ then imports the image into the normal Gimp editing window.

I’m using a Nikon D70 DSLR camera with NEF RAW files and everything worked flawlessly under the just released Karmic Koala Ubuntu 9.10.

Kubuntu / Windows XP Dual Boot on Asus Eee PC 1000

This is a HOWTO on installing Kubuntu 8.10 and Windows XP as dual booting systems on an Asus Eee PC 1000.  As you probably know the Eee 1000 is advertised as a 40 GB SSD.  It is not.  It has both a (fast write) 8 GB SSD and a (slow write) 32 GB SSD.  I wanted my Linux Kubuntu on the fast drive, and M$ Windows as well as the /home directory and swap partition of Linux on the slower drive.  For my particular needs I believe what I’ve stitched together is the most simple and elegant.

Continue reading ‘Kubuntu / Windows XP Dual Boot on Asus Eee PC 1000’ »

NaNoWriMo is short for National Novel Writing Month. According to its website “National Novel Writing Month is a fun, seat-of-your-pants approach to novel writing. Participants begin writing November 1. The goal is to write a 175-page (50,000-word) novel by midnight, November 30.” and “Because of the limited writing window, the ONLY thing that matters in NaNoWriMo is output. It’s all about quantity, not quality. The kamikaze approach forces you to lower your expectations, take risks, and write on the fly.”

It sounds like a heck of a lot of fun to me, and since I’ve always wanted to write my own Great American Novel, I’ve signed up! I plan on blogging about my experience here, and even putting up my nightly additions to the novel (possibly in a separate self-contained website). Stay tuned as the writing commences at midnight November 1st..

Ever wanted to write your own novel? Get more information at