Tilt Compensated Compass With LSM303DHLC

In this Instructable I want to show how to use the LSM303 sensor to realize a tilt compensated compass. After a first (unsuccessful) attempt I dealt with the calibration of the sensor. Thanks to these, the values of the magnetometer have improved significantly. The combination of calibrated values from the magnetometer and accelerometer then resulted in a tilt compensated compass.
What you need:
1 Arduino Uno
1 LSM303DHLC Breakout
1 Breadboard
1 Resistor 220 Ohm
1 Potentiometer 10k
1 2x16 LCD in 4-bit mode
1 Cardboard case
1 Compass
1 Protractor
Some wires”