This 3 axis digital compass is based on Honeywell HMC5883L sensor.The magnetometer or digital compass sensor is used to measure the heading angle (angle from the north), This is done by measuring both the direction and the magnitude of Earth’s magnetic fields, from milli-gauss to 8 gauss. 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
Upload and run this arduino code, click here
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