CedarGroveStudios / CircuitPython_TemperatureTools

A collection of CircuitPython helpers for calculating Dew Point, Heat Index, and for converting temperature units.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

Discord

Build Status

Code Style: Black

A collection of CircuitPython helpers for calculating Dew Point, Heat Index, and for converting temperature units..

Dew Point calculates dew point temperature from measured temperature (Celsius) and humidity (percent). Returns the calculated dew point (Celsius) and summary description. Detailed description is provided if verbose=True. Dew point value is constrained to the range of 0 to 40 (Celsius).

Heat Index calculates heat index temperature from measured temperature (Celsius) and humidity (percent). Returns the calculated heat index (Celsius) and summary description. Detailed description is provided if verbose=True.

Unit Converters convert values between Celsius, Fahrenheit, and Kelvin.

image

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install cedargrove_temperaturetools

Or the following command to update an existing version:

circup update

Usage Example

from cedargrove_temperaturetools.dew_point import dew_point
from cedargrove_temperaturetools.heat_index import heat_index
from cedargrove_temperaturetools.unit_converters import (
    celsius_to_fahrenheit,
    celsius_to_kelvin,
)

# Measured temperature and humidity
TEMPERATURE = 24  # Degrees Celsius
HUMIDITY = 50  # Relative humidity in percent

dew_point_temp, description = dew_point(TEMPERATURE, HUMIDITY)
print(f"Dew Point = {dew_point_temp} {description}")

dew_point_temp, description = dew_point(TEMPERATURE, HUMIDITY, verbose=True)
print(f"Dew Point = {dew_point_temp} {description}")

heat_index_temp, description = heat_index(TEMPERATURE, HUMIDITY)
print(f"Heat Index = {heat_index_temp} {description}")

heat_index_temp, description = heat_index(TEMPERATURE, HUMIDITY, verbose=True)
print(f"Heat Index = {heat_index_temp} {description}")

print(f"Measured Temperature (Celsius) = {TEMPERATURE}")
print(f"Measured Temperature (Fahrenheit) = {celsius_to_fahrenheit(TEMPERATURE)}")
print(f"Measured Temperature (Kelvin) = {celsius_to_kelvin(TEMPERATURE)}")

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

About

A collection of CircuitPython helpers for calculating Dew Point, Heat Index, and for converting temperature units.

License:MIT License


Languages

Language:Python 100.0%