Human Presence and Motion Sensor Arduino Interface

Last Updated on March 16, 2024

We know there are N number of sensors around us, even if we don’t always notice them. We use Sensors for converting physical quantity measurements into electrical quantity and digital values. Most decisions are made depends on the sensors output. They help make our surroundings more efficient, convenient, and safe. One of its kind Human Presence and Motion IR Sensor STHS34PF80 from st. It is a infrared motion and presence detection sensor with operating wavelength between 5 µm and 20 µm. Here we are going to design Human Presence and Motion Sensor Arduino Interface and experiment it.

Human Presence and Motion Sensors serve as versatile components in modern technology, finding applications across a spectrum of environments. In residential spaces, these sensors enhance energy efficiency by automating lighting and climate control systems based on human occupancy, ensuring resources are utilized only when needed. The security sector leverages these sensors to detect unauthorized movements, activating alarms or surveillance systems to bolster safety measures. In commercial settings, Human Presence and Motion Sensors contribute to workspace optimization, automatically adjusting lighting and climate settings to align with occupancy patterns. These types of sensors are plays important role in IoT systems also.

About STHS34PF80

The STHS34PF80 is an advanced Human Presence and Motion Sensor known for its precision and versatility in detecting both human presence and motion. The STHS34PF80 sensor has been designed to measure the amount of IR radiation emitted from an object within its field of view. The information is digitally processed by the ASIC, which can be programmed to monitor motion, presence, or an overtemperature condition. It can detect the presence of a human being at a distance up to 4 meters without the need of an optical lens. It features a sophisticated I2C interface, facilitating seamless communication with microcontrollers like Arduino. The STHS34PF80 provides detailed data, including presence values measured in centimeters, motion detection flags, and ambient temperature information. It can operate with 1.7V to 3.6V supply Voltage and consumes 10 µA for its operation. It provides 2-wire I²C / 3-wire SPI serial interface.

STHS34PF80 Circuit

Since this sensor comes in LGA-10L package, we need to place it on a PCB, here is the simple example schematic to bring ²C connection with the sensor. The device power supply must be provided through the VDD line, a power supply decoupling capacitor (100 nF) must be placed as near as possible to the supply pins of device (VDD). Depending on the application, an additional capacitor of 1µF could be placed on the VDD line to avoid power noise on VDD. Otherwise you can use Breakout board from sparkfun.

Human Presence and Motion Sensor Arduino Interface

Wiring of STHS34PF80 sensor Breakout board with Arduino Uno is so simple because of I2C connection. Just connect,

ARDUINO Uno BoardSTHS34PF80 Breakout board

In the Arduino STHS34PF80 interface project, the sensor’s operation is centered around its advanced features and unique TMOS technology. As an infrared sensor, the STHS34PF80 excels in detecting the presence of stationary and moving objects, along with identifying overtemperature conditions. Using TMOS technology, the sensor measures the IR radiation emitted by objects within its field of view. A specialized optical band-pass filter limits the operating range to wavelengths between 5 µm and 20 µm, ensuring insensitivity to visible light and other bands.

The sensor’s matrix of floating vacuum thermal transistors MOS (TMOS) acts as a singular sensing element, leveraging ST’s MEMS manufacturing technologies for unparalleled thermal isolation. This allows the sensor to translate even the minutest temperature changes into electrical signals, which are then processed by the embedded ASIC. The STHS34PF80 employs a dual-part structure, with one exposed to IR radiation and the other shielded, enabling a differential reading to mitigate sensor self-heating effects. Notably, the sensor integrates a high-accuracy temperature sensor for measuring ambient temperature and accurately gauging IR radiation.

The ASIC also incorporates intelligent processing to discern between stationary and moving objects, triggering dedicated interrupts for enhanced functionality. This intricate design ensures precise and reliable detection capabilities, making the STHS34PF80 a powerful component for various applications in the Arduino interface project.

Human Presence and Motion Sensor Arduino Code

  SparkFun Human Presence and Motion Sensor - STHS34PF80 (Qwiic)
    SparkFun Qwiic Mini Human Presence and Motion Sensor - STHS34PF80

  Bring to you by 
  Don't Remove above lines.

#include "SparkFun_STHS34PF80_Arduino_Library.h"
#include <Wire.h>

STHS34PF80_I2C mySensor;

// Values to fill with presence and motion data
int16_t presenceVal = 0;
int16_t motionVal = 0;
float temperatureVal = 0;

void setup()
    Serial.println("STHS34PF80 Example 1: Basic Readings");

    // Begin I2C
    Wire.begin(); // Removed the comparison

    // Establish communication with the device
    if (mySensor.begin() == false)
        Serial.println("Error setting up device - please check wiring.");
        while (1);


void loop()
    sths34pf80_tmos_drdy_status_t dataReady;

    // Check whether the sensor has new data - run through the loop if data is ready
    if (dataReady.drdy == 1)
        sths34pf80_tmos_func_status_t status;

        // If the presence flag is high, then print data
        if (status.pres_flag == 1)
            // Presence Units: cm^-1
            Serial.print("Presence: ");
            Serial.println(" cm^-1");

        if (status.mot_flag == 1)
            Serial.println("Motion Detected!");

        if (status.tamb_shock_flag == 1)
            Serial.print("Temperature: ");
            Serial.println(" °C");

This Arduino Program, Read human presence detection values from the STHS34PF80 sensor, print them to terminal. Prints raw IR presence (cm^-1), if motion was detected, and temperature in degrees C.


SparkFun Human Presence and Motion Sensor – STHS34PF80 Product page

STHS34PF80 Datasheet.

STHS34PF80 Arduino Library

Leave a Reply

Your email address will not be published. Required fields are marked *