Arduino Mega + HMC5883L compass

Digital 3-axis compass

Photo

I2C protocol3.3 volts

I wanted the Ardunio to be able to detect the direction it is pointing - thus a compass. This module is not a Tilt Compensation Compass. For a yacht which heals, I thus do not recommend its use.

The Arduino Mega has pins 20 and pin 21 for the i2C SDA and SLC connectors.

Fritzing

Sketch