Using the STHS34PF80 breakout with Arduino involves wiring up the breakout to your Arduino-compatible microcontroller, installing the Adafruit_STHS34PF80 library, and running the provided example code.
Wiring
Wire as shown for a 5V board like an Uno. If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the sensor VIN.
Here is an Adafruit Metro wired up to the sensor using the STEMMA QT connector:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Here is an Adafruit Metro wired up using a solderless breadboard:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Library Installation
You can install the Adafruit_STHS34PF80 library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit STHS34PF80, and select the Adafruit STHS34PF80 library:
If asked about dependencies, click "Install all".
If the "Dependencies" window does not come up, then you already have the dependencies installed.
If the dependencies are already installed, you must make sure you update them through the Arduino Library Manager before loading the example!
// Basic test for STHS34PF80 infrared sensor
#include "Adafruit_STHS34PF80.h"
Adafruit_STHS34PF80 sths;
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("Adafruit STHS34PF80 test!");
if (!sths.begin()) {
Serial.println("Could not find a valid STHS34PF80 sensor, check wiring!");
while (1) delay(10);
}
Serial.println("STHS34PF80 Found!");
}
void loop() {
if (!sths.isDataReady()) {
delay(10);
return;
}
Serial.print("Data ready! ");
// Read temperature data
Serial.print("Amb: ");
Serial.print(sths.readAmbientTemperature(), 2);
Serial.print("°C");
// Check for presence and show data if detected
if (sths.isPresence()) {
Serial.print(" PRESENCE: ");
Serial.print(sths.readPresence());
}
// Check for motion and show data if detected
if (sths.isMotion()) {
Serial.print(" MOTION: ");
Serial.print(sths.readMotion());
}
// Check for temperature shock and show data if detected
if (sths.isTempShock()) {
Serial.print(" TEMP_SHOCK: ");
Serial.print(sths.readTempShock());
}
// Show object temperatures only if presence or motion detected
if (sths.isPresence() || sths.isMotion()) {
Serial.print(" Obj: ");
Serial.print(sths.readObjectTemperature());
Serial.print(", Comp: ");
Serial.print(sths.readCompensatedObjectTemperature());
}
Serial.println();
delay(100);
}
Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You'll see the STHS34PF80 recognized over I2C. Then, the ambient temperature, presence detection and motion detection are printed to the Serial Monitor.
Page last edited October 15, 2025
Text editor powered by tinymce.