This 3 axis digital compass is based on HMC5883L. Communication with the HMC5883L is simple and all done through an I2C interface. Voltage of 2.16-3.6VDC should be supplied.
- Simple I2C interface
- 2.16-3.6VDC supply range
- Low current draw
- 5 milli-gauss resolution
How to use compass with arduino?
Connect the compass as shown in figure below
Note: for the code above, the connections MUST be :
Arduino GND ---------> HMC5883L GND
Arduino 3.3V ---------> HMC5883L VCC
Arduino A4 (SDA) ---> HMC5883L SDA
Arduino A5 (SCL) ---> HMC5883L SCL
Watch how to use video below