
Adafruit PCT2075 Temperature Sensor
Created by Bryan Siepert
Last updated on 2021-05-04 08:35:07 PM EDT

2
3
6
6
6
6
6
8
8
8
9
9
10
10
10
11
11
11
13
14
14
14
15
15
16
16
16
17
17
18
18
18
19
19
20
21
22
22
22
22
Guide Contents
Guide Contents
Overview
Pinouts
Power Pins
I2C Logic Pins
Other Pins
I2C Address Selection
Arduino
Wiring
Library Installation
Basic Temperature Example
Temperature Alert Example
Temperature Alert Settings
Handy Interstitial Diagram
Alert Modes
Activating the Temperature Alert
Temperature Example Code
Temperature Alert Example Code
Arduino Docs
Python & CircuitPython
CircuitPython Microcontroller Wiring
Python Computer Wiring
CircuitPython Installation of PCT2075 Library
Python Installation of PCT2075 Library
CircuitPython & Python Usage
Temperature Alert Example
CircuitPython Wiring
Python Computer Wiring
Temperature Alert Settings
Handy Interstitial Diagram
Alert Modes
Testing the Code
Is it hot in here?
Temperature Example Code
Temperature Alert Example
Python Docs
Downloads
Files
Schematic
Fab Print
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 2 of 23

Overview
The PCT2075 by NXP is a pin compatible drop in replacement for a very common I2C temperature
sensor, the LM75. Compared to the LM75, however, the 11-bit ADC in the PCT2075 provides more precise
measurements when compared to the LM75's 9-bit ADC. Additionally because the PCT2075 allows the
address pins to work in three states (high, low, floating), you can have 27 PCT2075s on the same bus as
opposed to only 8 for the LM75. Now you can
finally
measure the individual temperatures of the tentacles
of three octopuses instead of just one!
Otherwise the two sensors are the same. The PCT2075 will report temperature and allow you to a set a
high temperature threshold that the sensor will compare to the current temperature and raise an alert
when the current temperature exceeds the threshold. There are also a few (metaphorical) knobs to twist
to change the alerting and measurement behavior.
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 3 of 23

As with all Adafruit breakouts, we've done the work to make this handy temperature helper super easy to
use. We've put it on a breakout board with the required support circuitry and connectors to make it easy to
work with, and is now a trend we've added SparkFun Qwiic (https://adafru.it/Fpw) compatible STEMMA
QT (https://adafru.it/Ft4) JST SH connectors that allow you to get going without needing to solder. Just
use a STEMMA QT adapter cable (https://adafru.it/FA-), plug it into your favorite micro or Blinka supported
SBC and you're ready to rock!
"OK" you say "connections are one thing but how do I tell it what to do?" (Not much of a) Surprise! We've
written libraries for Arduino and CircuitPython with examples that make it super easy to integrate the
PCT2075 with your project.
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 4 of 23

The PCT2075 is a handy and inexpensive temperature sensor that does one thing well. Try adding one to
your project and have it keep an eye on the temperature and let you know when things get hot.
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 5 of 23

Pinouts
Power Pins
The sensor on the breakout requires between a 2.7V and 5.5V, and can be easily used with most
microcontrollers from an Arduino to a Feather or something else.
Vcc - this is the power pin. To power the board, give it the same power as the logic level of your
microcontroller - e.g. for a 5V micro like Arduino, use 5V
GND - common ground for power and logic
I2C Logic Pins
SCL - this is the I2C clock pin, connect to your microcontroller's I2C clock line.
SDA - this is the I2C data pin, connect to your microcontroller's I2C data line
STEMMA QT (https://adafru.it/Ft4) - These connectors allow you to connectors to dev boards
with STEMMA QT connectors or to other things with various associated
accessories (https://adafru.it/Ft6)
Other Pins
INT -This is the interrupt pin. You can setup the PCT2075 to activate this pin when a temperature
threshold is reached or exceeded.
A0, A1, A2 - I2C Address pins. See the "I2C Address Selection" section below
I2C Address Selection
One of the improvements that the PCT2075 has over the LM75 that it can replace is the ability to have
three times the number of I2C addresses. Interestingly, they achieve this by allowing the three address
pins A0, A1, and A2 be in one of three states, low (0), high(1), or floating(F). This means that the are 3
(27) possible addresses. Attach the address pin to ground for low, the logic level of your device for hight,
or leave the pin unconnected for floating.
3
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 6 of 23

We leave all three address pins floating on the breakout for maximum configurability. This means that the
default address for the breakout is 0x37.
For a more permanent address selection, you can use the solder jumpers on the back of the breakout
board to connect the address pins to GND or VCC.
All you need to do is bridge the "Float" pad to either the VCC or GND pad for one or more of the address
pins. In the picture above if you bridged the solder pads that are circled, you would pull A0 high to VCC
and A1 low to GND. Referring to the table above this would set the address of the breakout to 0x72
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 7 of 23

Arduino
Wiring
Wiring the PCT2075 to communicate with your microcontroller is straight forward thanks to the I2C
interface. For these examples we can use the Metro or Arduino to take temperature measurements. The
instructions below show a Metro (https://adafru.it/METROXMETR), but the same applies to an Arduino
Connect board VCC (red wire) to Arduino 5V if you are
running a 5V board Arduino (Uno, etc.). If your board is
3V, connect to that instead.
Connect board GND (black wire) to Arduino GND
Connect board SCL (yellow wire) to Arduino SCL
Connect board SDA (blue wire) to Arduino SDA
Library Installation
Once wired up, to start using the PCT2075 you'll need to install the Adafruit_PCT2075
library (https://adafru.it/FTR). The library is available through the Arduino library manager so we
recommend taking that approach.
From the Arduino IDE, open up the Library Manager:
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 8 of 23

Click the Manage Libraries ... menu item, search for Adafruit PCT2075, and select the Adafruit
PCT2075 library and click Install:
Then follow the same process for the Adafruit BusIO library.
Basic Temperature Example
Open up File -> Examples -> Adafruit PCT2075 -> pct2075_test and upload to your Arduino wired up to
the sensor.
One you've uploaded the sketch to your board open up the Serial Monitor ( Tools->Serial Monitor) at
115200 baud. You should see the temperature readings being printed like so:
The temperature will be different depending on the weather where you are. You can see it change by
either putting a particularly warm finger on the sensor, or by blowing hot air across it with a hot air station
(not too hot!) or a hair dryer.
Temperature Alert Example
Next we'll wire up an LED with a current limiting resistor (https://adafru.it/FTS) to the INT pin on the
PCT2075 and then ask the PCT2075 to tell us when a certain temperature has been reached.
To start we'll take the wiring for the previous example and add the LED and resistor:
Connect sensor VCC (red wire) to Arduino 5V if you
are running a 5V board Arduino (Uno, etc.). If your board
is 3V, connect to that instead.
Connect sensor GND (black wire) to Arduino GND
Connect sensor SCL (yellow wire) to Arduino SCL
Connect sensor SDA (blue wire) to Arduino SDA
Connect sensor INT to Resistor leg 1
Connect LED Cathode (https://adafru.it/FTT) to Resistor
leg 2
LED Anode (https://adafru.it/FTT) to Arduino 5V
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 9 of 23

Open up File -> Examples -> Adafruit PCT2075 -> temp_alert_demo and upload to your Arduino wired up
to the sensor.
Upload the sketch to your board and open up the Serial Monitor ( Tools->Serial Monitor) at 115200 baud.
You should see the current value of the various temperature alert settings printed out, followed by
temperature measurements:
Temperature Alert Settings
High temperature threshold (https://adafru.it/FN9) is the temperature that the sensor compares to the
measured temperature each time it makes a measurement. If the current temperature is greater than or
equal to the high temperature threshold, the sensor registers a temperature fault. What happens with that
alert depends on the rest of the settings.
Temperature hysteresis (https://adafru.it/FN9) is the temperature that defines the bottom of the "active"
range of temperature where the sensor sill considers the temperature fault as being active. This
temperature must be less than the high temperature threshold.
The fault count (https://adafru.it/FN9) is how many consecutive temperature faults are required to raise an
alert on the INT pin. In the example code the fault count is set to 4 meaning that four measurements by
the sensor in a row must be equal to or greater than the high temperature threshold for the sensor to
raise an alert.
Handy Interstitial Diagram
This diagram from the datasheet (https://adafru.it/FTU) shows how the different parameters work together.
High temperature threshold (here as T ) and temperature hysteresis (T ) together define a
temperature range that specify when the INT pin (OS) responds to, depending on the alert mode.
Alert Modes
The Alert mode (https://adafru.it/FN9) dictates how the INT pin will be used to communicate with the user
ots hys
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 10 of 23

about the state of the temperature monitoring. In Comparator mode like in the example, the sensor acts
similar to a thermostat controlling an air conditioning unit. When the sensor raises a high temperature alert
according to the high temperature threshold and fault count, the INT pin is connected to ground,
completing the LED circuit and lighting the LED. Once the temperature falls below the temperature
hysteresis, the sensor puts the INT pin in a high impedance state, effectively disconnecting the LED from
ground.
With the sensor in Comparator mode, the sensor can control a cooling mechanism such as a fan by
having the INT pin activate a transistor or relay that controls the current flowing to the fan's
motor (https://adafru.it/dtG). This way the decision of when to activate the fan is controlled directly by the
PCT2075, allowing the microcontroller to focus on other things.
In Interrupt mode the sensor activates the INT pin twice: once when the alert is first raised, and a second
time when the temperature falls below the temperature hysteresis. In interrupt mode the INT pin is
deactivated by reading from the sensor.
Activating the Temperature Alert
Once wired as above, find a way to
safely
warm up the PCT2075 (definitely NOT with fire), and once it is
past the threshold temperature of 32.5 degrees C (90.5 degrees F) for four consecutive
measurements, the LED will light up until the temperature again falls below the temperature hysteresis.
If you aren't able to get the temperature up to 32.5 degrees, you can modify the temperature threshold
and hysteresis so that they're in a range that is manageable.
Temperature Example Code
#include <Adafruit_PCT2075.h>
Adafruit_PCT2075 PCT2075;
void setup() {
PCT2075 = Adafruit_PCT2075();
Serial.begin(115200);
// Wait until serial port is opened
while (!Serial) { delay(1); }
Serial.println("Adafruit PCT2075 Test");
if (!PCT2075.begin()) {
Serial.println("Couldn't find PCT2075 chip");
while (1);
}
Serial.println("Found PCT2075 chip");
}
void loop() {
Serial.print("Temperature: "); Serial.print(PCT2075.getTemperature());Serial.println(" C");
delay(1000);
}
Temperature Alert Example Code
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 11 of 23

#include <Adafruit_PCT2075.h>
Adafruit_PCT2075 pct;
void setup() {
pct = Adafruit_PCT2075();
Serial.begin(115200);
// Wait until serial port is opened
while (!Serial) { delay(1); }
Serial.println("Adafruit PCT2075 Test");
if (!pct.begin()) {
Serial.println("Couldn't find PCT2075 chip");
while (1);
}
Serial.println("Found PCT2075 chip");
pct.setIdleTime(1.0);
pct.setActiveHigh(true);
pct.setHighTemperatureThreshold(32.5);
Serial.print("High temperature threshold: ");Serial.print(pct.getHighTemperatureThreshold()); Serial.println("")
;
pct.setTemperatureHysteresis(30.5);
Serial.print("Temperature hysteresis: ");Serial.print(pct.getTemperatureHysteresis()); Serial.println("");
pct.setMode(PCT2075_MODE_COMPARITOR);
Serial.print("Alert mode set to: ");
switch (pct.getMode()) {
case PCT2075_MODE_INTERRUPT: Serial.println("Interrupt"); break;
case PCT2075_MODE_COMPARITOR: Serial.println("Comparitor"); break;
}
pct.setFaultCount(PCT2075_FAULT_COUNT_4); // since the loop timing and idle delay are in sync, it will take 4 lo
ops to fault
Serial.print("Fault count set to: ");
switch (pct.getFaultCount()) {
case PCT2075_FAULT_COUNT_1: Serial.println("1"); break;
case PCT2075_FAULT_COUNT_2: Serial.println("2"); break;
case PCT2075_FAULT_COUNT_4: Serial.println("4"); break;
case PCT2075_FAULT_COUNT_6: Serial.println("6"); break;
}
}
void loop() {
// checking every
Serial.print("Temperature: "); Serial.print(pct.getTemperature());Serial.println(" C");
delay(1000); // wait one second to match the idle time
}
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 12 of 23

Arduino Docs
Arduino Docs (https://adafru.it/FN9)
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 13 of 23

Python & CircuitPython
It's easy to use the PCT2075 temperature sensor with CircuitPython and the Adafruit CircuitPython
PCT2075 (https://adafru.it/FTV) module. This module allows you to easily write Python code that reads the
temperature and set an alert to go off when a given temperature is reached or exceeded.
You can use this sensor with any CircuitPython microcontroller board or with a Linux single board
computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility
library (https://adafru.it/BSN).
CircuitPython Microcontroller Wiring
First you'll need to wire up the sensor for a basic I2C connection. The STEMMA QT connectors give you
flexibility with how you choose to make the connections, but the required connections are fairly simple:
Board 3V to sensor VCC (red wire)
Board GND to sensor GND (black
wire)
Board SCL to sensor SCL (yellow wire)
Board SDA to sensor SDA (blue wire)
Note: This breakout includes pullup resistors on the I2C lines, no external pullups are required.
Python Computer Wiring
Since there are
dozens
of Linux computers/boards you can use we will show wiring for Raspberry
Pi (https://adafru.it/scY). For other platforms, please visit the guide for CircuitPython on Linux to see
whether your platform is supported (https://adafru.it/BSN).
Here's the Raspberry Pi wired with I2C:
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 14 of 23

Pi 3V to sensor VCC (red wire)
Pi GND to sensor GND (black
wire)
Pi SCL to sensor SCL (yellow wire)
Pi SDA to sensor SDA (blue wire)
CircuitPython Installation of PCT2075 Library
You'll need to install the Adafruit CircuitPython PCT2075 (https://adafru.it/FTW) library on your
CircuitPython board.
First make sure you are running the latest version of Adafruit CircuitPython (https://adafru.it/Amd) for your
board.
Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find
and install these libraries from Adafruit's CircuitPython library bundle (https://adafru.it/uap). Our
CircuitPython starter guide has a great page on how to install the library bundle (https://adafru.it/ABU).
For non-express boards like the Trinket M0 or Gemma M0, you'll need to manually install the necessary
libraries from the bundle:
adafruit_pct2075.mpy
adafruit_bus_device
adafruit_register
Before continuing make sure your board's lib folder or root filesystem has the adafruit_pct2075.mpy,
adafruit_bus_device, and adafruit_register files and folders copied over.
Next connect to the board's serial REPL (https://adafru.it/Awz)so you are at the CircuitPython >>> prompt.
Python Installation of PCT2075 Library
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 15 of 23

may also require enabling I2C on your platform and verifying you are running Python 3. Since each
platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get
your computer ready (https://adafru.it/BSN)!
Once that's done, from your command line run the following command:
sudo pip3 install adafruit-circuitpython-pct2075
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to
use CircuitPython on Python 2.x, it isn't supported!
CircuitPython & Python Usage
To demonstrate the usage of the sensor we'll initialize it and read the temperature measurements from
the board's Python REPL.
Run the following code to import the necessary modules and initialize the I2C connection with the sensor:
import time
import board
import adafruit_pct2075
i2c = board.I2C()
pct = adafruit_pct2075.PCT2075(i2c)
Now you're ready to read values from the sensor using the temperature property:
Temperature Alert Example
This next example will show you how to use the temperature alerting functions to let you know when the
measured temperature gets higher than a configurable point.
First, we will have to wire up an LED and current limiting resistor that the sensor will use to alert us about
the temperature. This requires just a few more connections than the basic temperature functionality. If you
were using the STEMMA QT connector without a breadboard, you'll need to add one so that you have a
place to plug in the LED and resistor.
Wire up the sensor according to the diagram for your type of platform below:
CircuitPython Wiring
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 16 of 23

Connect sensor VCC (red wire) to Feather 3V.
Connect sensor GND (black wire) to Feather GND
Connect sensor SCL (yellow wire) to Feather SCL
Connect sensor SDA (blue wire) to Feather SDA
Connect sensor INT to Resistor leg 1
Connect LED Cathode (https://adafru.it/FTT) to Resistor
leg 2
LED Anode (https://adafru.it/FTT) to Feather 5V
Python Computer Wiring
Connect sensor VCC (red wire) to Feather 3V.
Connect sensor GND (black wire) to Feather GND
Connect sensor SCL (yellow wire) to Feather SCL
Connect sensor SDA (blue wire) to Feather SDA
Connect sensor INT to Resistor leg 1
Connect LED Cathode (https://adafru.it/FTT) to Resistor
leg 2
LED Anode (https://adafru.it/FTT) to Feather 5V
Temperature Alert Settings
High temperature threshold (https://adafru.it/FTX) is the temperature that the sensor compares to the
measured temperature each time it makes a measurement. If the current temperature is greater than or
equal to the high temperature threshold, the sensor registers a temperature fault. What happens with that
alert depends on the rest of the settings.
Temperature hysteresis (https://adafru.it/FTX) is the temperature that defines the bottom of the "active"
range of temperature where the sensor sill considers the temperature fault as being active. This
temperature must be less than the high temperature threshold.
The fault count (https://adafru.it/FTX)is how many consecutive temperature faults are required to raise an
alert on the INT pin. In the example code the fault count is set to 4 meaning that four measurements by
the sensor in a row must be equal to or greater than the high temperature threshold for the sensor to
raise an alert.
Handy Interstitial Diagram
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 17 of 23

This diagram from the datasheet (https://adafru.it/FTU) shows how the different parameters work together.
High temperature threshold (here as T ) and temperature hysteresis (T ) together define a
temperature range that specify when the INT pin (OS) responds to, depending on the alert mode.
Alert Modes
The Alert mode (https://adafru.it/FTX) dictates how the INT pin will be used to communicate with the user
about the state of the temperature monitoring. In Comparator mode like in the example, the sensor acts
similar to a thermostat controlling an air conditioning unit. When the sensor raises a high temperature alert
according to the high temperature threshold and fault count, the INT pin is connected to ground,
completing the LED circuit and lighting the LED. Once the temperature falls below the temperature
hysteresis, the sensor puts the INT pin in a high impedance state, effectively disconnecting the LED from
ground.
With the sensor in Comparator mode, the sensor can control a cooling mechanism such as a fan by
having the INT pin activate a transistor or relay that controls the current flowing to the fan's
motor (https://adafru.it/dtG). This way the decision of when to activate the fan is controlled directly by the
PCT2075, allowing the microcontroller to focus on other things.
In Interrupt mode the sensor activates the INT pin twice: once when the alert is first raised, and a second
time when the temperature falls below the temperature hysteresis. In interrupt mode the INT pin is
deactivated by reading from the sensor.
Testing the Code
As in the previous example we start by making the required imports, setting up an I2C bus and creating
the pct2075.PCT2075 class instance.
import time
import board
import adafruit_pct2075
i2c = board.I2C()
pct = adafruit_pct2075.PCT2075(i2c)
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 18 of 23

Next we can set and verify the temperature threshold and hysteresis
pct.high_temperature_threshold = 35.5
print("High temperature threshold: %.2f"%pct.high_temperature_threshold)
pct.temperature_hysteresis = 30.0
print("Temperature hysteresis: %.2f"%pct.temperature_hysteresis)
Finally we set the number of consecutive temperature faults required to raise an alert.
pct.faults_to_alert = adafruit_pct2075.FaultCount.FAULT_4
if pct.faults_to_alert is adafruit_pct2075.FaultCount.FAULT_4:
print("Faults to alert: 4")
Finally we start taking temperature measurements in a loop. While it runs find a safe method of gently
warming the sensor such as a hair dryer or chilled with warm breath and a longer than average attention
span (definitely not fire). Once it has been warmed to or above 35.5 C (90.5 F) for 4 measurement cycles
the LED will light up
while True:
print("Temperature: %.2f C"%pct.temperature)
time.sleep(0.5)
Is it hot in here?
That's all it takes! The PCT2075 is a versatile temperature sensor that you'll find all sorts of uses for.
Don't wonder how hot it is, ask the PCT2075!
Temperature Example Code
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 19 of 23

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_pct2075
i2c = board.I2C() # uses board.SCL and board.SDA
pct = adafruit_pct2075.PCT2075(i2c)
pct.high_temperature_threshold = 35.5
pct.temperature_hysteresis = 30.0
pct.high_temp_active_high = False
print("High temp alert active high? %s" % pct.high_temp_active_high)
# Attach an LED with the Cathode to the INT pin and Anode to 3.3V with a current limiting resistor
while True:
print("Temperature: %.2f C" % pct.temperature)
time.sleep(0.5)
Temperature Alert Example
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_pct2075
i2c = board.I2C() # uses board.SCL and board.SDA
pct = adafruit_pct2075.PCT2075(i2c)
while True:
print("Temperature: %.2f C" % pct.temperature)
time.sleep(0.5)
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 20 of 23

Python Docs
Python Docs (https://adafru.it/FMR)
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 21 of 23

Downloads
Files
PCT2075 Datasheet (https://adafru.it/FTU)
EagleCAD files on GitHub (https://adafru.it/FTY)
Fritzing object from Adafruit Fritzing Library (https://adafru.it/FTZ)
Schematic
Fab Print
© Adafruit Industries https://learn.adafruit.com/adafruit-pct2075-temperature-sensor Page 22 of 23

© Adafruit Industries Last Updated: 2021-05-04 08:35:06 PM EDT Page 23 of 23