adafruit_pct2075

CircuitPython library for the NXP PCT2075 Digital Temperature Sensor

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_pct2075.FaultCount

Options for faults_to_alert

class adafruit_pct2075.Mode

Options for Mode

class adafruit_pct2075.PCT2075(i2c_bus: I2C, address: int = 55)

Driver for the PCT2075 Digital Temperature Sensor and Thermal Watchdog.

Parameters:
  • i2c_bus (I2C) – The I2C bus the PCT2075 is connected to.

  • address (int) – The I2C device address. Default is 0x37

Quickstart: Importing and using the PCT2075 temperature sensor

Here is an example of using the PCT2075 class. First you will need to import the libraries to use the sensor

import board
import adafruit_pct2075

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
pct = adafruit_pct2075.PCT2075(i2c)

Now you have access to the temperature using the attribute temperature.

temperature = pct.temperature
property delay_between_measurements: int

The amount of time between measurements made by the sensor in milliseconds. The value must be between 100 and 3100 and a multiple of 100

property faults_to_alert: int

The number of consecutive high temperature faults required to raise an alert. An fault is tripped each time the sensor measures the temperature to be greater than high_temperature_threshold. The rate at which the sensor measures the temperature is defined by delay_between_measurements.

high_temp_active_high = 1

Sets the alert polarity. When False the INT pin will be tied to ground when an alert is triggered. If set to True it will be disconnected from ground when an alert is triggered.

property high_temperature_threshold: float

The temperature in degrees celsius that will trigger an alert on the INT pin if it is exceeded. Resolution is 0.5 degrees Celsius

mode = 1

Sets the alert mode. In comparator mode, the sensor acts like a thermostat and will activate the INT pin according to high_temp_active_high when an alert is triggered. The INT pin will be deactivated when the temperature falls below temperature_hysteresis. In interrupt mode the INT pin is activated once when a temperature fault is detected, and once more when the temperature falls below temperature_hysteresis. In interrupt mode, the alert is cleared by reading a property

shutdown = 1

Set to True to turn off the temperature measurement circuitry in the sensor. While shut down the configurations properties can still be read or written but the temperature will not be measured

property temperature: float

Returns the current temperature in degrees Celsius. Resolution is 0.125 degrees Celsius

property temperature_hysteresis: float

The temperature hysteresis value defines the bottom of the temperature range in degrees Celsius in which the temperature is still considered high. temperature_hysteresis must be lower than high_temperature_threshold. Resolution is 0.5 degrees Celsius