# Qualia S3 Compass

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/127/122/medium800/lcds___displays_edited_P1440235.jpg?1705715250)

This compass project will help you keep your bearings as you travel north, south, east or west. A Qualia S3 running CircuitPython displays the compass rose on a beautiful round display, and updates your heading in degrees as you wander thanks to a built in magnetometer.

Thanks to the 'everything built in' Qualia board, and Stemma QT sensor, no soldering is required.

There are two options to view the compass: with the compass rose rotating or with your heading rotating. You can switch between the two views by tapping on the touchscreen.

![lcds___displays_displaySwap.gif](https://cdn-learn.adafruit.com/assets/assets/000/127/172/medium640thumb/lcds___displays_displaySwap.jpg?1706031322)

A 9-DoF sensor, mounted behind the Qualia S3, calculates the compass heading using a Mahony AHRS filter from the [AHRS CircuitPython library](https://github.com/gamblor21/Gamblor21_CircuitPython_AHRS) in the Community Bundle.

![lcds___displays_edited_P1440156.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/123/medium640/lcds___displays_edited_P1440156.jpg?1705715292)

## Parts
### Adafruit Qualia ESP32-S3 for TTL RGB-666 Displays

[Adafruit Qualia ESP32-S3 for TTL RGB-666 Displays](https://www.adafruit.com/product/5800)
There's a few things everyone loves: ice cream, kittens, and honkin' large TFT screens. We're no strangers to small TFT's - [from our itsy 1.14" color display](https://www.adafruit.com/search?q=1.14+tft) that graces many-a-TFT-Feather to <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/5800)
[Related Guides to the Product](https://learn.adafruit.com/products/5800/guides)
![Overhead shot of TFT driver board connected to a round TFT display, which says, "Hello world!"](https://cdn-shop.adafruit.com/640x480/5800-06.jpg)

### Round RGB 666 TTL TFT Display - 2.1" 480x480 - Capacitive Touch

[Round RGB 666 TTL TFT Display - 2.1" 480x480 - Capacitive Touch](https://www.adafruit.com/product/5792)
This is a screen for advanced hackers who like the look of a nice, round TFT screen with tons of pixels. The 2.1" diagonal sized display has 480x480 16-bit full-color pixels and is an&nbsp; **IPS** &nbsp;display, so the color looks great up to 80 degrees off-axis in any...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5792)
[Related Guides to the Product](https://learn.adafruit.com/products/5792/guides)
![Angled shot of round TFT display with 40-pin cable ribbon.](https://cdn-shop.adafruit.com/640x480/5792-03.jpg)

### Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU

[Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU](https://www.adafruit.com/product/4517)
Add high-quality motion,&nbsp;direction, and orientation&nbsp;sensing to your Arduino project with this all-in-one 9 Degree of Freedom (9-DoF) sensor with sensors from ST. This little breakout contains two chips that sit side-by-side to provide 9 degrees of full-motion data.

The board...

In Stock
[Buy Now](https://www.adafruit.com/product/4517)
[Related Guides to the Product](https://learn.adafruit.com/products/4517/guides)
![Angled shot of a Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU - STEMMA QT / Qwiic.](https://cdn-shop.adafruit.com/640x480/4517-07.jpg)

### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
![Angled shot of STEMMA QT / Qwiic JST SH 4-pin Cable.](https://cdn-shop.adafruit.com/640x480/4210-00.jpg)

### Pink and Purple Woven USB A to USB C Cable - 1 meter long

[Pink and Purple Woven USB A to USB C Cable - 1 meter long](https://www.adafruit.com/product/5153)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also made for USB C for our modernized breakout boards, Feathers, and more.&nbsp;&nbsp;[If you want something just like it but for Micro B, we...](https://www.adafruit.com/product/4111)

Out of Stock
[Buy Now](https://www.adafruit.com/product/5153)
[Related Guides to the Product](https://learn.adafruit.com/products/5153/guides)
![Angled shot of coiled pink and purple USB cable with USB A and USB C connectors.](https://cdn-shop.adafruit.com/640x480/5153-02.jpg)

### USB Li-Ion Power Bank with 2 x 5V Outputs @ 2.1A - 5000mAh

[USB Li-Ion Power Bank with 2 x 5V Outputs @ 2.1A - 5000mAh](https://www.adafruit.com/product/4288)
Here's a hand-held-size&nbsp;rechargeable battery pack for your&nbsp;[Raspberry Pi](http://www.adafruit.com/raspberrypi)&nbsp;(or&nbsp;[Metro](https://www.adafruit.com/category/17), or anything else that uses 5V!). This pack is intended for providing a lot of power to...

In Stock
[Buy Now](https://www.adafruit.com/product/4288)
[Related Guides to the Product](https://learn.adafruit.com/products/4288/guides)
![Angled shot of a USB Li-Ion Power Bank with 2 x 5V Outputs @ 2.1A - 5000mAh.](https://cdn-shop.adafruit.com/640x480/4288-05.jpg)

### Part: M2.5 Screws
quantity: 1
M2.5
[M2.5 Screws](https://www.adafruit.com/product/3299)

# Qualia S3 Compass

## Circuit Diagram

![](https://cdn-learn.adafruit.com/assets/assets/000/127/046/medium800/lcds___displays_compassFritz_bb.jpg?1705326809)

The LSM6DSOX+LIS3MDL breakout plugs into the Qualia STEMMA QT port with a STEMMA QT cable.

The round display plugs into the 40-pin display connector on the Qualia. More details about this are in the [Assembly page](https://learn.adafruit.com/qualia-s3-compass/assembly).

# Qualia S3 Compass

## 3D Printing

![](https://cdn-learn.adafruit.com/assets/assets/000/127/119/medium800/lcds___displays_edited_P1440190.jpg?1705714120)

The compass can be housed in a 3D printed enclosure that includes a top lid, back lid and mounting plate. It is a remix of the&nbsp;[Video Playing 2.1" Round Ornament TFT case](https://learn.adafruit.com/2-1-round-ornament-tft/3d-printing).&nbsp;

The STL files can be downloaded directly here or from Printables.

[compass_case_stl_files.zip](https://cdn-learn.adafruit.com/assets/assets/000/127/178/original/compass_case_stl_files.zip?1706034701)
[Printables Download](https://www.printables.com/model/735460-qualia-s3-compass)
The front lid has a cutout for the ribbon cable on the display. The back lid has snap fit tabs to close up the case.

![lcds___displays_edited_P1440181.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/120/medium640/lcds___displays_edited_P1440181.jpg?1705714127)

The mounting plate has M3 sized mounting holes to attach the 9-DoF sensor and Qualia S3.

![lcds___displays_edited_P1440188.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/121/medium640/lcds___displays_edited_P1440188.jpg?1705714183)

# Qualia S3 Compass

## CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## CircuitPython Quickstart

Follow this step-by-step to quickly get CircuitPython running on your board.

This microcontroller requires the latest **unstable (development)&nbsp;**release of CircuitPython. Click below to visit the downloads page on **circuitpython.org** for your board. Then, Browse **S3** under **Absolute Newest**.

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/adafruit_qualia_s3_rgb666/)
 **Click the link above to download the latest CircuitPython UF2 file.**

Save it wherever is convenient for you.

![install_circuitpython_on_most_boards_CircuitPython_downloaded.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/129/medium640/install_circuitpython_on_most_boards_CircuitPython_downloaded.jpg?1620922559)

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/124/831/medium800/circuitpython_bootloader.jpg?1696442767)

Plug your board into your computer, using a known-good data-sync cable, directly, or via an adapter if needed.

Double-click the **reset** button (highlighted in red above), and you will see the **RGB status LED(s)** turn green (highlighted in green above). If you see red, try another port, or if you're using an adapter or hub, try without the hub, or different adapter or hub.

Warning: 

For this board, tap reset and wait about a half a second and then tap reset again.

Warning: 

If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

A lot of people end up using charge-only USB cables and it is very frustrating! **Make sure you have a USB cable you know is good for data sync.**

You will see a new disk drive appear called **TFT\_S3BOOT**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **TFT\_S3BOOT**.

![circuitpython_Screenshot_2023-10-03_at_1.54.46_PM.png](https://cdn-learn.adafruit.com/assets/assets/000/124/832/medium640/circuitpython_Screenshot_2023-10-03_at_1.54.46_PM.png?1696442912)

![circuitpython_Screenshot_2023-10-05_at_10.20.11_AM.png](https://cdn-learn.adafruit.com/assets/assets/000/124/889/medium640/circuitpython_Screenshot_2023-10-05_at_10.20.11_AM.png?1696526572)

The **BOOT** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it!

![install_circuitpython_on_most_boards_CIRCUITPY.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/130/medium640/install_circuitpython_on_most_boards_CIRCUITPY.jpg?1620923145)

# Qualia S3 Compass

## Calibrating the Magnetometer and Gyroscope

To get accurate compass readings with an AHRS filter, you'll want to calibrate your sensor. There are a few different ways to do this. The following **calibrate.py** code lets you do it right in CircuitPython and allows you to copy and paste the calibration values into the **code.py** file for this project.

You can access the calibration code and necessary libraries by downloading the Project Bundle. To do this, click on the **Download Project Bundle** button in the window below. It will download to your computer as a zipped folder.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Qualia/Qualia_S3_Compass/ahrs_calibration/calibrate.py

## Upload the Calibration Code and Libraries to the Qualia S3

After downloading the Project Bundle, plug your Qualia S3 into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called **CIRCUITPY**. Unzip the folder and copy the following items to the Qualia S3's **CIRCUITPY** drive:

- **lib** folder
- **calibrate.py**

Rename **calibrate.py** to **code.py** to run the calibration code on your Qualia S3.

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/Qualia_Qualia_S3_Compass_ahrs_calibration.png )

## Running the Calibration

Once everything is saved to the&nbsp; **CIRCUITPY** &nbsp;drive,&nbsp;[connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console)&nbsp;to see instructions and data printed out for the calibration process.

First, the gyroscope is calibrated. To do this, you need to leave your sensor still on a flat surface. Ideally, it will be mounted in the enclosure. Next, the magnetometer is calibrated. You'll need to move the sensor around in 3D space to get a full reading range for the sensor. After both calibration processes are completed, the calibration data is printed to the serial console. You can copy and paste the `MAG_MIN`, `MAG_MAX` and `GYRO_CAL` arrays to your **code.py** file.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/171/medium800/lcds___displays_calibration_repl.png?1706023778)

# Qualia S3 Compass

## Code the Compass

Once you've finished setting up your Qualia S3 with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.

To do this, click on the **Download Project Bundle** button in the window below. It will download to your computer as a zipped folder.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Qualia/Qualia_S3_Compass/code.py

## Upload the Code and Libraries to the Qualia S3

After downloading the Project Bundle, plug your Qualia S3 into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called **CIRCUITPY**. Unzip the folder and copy the following items to the Qualia S3's **CIRCUITPY** drive:

- **lib** folder
- **code.py**
- **compass.jpg**
- **Roboto-Regular-47.pcf**

Your Qualia S3 **CIRCUITPY** drive should look like this after copying the **lib** folder, font file, JPEG file and the **code.py** file.

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/Qualia_Qualia_S3_Compass.png )

## Install the AHRS Library from the Community Bundle

This project uses one additional library from the Community Bundle: the [Gamblor21\_CircuitPython\_AHRS](https://github.com/gamblor21/Gamblor21_CircuitPython_AHRS) library. You'll need to&nbsp;[download the Community Bundle](https://circuitpython.org/libraries)&nbsp;and copy the / **gamblor21\_ahrs** &nbsp;library folder to your&nbsp; **/lib** &nbsp;folder or use&nbsp;[circup](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/overview)&nbsp;to install with:

`circup install gamblor21-circuitpython-ahrs`

## How the CircuitPython Code Works

At the top of the code, you can insert your magnetometer and gyroscope calibration values after running the **calibrate.py** script. Details for this are available on the Calibrating the Magnetometer and Gyroscope guide page.&nbsp;

Additionally, you can select whether you want to use the Mahony AHRS filter for calculating your compass heading by changing `ahrs` to `True` or `False`.&nbsp;

```python
# change these values to your calibration values
MAG_MIN = [-11.5902, -47.1353, -28.7635]
MAG_MAX = [79.7866, 48.0854, 63.461]
GYRO_CAL = [-7.3934, -0.000100605, 2.7703]
# use filter for more accurate, but slightly slower readings
# otherwise just reads from magnetometer
ahrs = True
center_x, center_y = 240, 240
```

## I2C

The 2.1" round display is instantiated with the Qualia library. `auto_refresh` is set to `False` to manually refresh the screen in the loop when rotating graphics with `rotozoom`. The I2C bus is instantiated through the library with `graphics.i2c_bus`. This allows for the LSM6SDOX and LIS3MDL to be instantiated over I2C and plug into the STEMMA QT port on the Qualia.

```python
graphics = Graphics(Displays.ROUND21, default_bg=None, auto_refresh=False)

i2c = graphics.i2c_bus
accel_gyro = LSM6DSOX(i2c)
magnetometer = adafruit_lis3mdl.LIS3MDL(i2c)
```

## Compass Rose

A `Palette` is created for the `vectorio` graphics used alongside the compass rose background image. The image is brought in as a JPEG image, which is a smaller file size than a bitmap. The compass rose is rotated using `rotozoom`, which requires some additional setup. Two blank bitmaps are created that are the same size as the compass image. `compass_blank` is made transparent by using the transparent `Palette` index. `compass_scribble` is passed to a `TileGrid` with the same `pixel_shader` as the compass image. Only the `tile_grid` is added to the `displayio` `Group`.

```python
group = displayio.Group()
# palette for vectorio graphics
pointer_pal = displayio.Palette(5)
pointer_pal[0] = 0xFFFF00
pointer_pal[1] = 0x000000
pointer_pal[2] = 0xFFFFFF
pointer_pal[3] = 0xFF0000
pointer_pal[4] = 0x0000FF
pointer_pal.make_transparent(0)
# compass image is a jpeg
decoder = JpegDecoder()
width, height = decoder.open("/compass.jpg")
bitmap_compass = displayio.Bitmap(width, height, 20)
palette_compass = displayio.ColorConverter(input_colorspace = displayio.Colorspace.RGB565_SWAPPED)
decoder.decode(bitmap_compass)
# blank bitmap for rotozoom
compass_blank = displayio.Bitmap(width, height, 1)
# carrier bitmap for compass for rotozoom
compass_scribble = displayio.Bitmap(width, height, 20)
tile_grid = displayio.TileGrid(compass_scribble, pixel_shader=palette_compass)
# only tilegrid is added to group
group.append(tile_grid)
```

## Circles

Next, two circles are created. The `header` circle is placed on the edge of the display relative to the heading from the 9-DoF sensor to let you know where the sensor is "pointing" when generating header information. This value is stored in `angle` and is used throughout the code.

The `center` circle is placed in the center of the display and acts as a background for displaying the header degrees text.

```python
radius = center_x
angle = 225
rad_angle = radians(angle)

# place small circle to denote heading direction from 9-DoF relative to display
circle_radius = 5
header_angle = radians(135)
edge_x = center_x + radius * cos(header_angle)
edge_y = center_y + radius * sin(header_angle)
adjusted_x = edge_x - circle_radius * cos(header_angle)
adjusted_y = edge_y - circle_radius * sin(header_angle)
header = vectorio.Circle(pixel_shader=pointer_pal, color_index = 2,
                         radius=circle_radius, x=int(adjusted_x), y=int(adjusted_y))

center = vectorio.Circle(pixel_shader=pointer_pal, color_index = 2, radius=50, x=240, y=240)
```

## Text

The `direction_text` is updated throughout the loop to show the compass degrees. Much like the compass rose image, `rotozoom` is used to rotate the `direction_text`. The width value of the text `bounding_box` is used for the dimensions for the `direction_blank` and `direction_scribble` bitmaps.

```python
font_file = "/Roboto-Regular-47.pcf"
font = bitmap_font.load_font(font_file)

direction_text = bitmap_label.Label(font, text="000", color=None)
direction_text.x = center.x - 40
direction_text.y = center.y
direction_bitmap = direction_text.bitmap

direction_blank = displayio.Bitmap(direction_text.bounding_box[2],
                                   direction_text.bounding_box[2], 1)
direction_scribble = displayio.Bitmap(direction_text.bounding_box[2],
                                      direction_text.bounding_box[2], len(pointer_pal))
direction_grid = displayio.TileGrid(direction_scribble, pixel_shader=pointer_pal, x=200, y=200)
```

## Pointer

A "line" is used to denote heading direction in both compass views. This line originates from the center of the display and rotates. To achieve this, a series of squares are created as **vectorio** `Polygon`s. The `create_line_of_squares` function initially creates the squares and `update_line_of_squares` is used to move the line by taking in the heading information. Initially, the line is drawn to point as the sensor's heading on the display.

```python
def create_line_of_squares(l, n, color):
    squares = []
    square_size = l // n
    for i in range(n):
        x = center_x + i * square_size
        y = center_y - square_size // 2
        square_points = [(0, 0), (square_size, 0),
                        (square_size, square_size), (0, square_size)]
        square = vectorio.Polygon(pixel_shader=pointer_pal,
                                  color_index=color, points=square_points, x=x, y=y)
        group.append(square)
        squares.append(square)
    return squares

def update_line_of_squares(squares, h, l):
    r = radians(-h)
    n = len(squares)
    square_size = l // n
    x = center_x - (square_size - 2)
    y = center_y - (square_size - 2)
    for i, square in enumerate(squares):
        offset_x = x + i * square_size - x
        offset_y = -square_size // 2
        rotated_x = offset_x * cos(r) - offset_y * sin(r)
        rotated_y = offset_x * sin(r) + offset_y * cos(r)
        square.x = int(x + rotated_x)
        square.y = int(y + rotated_y)

length = 200  # Length of the lines
num_squares = 20  # Number of squares for each line

vertical_squares = create_line_of_squares(length, num_squares, 3)
update_line_of_squares(vertical_squares, angle, length)
```

## The Loop

In the loop, touch is monitored as a toggle switch for the different compass displays. If `spin_rose` is `True`, then the direction line is pointed to the sensor's angle and the compass rose rotates relative to this angle. If `spin_rose` is `False`, then the compass rose remains static and the direction line rotates relative to the compass rose to show heading direction.

When `spin_rose` is `True`, the `direction_text` color is set to `None` so that the `rotozoom` bitmap of the text is visible. When `spin_rose` is `False`, the `direction_text` color is set to black, and as a result visible, because the text is not rotated in that mode.

```python
if graphics.touch.touched:
        spin_rose = not spin_rose
        # reset last_heading to trigger an update
        last_heading = heading + 5
        if spin_rose:
            direction_text.color = None
            update_line_of_squares(vertical_squares, angle, length)
        else:
            bitmaptools.rotozoom(compass_scribble, bitmap_compass, angle = radians(0))
            direction_text.color = pointer_pal[1]
        graphics.display.refresh()
        # touch debounce delay
        time.sleep(0.2)
```

Initially the magnetometer is read to calculate compass heading. If you have kept `ahrs` `True`, then the accelerometer and gyroscope are also read and passed to the `ahrs_filter` to calculate `yaw` for the compass heading.

If `ahrs` is `False`, then only the magnetometer data is used to calculate heading. This is less accurate than using the AHRS filter, but can be useful if you want to use a sensor that is not a 9-DoF sensor, like the LSM303AGR. It is also a little bit faster at generating a reading.

```python
if (time.monotonic_ns() - timestamp) &gt; 6500000:
        mx, my, mz = magnetometer.magnetic
        cal_x = map_range(mx, MAG_MIN[0], MAG_MAX[0], -1, 1)
        cal_y = map_range(my, MAG_MIN[1], MAG_MAX[1], -1, 1)
        cal_z = map_range(mz, MAG_MIN[2], MAG_MAX[2], -1, 1)
        if ahrs:
            ax, ay, az, gx, gy, gz = accel_gyro.acceleration + accel_gyro.gyro
            gx += GYRO_CAL[0]
            gy += GYRO_CAL[1]
            gz += GYRO_CAL[2]
            ahrs_filter.update(gx, gy, -gz, ax, ay, az, cal_x, -cal_y, cal_z)
            yaw_degree = ahrs_filter.yaw
            heading = degrees(yaw_degree)
        else:
            heading = degrees(atan2(cal_y, cal_x))
        timestamp = time.monotonic_ns()
```

The display is updated when the heading changes. The `direction_text` displays the heading degrees as an integer. If `spin_rose` is `True`, then `rotozoom` is used to rotate the compass rose image so that the cardinal directions in the image are pointing properly. This is done by adding the `angle` to the heading calculation so that the top of the image, which is north, is always pointing towards north. The text is rotated to be oriented correctly for the sensor heading direction on the display.

If `spin_rose` is `False`, then the line of squares is rotated to point to the heading direction on the compass rose, which remains static.

```python
if time.monotonic() &gt; last_update + 0.2:
        if heading &lt; 0:
            heading += 360
        if abs(last_heading - heading) &gt;= 2:
            direction_text.text = str(int(heading))
            if spin_rose:
                direction_bitmap = direction_text.bitmap

                bitmaptools.rotozoom(compass_scribble, bitmap_compass,
                                     angle = radians(-heading+angle))
                bitmaptools.rotozoom(direction_scribble, direction_bitmap, angle = rad_angle)
                graphics.display.refresh()
                bitmaptools.rotozoom(direction_scribble, direction_blank, angle = rad_angle)
                bitmaptools.rotozoom(compass_scribble, compass_blank,
                                     angle = radians(-heading+angle))
            else:
                update_line_of_squares(vertical_squares, -heading + 90, length)
                graphics.display.refresh()
            last_heading = heading
        last_update = time.monotonic()
```

# Qualia S3 Compass

## Assembly

![](https://cdn-learn.adafruit.com/assets/assets/000/127/109/medium800/lcds___displays_edited_P1440178.jpg?1705713720)

## STEMMA QT
Plug the STEMMA QT cable into the left STEMMA port on the accelerometer.

![lcds___displays_edited_P1440165.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/110/medium640/lcds___displays_edited_P1440165.jpg?1705713735)

Mount the accelerometer to the mounting plate. It should be oriented so that it is flipped and facing down as shown in the picture.

![lcds___displays_edited_P1440161.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/111/medium640/lcds___displays_edited_P1440161.jpg?1705713765)

## Qualia S3
Plug in the display to the port on the Qualia S3.

![lcds___displays_edited_P1440173.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/112/medium640/lcds___displays_edited_P1440173.jpg?1705713876)

Plug in the other end of the STEMMA QT cable to the Qualia S3.

![lcds___displays_edited_P1440156.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/113/medium640/lcds___displays_edited_P1440156.jpg?1705713899)

Mount the Qualia S3 to the mounting plate.

![lcds___displays_edited_P1440155.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/114/medium640/lcds___displays_edited_P1440155.jpg?1705713929)

## Enclosure
Insert the display into the front lid of the enclosure. Align the opening in the lip on the lid with the ribbon cable on the display.

![lcds___displays_edited_P1440197.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/115/medium640/lcds___displays_edited_P1440197.jpg?1705713960)

Slot in the mounting plate to the front lid.

![lcds___displays_edited_P1440204.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/116/medium640/lcds___displays_edited_P1440204.jpg?1705714010)

Attach the back cover to the enclosure using the snap fit tabs.

![lcds___displays_edited_P1440211.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/117/medium640/lcds___displays_edited_P1440211.jpg?1705714037)

![](https://cdn-learn.adafruit.com/assets/assets/000/127/118/medium800/lcds___displays_edited_P1440213.jpg?1705714059)

# Qualia S3 Compass

## Use

![](https://cdn-learn.adafruit.com/assets/assets/000/127/175/medium800/lcds___displays_edited_P1440224.jpg?1706032402)

For best results, you'll want to take the compass outside. A lot of factors can affect performance of the magnetometer readings indoors, such as appliances and building materials. It makes for a good excuse to get some fresh air.

Plug in your Qualia S3 via USB to power it. You can use a portable USB battery bank for mobile use.

![lcds___displays_edited_P1440215.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/124/medium640/lcds___displays_edited_P1440215.jpg?1705715807)

You can choose between having the compass rose rotate relative to your heading...

![lcds___displays_compassRoseMove.gif](https://cdn-learn.adafruit.com/assets/assets/000/127/173/medium640thumb/lcds___displays_compassRoseMove.jpg?1706032283)

...or by having the heading line rotate relative to the compass rose by tapping the screen.

![lcds___displays_arrowMove.gif](https://cdn-learn.adafruit.com/assets/assets/000/127/176/medium640thumb/lcds___displays_arrowMove.jpg?1706034106)


## Featured Products

### Adafruit Qualia ESP32-S3 for TTL RGB-666 Displays

[Adafruit Qualia ESP32-S3 for TTL RGB-666 Displays](https://www.adafruit.com/product/5800)
There's a few things everyone loves: ice cream, kittens, and honkin' large TFT screens. We're no strangers to small TFT's - [from our itsy 1.14" color display](https://www.adafruit.com/search?q=1.14+tft) that graces many-a-TFT-Feather to <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/5800)
[Related Guides to the Product](https://learn.adafruit.com/products/5800/guides)
### Round RGB 666 TTL TFT Display - 2.1" 480x480 - Capacitive Touch

[Round RGB 666 TTL TFT Display - 2.1" 480x480 - Capacitive Touch](https://www.adafruit.com/product/5792)
This is a screen for advanced hackers who like the look of a nice, round TFT screen with tons of pixels. The 2.1" diagonal sized display has 480x480 16-bit full-color pixels and is an&nbsp; **IPS** &nbsp;display, so the color looks great up to 80 degrees off-axis in any...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5792)
[Related Guides to the Product](https://learn.adafruit.com/products/5792/guides)
### Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU

[Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU](https://www.adafruit.com/product/4517)
Add high-quality motion,&nbsp;direction, and orientation&nbsp;sensing to your Arduino project with this all-in-one 9 Degree of Freedom (9-DoF) sensor with sensors from ST. This little breakout contains two chips that sit side-by-side to provide 9 degrees of full-motion data.

The board...

In Stock
[Buy Now](https://www.adafruit.com/product/4517)
[Related Guides to the Product](https://learn.adafruit.com/products/4517/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
### Pink and Purple Woven USB A to USB C Cable - 1 meter long

[Pink and Purple Woven USB A to USB C Cable - 1 meter long](https://www.adafruit.com/product/5153)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also made for USB C for our modernized breakout boards, Feathers, and more.&nbsp;&nbsp;[If you want something just like it but for Micro B, we...](https://www.adafruit.com/product/4111)

Out of Stock
[Buy Now](https://www.adafruit.com/product/5153)
[Related Guides to the Product](https://learn.adafruit.com/products/5153/guides)
### USB Li-Ion Power Bank with 2 x 5V Outputs @ 2.1A - 5000mAh

[USB Li-Ion Power Bank with 2 x 5V Outputs @ 2.1A - 5000mAh](https://www.adafruit.com/product/4288)
Here's a hand-held-size&nbsp;rechargeable battery pack for your&nbsp;[Raspberry Pi](http://www.adafruit.com/raspberrypi)&nbsp;(or&nbsp;[Metro](https://www.adafruit.com/category/17), or anything else that uses 5V!). This pack is intended for providing a lot of power to...

In Stock
[Buy Now](https://www.adafruit.com/product/4288)
[Related Guides to the Product](https://learn.adafruit.com/products/4288/guides)
### Black Nylon Machine Screw and Stand-off Set – M2.5 Thread

[Black Nylon Machine Screw and Stand-off Set – M2.5 Thread](https://www.adafruit.com/product/3299)
Totaling 380 pieces, this **M2.5 Screw Set** &nbsp;is a must-have for your workstation.&nbsp;You'll have enough screws, nuts, and hex standoffs to fuel your maker tendencies&nbsp;for days on end! M2.5 size screws fit almost all of the Adafruit breakout/dev board mounting holes...

In Stock
[Buy Now](https://www.adafruit.com/product/3299)
[Related Guides to the Product](https://learn.adafruit.com/products/3299/guides)

## Related Guides

- [ST 9-DoF Combo Breakouts and Wings](https://learn.adafruit.com/st-9-dof-combo.md)
- [Adafruit Qualia ESP32-S3 for RGB-666 Displays](https://learn.adafruit.com/adafruit-qualia-esp32-s3-for-rgb666-displays.md)
- [Ambient Color Control Pad](https://learn.adafruit.com/ambient-color-controller.md)
- [NeoKey Emoji Keyboard](https://learn.adafruit.com/neokey-emoji-keyboard.md)
- [PyPortal Wall Mount](https://learn.adafruit.com/pyportal-wall-mount.md)
- [Disconnected CO2 Data Logger](https://learn.adafruit.com/disconnected-co2-data-logger.md)
- [Video Playing 2.1" Round Ornament TFT](https://learn.adafruit.com/2-1-round-ornament-tft.md)
- [New Years Eve Ball Drop](https://learn.adafruit.com/new-years-eve-ball-drop.md)
- [Party Parrot Zoetrope](https://learn.adafruit.com/party-parrot-zoetrope.md)
- [FunHouse IoT Fume Extractor and Air Quality Sensor](https://learn.adafruit.com/funhouse-fume-extractor-iot-air-quality-sensor.md)
- [Automatic Naughty Cat Detector using Lobe](https://learn.adafruit.com/naughty-cat-detector-using-microsoft-lobe.md)
- [Ambient Video Lighting with HyperHDR](https://learn.adafruit.com/ambient-video-lighting-with-hyperhdr.md)
- [Ninja Timer: Giant 7-Segment Display](https://learn.adafruit.com/ninja-timer-giant-7-segment-display.md)
- [Raspberry Pi Zero Stand](https://learn.adafruit.com/raspberry-pi-zero-stand.md)
- [Prop-Maker Feather Talking Adabot Clock](https://learn.adafruit.com/prop-maker-feather-talking-adabot-clock.md)
- [Espresso Water Tank Meter](https://learn.adafruit.com/espresso-water-tank-meter.md)
