# PyLeap CLUE Barometer

## Overview

https://youtu.be/XuQ2IPYOwf8

In this project, you'll utilize the CLUE's onboard BMP280 sensor to measure ambient temperature and air pressure. The PyLeap app will wirelessly load the project onto your CLUE over BLE.

The CLUE display will show the temperature and air pressure readings in either metric (Celsius and hectopascals) or imperial (Fahrenheit and inches of mercury) units. The code takes into account the air pressure reading and your _nominal baseline pressure_ to adjust the servo's angle to point to a weather condition.

![](https://cdn-learn.adafruit.com/assets/assets/000/115/844/medium800/projects_edited_P1390012.jpg?1665519176)

## Barometric Pressure and Weather

[Barometric pressure](https://en.wikipedia.org/wiki/Atmospheric_pressure), or air pressure, is the measure of the pressure resulting from air pressing down on the Earth due to gravity. Since this pressure varies with altitude, different locations on Earth will have different nominal pressure values. However, weather can also affect this pressure. Taking both of these pieces of information into account, [a barometer can be used to display weather conditions](https://education.nationalgeographic.org/resource/barometer), depending on if you have a higher or lower than nominal pressure reading for your location.

![Day 5 forecast of surface pressure across North America as well as the Pacific and Atlantic oceans](https://upload.wikimedia.org/wikipedia/commons/a/ac/Day5pressureforecast.png https://commons.wikimedia.org/wiki/File:Day5pressureforecast.png)

## Parts
### Adafruit CLUE - nRF52840 Express with Bluetooth® LE

[Adafruit CLUE - nRF52840 Express with Bluetooth® LE](https://www.adafruit.com/product/4500)
Do you feel like you just don't have a CLUE? Well, we can help with that - get a CLUE here at Adafruit by picking up this sensor-packed development board. We wanted to build some projects that have a small screen and a lot of sensors. To make it compatible with existing projects, we made...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4500)
[Related Guides to the Product](https://learn.adafruit.com/products/4500/guides)
![Animated GIF showing CLUE board  displaying data from the many on-board sensors.](https://cdn-shop.adafruit.com/product-videos/640x480/4500-04.jpg)

### Micro Servo with Alligator Clips

[Micro Servo with Alligator Clips](https://www.adafruit.com/product/5592)
This servo is&nbsp;[just like our classic Micro Servo](https://www.adafruit.com/product/169)&nbsp;but has 3 alligator clip test leads&nbsp;at the end! This makes it perfect for plug-and-play support with any of our boards with alligator-clip-friendly input/output pins, like the <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/5592)
[Related Guides to the Product](https://learn.adafruit.com/products/5592/guides)
![Video of a servo with alligator clips connected to a round microcontroller with pads. The horns on the servo oscillate.](https://cdn-shop.adafruit.com/product-videos/640x480/5592-00.jpg)

### Clear Acrylic Enclosure + Hardware Kit for Adafruit CLUE

[Clear Acrylic Enclosure + Hardware Kit for Adafruit CLUE](https://www.adafruit.com/product/4675)
Here is a chic&nbsp;minimalist enclosure for your **CLUE** board! This case&nbsp;has been laser-cut specifically to accommodate the TFT display, tactile buttons, and capacitive pads.

And of course, we include&nbsp;mounting hardware so you can assemble it right onto your CLUE...

In Stock
[Buy Now](https://www.adafruit.com/product/4675)
[Related Guides to the Product](https://learn.adafruit.com/products/4675/guides)
![Angled shot of a Clear Acrylic Enclosure + Hardware Kit for Adafruit CLUE.](https://cdn-shop.adafruit.com/640x480/4675-04.jpg)

### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
![USB cable - USB A to Micro-B - 3 foot long](https://cdn-shop.adafruit.com/640x480/592-01.jpg)

### 3 x AA Battery Holder with On/Off Switch, JST, and Belt Clip

[3 x AA Battery Holder with On/Off Switch, JST, and Belt Clip](https://www.adafruit.com/product/3287)
This battery holder connects 3 AA batteries together in series for powering all kinds of projects. We spec'd these out because the box is compact, and 3 AA's add up to about 3.3-4.5V, a very similar range to Lithium Ion/polymer (Li-Ion) batteries, plus it has&nbsp;a nifty&nbsp;on-off...

In Stock
[Buy Now](https://www.adafruit.com/product/3287)
[Related Guides to the Product](https://learn.adafruit.com/products/3287/guides)
![Angled shot of 3 x AA battery holder with on/off switch, JST, and belt clip.](https://cdn-shop.adafruit.com/640x480/3287-00.jpg)

### Alkaline AA batteries (LR6) - 3 pack

[Alkaline AA batteries (LR6) - 3 pack](https://www.adafruit.com/product/3521)
Battery power for your portable project! These batteries are good quality at a good price, and work fantastic with any of the kits or projects in the shop that use AAs. This is a pack of **3 AA batteries**.  
  
These batteries are Alkaline (MnO2) chemistry, with a voltage...

In Stock
[Buy Now](https://www.adafruit.com/product/3521)
[Related Guides to the Product](https://learn.adafruit.com/products/3521/guides)
![Angled shot of 3 AA batteries.](https://cdn-shop.adafruit.com/640x480/3521-00.jpg)

### Part: Paper Plate
quantity: 1
Paper plate to mount the servo and CLUE to

# PyLeap CLUE Barometer

## Connect the Servo to the CLUE

![](https://cdn-learn.adafruit.com/assets/assets/000/115/842/medium800/projects_edited_P1390010.jpg?1665519103)

To wire up the servo motor to the CLUE, you'll clip the servo's alligator clips to the CLUE's pads located at the bottom of the board. The alligator clips are color coded so that you can tell which connection goes where.

## Wiring Diagram
![](https://cdn-learn.adafruit.com/assets/assets/000/115/815/medium800/projects_clueServo_bb.png?1665510422)

- **Servo Data** &nbsp;to **CLUE pad 0 (white wire)**
- **Servo Power** to **CLUE 3V pad (red wire)**
- **Servo Ground** to **CLUE GND pad (black wire)**

## Assembly
First, make sure that your CLUE is disconnected from power. Then, clip the **servo's red alligator clip** to the **CLUE's 3V pad**. This is the power input for the servo.

![projects_edited_P1380983.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/835/medium640/projects_edited_P1380983.jpg?1665517056)

Next, clip the **servo's black alligator clip** to the **CLUE's GND pad**. This is the ground connection for the servo.

![projects_edited_P1380985.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/836/medium640/projects_edited_P1380985.jpg?1665517066)

Finally, clip the **servo's white alligator clip** to the **CLUE's pad 0**. This is the data pin for the servo.

![projects_edited_P1380987.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/837/medium640/projects_edited_P1380987.jpg?1665517075)

# PyLeap CLUE Barometer

## CircuitPython on CLUE

[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** &nbsp;flash drive to iterate.

The following instructions will show you how to install CircuitPython. If you've already installed CircuitPython but are looking to update it or reinstall it, the same steps work for that as well!

## Set up CircuitPython Quick Start!

Follow this quick step-by-step for super-fast Python power :)

[Download the latest version of CircuitPython for CLUE from circuitpython.org](https://circuitpython.org/board/clue_nrf52840_express/)
 **Click the link above to download the latest version of CircuitPython for the CLUE.**

Download and save it to your desktop (or wherever is handy).

![adafruit_products_CLUE_UF2_Downloaded.png](https://cdn-learn.adafruit.com/assets/assets/000/088/037/medium640/adafruit_products_CLUE_UF2_Downloaded.png?1580840077)

Plug your CLUE into your computer using a known-good USB cable.

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

Double-click the **Reset** button on the top (magenta arrow) on your board, and you will see the NeoPixel RGB LED (green arrow) turn green. If it turns red, check the USB cable, try another USB port, etc. **Note:** The little red LED next to the USB connector will pulse red. That's ok!

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

![adafruit_products_Clue_Reset_NeoPixel_bootloader.png](https://cdn-learn.adafruit.com/assets/assets/000/087/919/medium640/adafruit_products_Clue_Reset_NeoPixel_bootloader.png?1580496467)

You will see a new disk drive appear called **CLUEBOOT**.

Drag the **adafruit-circuitpython-clue-etc.uf2** file to **CLUE**** BOOT.**

![adafruit_products_CLUE_CLUEBOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/088/042/medium640/adafruit_products_CLUE_CLUEBOOT.png?1580841287)

![adafruit_products_CLUE_drag_UF2.png](https://cdn-learn.adafruit.com/assets/assets/000/088/043/medium640/adafruit_products_CLUE_drag_UF2.png?1580841295)

The LED will flash. Then, the **CLUEBOOT** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

If this is the first time you're installing CircuitPython or you're doing a completely fresh install after erasing the filesystem, you will have two files - **boot\_out.txt** , and **code.py** , and one folder - **lib** on your **CIRCUITPY** drive.

If CircuitPython was already installed, the files present before reloading CircuitPython should still be present on your **CIRCUITPY** drive. Loading CircuitPython will not create new files if there was already a CircuitPython filesystem present.

That's it, you're done! :)

![adafruit_products_CLUE_CIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/088/044/medium640/adafruit_products_CLUE_CIRCUITPY.png?1580841453)

# PyLeap CLUE Barometer

## Pairing

Now that you're done uploading the correct firmware, **disconnect** your device from your computer and power it via [LiPoly](https://www.adafruit.com/category/574)&nbsp;or [AAA battery pack](https://www.adafruit.com/product/727).

## Pairing device to PyLeap

Once powered, press the small&nbsp; **Reset** button in the center of the board (Circuit Playground Bluefruit) or on the top right of the board (CLUE). When the blue light flashes, press the Reset button again.

![Circuit Playground Bluefruit with reset button in center of board](https://cdn-learn.adafruit.com/assets/assets/000/107/090/medium800thumb/circuit_playground_ezgif22.jpg?1664908526 Circuit Playground Bluefruit with a small Reset button in the center of the board)

![Adafruit](https://cdn-learn.adafruit.com/assets/assets/000/087/865/original/adafruit_products_Clue_pinouts_Reset.png?1580413920 Adafruit CLUE Reset Button (Highlighted on the upper right))

When done correctly, the LEDs will flash yellow followed by solid blue. Once this occurs, the board will **continuously** be in discovery mode.

## Scan & Connect

When your Circuit Playground Bluefruit or Adafruit CLUE is in discovery mode, hold it very closely to your iPhone or iPadOS to pair.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/112/226/medium800thumb/circuitpython_ezgif.com-gif-maker-3.jpg?1654190148)

Below the spinning Blinka, you'll notice a status&nbsp;indicator that will let you&nbsp;know your current **pairing status.**

Once you've found&nbsp;your&nbsp;device and received the **Bluetooth Pairing Request** message, press Pair to pair your board to your iPhone or iPadOS.

![](https://cdn-learn.adafruit.com/assets/assets/000/112/232/medium800/circuitpython_IMG_6159.png?1654209813)

## If your Circuit Playground Bluefruit doesn't appear:

1. Check to see if your Circuit Playground Bluefruit is powered on. Verify that the green **On** light is lit.
2. Make sure your Circuit Playground Bluefruit is running the correct **firmware**. See the [CircuitPython page](https://learn.adafruit.com/pyleap-app/circuitpython)&nbsp;in this guide.
3. Try resetting the Circuit Playground Bluefruit by pressing the small **Reset** button near the center of the board.

# PyLeap CLUE Barometer

## PyLeap CLUE Barometer Code

![](https://cdn-learn.adafruit.com/assets/assets/000/115/821/medium800/projects_edited_P1390003.jpg?1665513267)

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CLUE/CLUE_Servo_Barometer/code.py

## How the CircuitPython Code Works
The code begins by creating a `displayio` group and some text elements to show on the CLUE display.&nbsp;

```python
#  board display
#  scaling for terminalio font
display = board.DISPLAY
group = displayio.Group(scale=3)

#  text elements
temp_header = "Temperature:"
press_header = "Pressure:"
temp_text = "   ºC"
press_text = "   hPa"
font = terminalio.FONT
blue = 0x0000FF
red = 0xFF0000
```

## PWM and I2C
Then, the servo object is created with PWM and the BMP280 sensor is instantiated over I2C.

```python
#  pwm setup for servo
pwm = pwmio.PWMOut(board.D0, duty_cycle=2 ** 15, frequency=50)
gauge = servo.Servo(pwm)

#  bmp280 sensor setup
i2c = board.I2C()  # uses board.SCL and board.SDA
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
```

## Nominal Baseline Pressure

The deviation from the nominal baseline pressure is used to show your current weather conditions with the servo. The `NOMINAL_PRESSURE` value must be set for your location (covered later in guide on the [Usage page](https://learn.adafruit.com/pyleap-clue-barometer/usage)). The `PRESSURE_RANGE` value can be adjusted as needed for typical local weather driven deviations. A lower value will make the detection more sensitive.

```python
#  change depending on your location's elevation
NOMINAL_PRESSURE = 1005.94

PRESSURE_RANGE = 40 # hPa, expected pressure range variance caused by local weather
PRESSURE_LOW_LIM = NOMINAL_PRESSURE - PRESSURE_RANGE
PRESSURE_HIGH_LIM = NOMINAL_PRESSURE + PRESSURE_RANGE
```

## Text Labels
There are four text labels that are shown on the display. `temp_label` and `press_label` are headers with the text `"Temperature:"` and `"Pressure:"`. `temp_data` and `press_data` are updated in the loop to show the readings from the BMP280 sensor.

```python
#  temperature text elements
temp_label = label.Label(font, text=temp_header, color=red, x=5, y=10)
temp_data = label.Label(font, text=temp_text, color=red, x=5, y=25)

#  pressure text elements
press_label = label.Label(font, text=press_header, color=blue, x=5, y=50)
press_data = label.Label(font, text=press_text, color=blue, x=5, y=65)

#  adding text to display group
group.append(temp_label)
group.append(press_label)
group.append(temp_data)
group.append(press_data)

display.root_group = group
```

## Unit Conversion Functions
There are two functions to convert metric units to imperial units. `c_to_f()` converts Celsius to Fahrenheit by passing the temperature in Celsius and returning the temperature in Fahrenheit.

`hpa_to_inHg()` converts hectopascals to inches of mercury by passing the barometric pressure in hectopascals and returning the pressure reading in inches of mercury.

Two variables are declared before the loop. `clock` is a `time.monotonic()` device and `metric_units` is used to determine which units are being shown on the display and is affected by the CLUE buttons.

```python
#  function to convert celcius to fahrenheit
def c_to_f(temp):
    temp_f = (temp * 9/5) + 32
    return temp_f

#  function to convert hPa to inHg
def hpa_to_inHg(hPa):
    inches_mercury = hPa * 0.02953
    return inches_mercury

#  time.monotonic clock
clock = time.monotonic()
#  units state
metric_units = True
```

## The Loop
In the loop, the BMP280 pressure reading is mapped from the calculated pressure range with your nominal baseline pressure to the value range of the servo motor angle. The servo motor angle is then set to that mapped value.

```python
#  non-blocking 2 second delay
    if (clock + 2) < time.monotonic():
        #  map servo range to barometric pressure range
        servo_value = simpleio.map_range(bmp280.pressure,
                                         PRESSURE_LOW_LIM, PRESSURE_HIGH_LIM, 180, 0)
        #  set servo to pressure
        gauge.angle = servo_value
```

## Displaying Data
If `metric_units` is `True`, then the temperature and air pressure readings are displayed on the CLUE in Celsius and hPa.

```python
#  if metric units...
        if metric_units:
            #  update temp & pressure text in celcius and hPa
            temp_data.text = "%0.1f ºC" % bmp280.temperature
            press_data.text = "%0.1f hPa" % bmp280.pressure
```

If `metric_units` is `False`, the readings from the BMP280 are converted to imperial units with the two conversion functions and are shown on the display in Fahrenheit and inHg.

```python
#  if imperial units...
        else:
            #  convert celcius to fahrenheit
            temp_fahrenheit = c_to_f(bmp280.temperature)
            #  convert hPa to inHg
            pressure_inHg = hpa_to_inHg(bmp280.pressure)
            #  update temp & pressure text
            temp_data.text = "%0.1f ºF" % temp_fahrenheit
            press_data.text = "%0.1f inHg" % pressure_inHg
```

## The CLUE Buttons
If CLUE button A is pressed, then the BMP280 readings are displayed in metric units. If the CLUE button B is pressed, then the BMP280 readings are displayed in imperial units.

```auto
#  if a button is pressed, metric_units is True, show metric
    if clue.button_a:
        metric_units = True
    #  if b button is pressed, metric_units is False, show imperial units
    if clue.button_b:
        metric_units = False
```

# PyLeap CLUE Barometer

## File Glider App Set Up

![](https://cdn-learn.adafruit.com/assets/assets/000/108/578/medium800/led_pixels_Screen_Shot_2022-02-02_at_3.21.41_PM.png?1643833326)

## What is File Glider?
From the description in the App store, File Glider allows you to:

> Wirelessly transfer files to and from file transfer-ready Bluetooth Low Energy (BLE) firmware. You can browse and edit files from within File Glider or use the Files app integration to access the files from other apps. Multiple devices can be managed at once and access can be shared amongst multiple apps.

Basically, this app allows you to transfer files from your iOS device to your CPB wirelessly with a couple of taps. It also lets you add and edit code on the CPB directly from the App, how neat!

## Step 1: [Download the File Glider App](https://apps.apple.com/us/app/file-glider/id1583976527) from the App Store.

Using your iOS device, download the File Glider App.

Info: 

## Step 2: Connect your BLE board to your iOS device through the app.

Open the File Glider App after it finishes downloading and make sure your board is connected to your computer.

![](https://cdn-learn.adafruit.com/assets/assets/000/108/579/medium800thumb/led_pixels_click_gif.jpg?1643834101)

- Click the reset button on the board.
- You will see the board NeoPixels flash through a series of colors, first red, then yellow then blue.
- When the blue appears, click the reset button again.
- The NeoPixels will then flash through another series of colors then turn blue momentarily before turning off again.

![](https://cdn-learn.adafruit.com/assets/assets/000/108/722/medium800/led_pixels_Untitled4.png?1644240906)

- The app should then state "Status: connected..."&nbsp;
- Then a Bluetooth Pairing Request will pop up, select "Pair".
- The board is now connected to the File Glider App!

![led_pixels_IMG_1231.jpg](https://cdn-learn.adafruit.com/assets/assets/000/108/601/medium640/led_pixels_IMG_1231.jpg?1643998855)

![led_pixels_IMG_1232.jpg](https://cdn-learn.adafruit.com/assets/assets/000/108/602/medium640/led_pixels_IMG_1232.jpg?1643998879)

![](https://cdn-learn.adafruit.com/assets/assets/000/108/723/medium800/led_pixels_Untitled4.png?1644240952)

## Troubleshooting

**Problem:** You try to connect your board but then you see the following error on the app "Disconnected: Peer removed pairing information"

 **Solution:&nbsp;** Go to your Bluetooth device settings on your iOS device (Settings \> Bluetooth). Scroll down to the one labeled "CIRCUITPYxxxx". Then click on the info icon (a letter i with a circle). Now select "forget this device". Try to connect the board again from step 2 above and you should be set.

![led_pixels_IMG_1235.jpg](https://cdn-learn.adafruit.com/assets/assets/000/108/606/medium640/led_pixels_IMG_1235.jpg?1643999680)

![led_pixels_IMG_1236.jpg](https://cdn-learn.adafruit.com/assets/assets/000/108/607/medium640/led_pixels_IMG_1236.jpg?1643999706)

# PyLeap CLUE Barometer

## Prep Your Paper Plate

Begin by folding your paper plate in half.

![projects_edited_P1380957.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/824/medium640/projects_edited_P1380957.jpg?1665516208)

Cut the plate in half on the folded line.

![projects_edited_P1380959.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/825/medium640/projects_edited_P1380959.jpg?1665516245)

## Mount the Servo
Draw a line down the center of the half plate. Line up the servo's gear on the line at the bottom of the plate and trace its outline.

![projects_edited_P1380964.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/826/medium640/projects_edited_P1380964.jpg?1665516287)

Cut out a window for the servo at the bottom of the plate. Then, use the two mounting screws to poke holes into the plate and attach the servo.

![projects_edited_P1380967.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/827/medium640/projects_edited_P1380967.jpg?1665516363)

![projects_edited_P1380971.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/828/medium640/projects_edited_P1380971.jpg?1665516372)

## Mount the CLUE
At the top of the plate, line-up the CLUE's pad 2 hole on the center line. Cut a small slit on the line.

![projects_edited_P1380975.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/829/medium640/projects_edited_P1380975.jpg?1665516423)

Use an M3 screw and nut to attach the CLUE to the plate through pin pad 2.

![projects_edited_P1380980.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/830/medium640/projects_edited_P1380980.jpg?1665516471)

![projects_edited_P1380981.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/831/medium640/projects_edited_P1380981.jpg?1665516478)

## Make an Arrow
With the unused half of the paper plate, cut out an arrow shape.

![projects_edited_P1380992.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/832/medium640/projects_edited_P1380992.jpg?1665516511)

Cut a small slit on the bottom edge of the arrow. Attach it to the servo horn with the servo horn screw.

![projects_edited_P1380994.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/833/medium640/projects_edited_P1380994.jpg?1665516539)

Use some markers to decorate the arrow and the paper plate. You can label the arch to correspond with weather conditions. From left to right:

- Stormy
- Rain
- Change
- Fair
- Very Dry

This mirrors what classic barometers have been labeled with.&nbsp;

![projects_edited_P1380996.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/871/medium640/projects_edited_P1380996.jpg?1665605841)

# PyLeap CLUE Barometer

## Usage

After loading the project onto your CLUE with PyLeap, close out of the PyLeap app. This disconnects the CLUE from PyLeap to allow it to connect to File Glider.

Warning: 

## Find Your Nominal Baseline Pressure
Use this [standard atmosphere calculator](https://aerotoolbox.com/atmcalc/) to determine your nominal baseline pressure. You'll need to know your location's elevation, which can be found by doing a search online with "[location] elevation".

Enter your elevation in the **altitude input box**. Then, click **CALCULATE**. In the output section, you'll use the pressure in mb as your nominal baseline pressure number.

![projects_edited_atmosphereCalculator.jpg](https://cdn-learn.adafruit.com/assets/assets/000/115/867/medium640/projects_edited_atmosphereCalculator.jpg?1665605444)

[Standard Atmosphere Calculator](https://aerotoolbox.com/atmcalc/)
## Edit With File Glider
You can edit your code with your nominal baseline pressure by connecting your CLUE to File Glider, select&nbsp; **Explorer** &nbsp;to view the file directory of your CLUE. Then, select&nbsp; **code.py** &nbsp;to edit the code file.&nbsp;

![projects_openCode.gif](https://cdn-learn.adafruit.com/assets/assets/000/115/872/medium640thumb/projects_openCode.jpg?1665606965)

You can edit the `NOMINAL_PRESSURE` variable to equal your nominal baseline pressure value that you calculated with the atmosphere calculator.

![projects_editingCode.gif](https://cdn-learn.adafruit.com/assets/assets/000/115/873/medium640thumb/projects_editingCode.jpg?1665606995)

When you're ready to load your updated badge, select&nbsp; **Save** in the app. You'll see the CLUE reset and begin running the code.

![projects_startUp.gif](https://cdn-learn.adafruit.com/assets/assets/000/115/849/medium640thumb/projects_startUp.jpg?1665520060)

The servo will point to the weather condition according to deviations from the nominal baseline pressure that you've entered into the code.

![projects_changingPressure.gif](https://cdn-learn.adafruit.com/assets/assets/000/115/847/medium640thumb/projects_changingPressure.jpg?1665519748)

The CLUE display will show the temperature and air pressure reading from the BMP280. You can press the A button to show the information in metric units (Celsius and hPa) or you can press the B button to show the information in imperial units (Fahrenheit and inHg).

![projects_buttons.gif](https://cdn-learn.adafruit.com/assets/assets/000/115/848/medium640thumb/projects_buttons.jpg?1665519843)


## Featured Products

### Adafruit CLUE - nRF52840 Express with Bluetooth® LE

[Adafruit CLUE - nRF52840 Express with Bluetooth® LE](https://www.adafruit.com/product/4500)
Do you feel like you just don't have a CLUE? Well, we can help with that - get a CLUE here at Adafruit by picking up this sensor-packed development board. We wanted to build some projects that have a small screen and a lot of sensors. To make it compatible with existing projects, we made...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4500)
[Related Guides to the Product](https://learn.adafruit.com/products/4500/guides)
### Micro Servo with Alligator Clips

[Micro Servo with Alligator Clips](https://www.adafruit.com/product/5592)
This servo is&nbsp;[just like our classic Micro Servo](https://www.adafruit.com/product/169)&nbsp;but has 3 alligator clip test leads&nbsp;at the end! This makes it perfect for plug-and-play support with any of our boards with alligator-clip-friendly input/output pins, like the <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/5592)
[Related Guides to the Product](https://learn.adafruit.com/products/5592/guides)
### Clear Acrylic Enclosure + Hardware Kit for Adafruit CLUE

[Clear Acrylic Enclosure + Hardware Kit for Adafruit CLUE](https://www.adafruit.com/product/4675)
Here is a chic&nbsp;minimalist enclosure for your **CLUE** board! This case&nbsp;has been laser-cut specifically to accommodate the TFT display, tactile buttons, and capacitive pads.

And of course, we include&nbsp;mounting hardware so you can assemble it right onto your CLUE...

In Stock
[Buy Now](https://www.adafruit.com/product/4675)
[Related Guides to the Product](https://learn.adafruit.com/products/4675/guides)
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
### 3 x AA Battery Holder with On/Off Switch, JST, and Belt Clip

[3 x AA Battery Holder with On/Off Switch, JST, and Belt Clip](https://www.adafruit.com/product/3287)
This battery holder connects 3 AA batteries together in series for powering all kinds of projects. We spec'd these out because the box is compact, and 3 AA's add up to about 3.3-4.5V, a very similar range to Lithium Ion/polymer (Li-Ion) batteries, plus it has&nbsp;a nifty&nbsp;on-off...

In Stock
[Buy Now](https://www.adafruit.com/product/3287)
[Related Guides to the Product](https://learn.adafruit.com/products/3287/guides)
### Alkaline AA batteries (LR6) - 3 pack

[Alkaline AA batteries (LR6) - 3 pack](https://www.adafruit.com/product/3521)
Battery power for your portable project! These batteries are good quality at a good price, and work fantastic with any of the kits or projects in the shop that use AAs. This is a pack of **3 AA batteries**.  
  
These batteries are Alkaline (MnO2) chemistry, with a voltage...

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

## Related Guides

- [Introducing Adafruit CLUE](https://learn.adafruit.com/adafruit-clue.md)
- [No-Touch Hand Wash Timer for Circuit Playground Express and CLUE](https://learn.adafruit.com/no-touch-hand-wash-timer-for-cpx-and-clue.md)
- [CircuitPython BLE Libraries on Any Computer](https://learn.adafruit.com/circuitpython-ble-libraries-on-any-computer.md)
- [PyLeap CLUE Sensor Plotter](https://learn.adafruit.com/pyleap-clue-sensor-plotter.md)
- [CLUE Slim Case](https://learn.adafruit.com/clue-slim-case.md)
- [Creative Inspiration Activity Generator](https://learn.adafruit.com/creative-inspiration-activity-generator.md)
- [Yoga Pose Chime](https://learn.adafruit.com/yoga-pose-chime.md)
- [CLUE Vertical Garden Weather Visualizer](https://learn.adafruit.com/clue-vertical-garden-weather-visualizer.md)
- [Digital Nose Milk Freshness Checker](https://learn.adafruit.com/digital-nose-gas-sensor-milk-freshness-checker.md)
- [Bluetooth Cycling Speed & Cadence Sensor Display with Clue](https://learn.adafruit.com/bluetooth-bicycle-speed-cadence-sensor-display-with-clue.md)
- [CLUE Custom CircuitPython Badge](https://learn.adafruit.com/clue-custom-circuit-python-badge.md)
- [CircuitPython BLE Morse Code Chat](https://learn.adafruit.com/circuitpython-ble-wireless-morse-code-chat.md)
- [PyLeap BLE Controlled NeoPixels with CLUE](https://learn.adafruit.com/pyleap-ble-controlled-neopixels-with-clue.md)
- [How to Fuse Motion Sensor Data into AHRS Orientation (Euler/Quaternions)](https://learn.adafruit.com/how-to-fuse-motion-sensor-data-into-ahrs-orientation-euler-quaternions.md)
- [PyLeap CLUE Custom Conference Badge](https://learn.adafruit.com/pyleap-clue-custom-conference-badge.md)
