Compass is a device that helps to find a direction with a help of magnetic field. Old fashioned compasses use magnetic needle that orients itself along magnetic field of the earth. Modern ones use digital magnetic sensors that come in small package and can measure magnetic field in 3D. The following project, made by mi.vasilakis, instructs on how to build a simple compass by using Arduino UNO, HMC5883L 3-axis magnetic sensor and Nokia 5110 LCD.
Magnetic sensor is interfaced via I2C. Programming is also easy with Arduino libraries for both – magnetic sensor and LCD. Magnetic compass code supports two display modes – graphical where virtual magnetic needle is simulated; another mode is with linear scale and angle information. He put all electronics in custom made balsa enclosure along with some basic controls.