This is a revised design of a small tilt-compensated compass previously described in this blog (the compass was based on the Pololu LSM303D carrier board that has been discontinued).
The new design uses separate Pololu carrier boards for the LIS3MDL magnetometer and for the LSM6DSO accelerometer. Pololu also sells a carrier board combining the 2 chips, but the board does not expose all the SPI and interrupt pins that I use in my implementation.
The 2 carrier boards are hard-wired to an Arduino Pro Mini 328 - 3.3V/8MHz from Sparkfun.
With the LIS3MDL magnetometer, it is now possible to get an output data rate of 10 Hz in the highest performance mode. The previous LSM303D magnetometer was limited to 6.5 Hz in its high performance mode.
Here is the wiring diagram for SPI communication. The FTDI breakout is used to program the Pro Mini and to read the magnetometer and accelerometer raw data during the calibration step.