This guide shows how to use a BerryIMU and a small TFT to create a digital compass, similar to those that can be found on smartphones.
- The TFT used in this guide is a PiScreen
- The IMU is a BerryIMU – Magnetometer, gyroscope, accelerometer and pressure sensor
- SDL is used to display the output to the TFT
- Tilt compensations is used
- A low pass filter is used to reduce noise
- Compass calibration is needed
If you don’t a small TFT like the PiScreen, you can still use this guide to display the output to a monitor via HDMI.
Git repository here
The code can be pulled down to your Raspberry Pi with;
The code for this guide can be found under the compass_tutorial04_graphical_output directory.
Prerequisites for this guide;
- A working TFT (not covered in this guide)
- A working magnetometer (compass) with tilt compensation. A guide can be found here
- Understand how to perform Hard Iron calibration. A guide can be found here
We will be covering some basic SDL which will be used to produce our graphics.