Using a magnetometer can be a little tricky, especially if you are unsure about the formulas to use to get the correct bearing and when other magnetic objects are interfering with your signal. You could download a arduino library for this module, which will also be compatible with other HMC5883L breakout boards made by other manufacturers.
Immersion Gold PCB, machine welding process to ensure quality.
Name: HMC5883L module (three-axis magnetic field module).
Power supply: 3V ~ 5V.
Communication modes: standard IIC communication protocol (3.3V~5V TTL).
Measuring range: ± 1.3-8 Gauss.
Size: 14mm x 13mm
Arduino GND -> HMC5883L GND
Arduino 3.3V -> HMC5883L VCC
Arduino A4 (SDA) -> HMC5883L SDA
Arduino A5 (SCL) -> HMC5883L SCL
Library and Test code
Relays, Motors, Motor drivers, Pumps & Valves