MicroPython PCT2075 Library¶
pct2075
¶
Author(s): Jose D. Montoya
pct2075
¶
MciroPython Driver for the NXP Semiconductors Temperature Sensor
Author(s): Bryan Siepert,Jose D. Montoya
-
class micropython_pct2075.pct2075.PCT2075(i2c, address: int =
0x37
)[source]¶ Driver for the PCT2075 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
PCT2075
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_pct2075 import pct2075
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) pct2075 = pct2075.PCT2075(i2c)
Now you have access to the attributes
- 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
- high_temp_active_high¶
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 Celsius
- property operation_mode : str¶
Sensor operation_mode 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 belowtemperature_hysteresis
. In interrupt mode the INT pin is activated once when a temperature fault is detected, and once more when the temperature falls belowtemperature_hysteresis
. In interrupt mode, the alert is cleared by reading a propertyMode
Value
pct2075.COMPARATOR
0b0
pct2075.INTERRUPT
0b1
- property temperature : float¶
Returns the current temperature in degrees Celsius. Resolution is 0.125 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 thanhigh_temperature_threshold
. Resolution is 0.5 degrees Celsius