This week, from Honeywell, an application note on building a digital solid-state 2-axis compass:
Reference Design: Low Cost Compass
This design uses the HMC1052 sensor. You can get that sensor, the processing circuitry AND the microcontroller all rolled into one I2C-addressable package as the HMC6352 – a bit of a pain to solder but VERY easy to use. Currently about $40 from Digikey Canada.
The main disadvantage of this arrangement is that it requires the unit to be basically perfectly level for the reading to be good. If you want to accomodate some tilt, the Honeywell HMC1055 sensor kit is what you need: an HMC1052, an HMC1051 (for Z-axis) and a MEMSIC accelerometer for tilt. Available cheap from Digikey, just add microcontroller (and code, and opamps, etc.)
3-Axis Compass Sensor Set HMC1055
For all that compassy and tilty goodness in a single I2C-addressable package, you want the HMC6343, which at $166 from Digikey right now, is an obscenely expensive way to do it, but nice and self-contained.