Infineon Team
Published © MIT

XENSIV™ Shield: All-In-One Sensor Hub for Home Assistant

You want to add IoT sensors like temperature, humidity, pressure, IMU, CO2 and radar into Home Assistant? Here is how to get started!

BeginnerProtip2 hours3,579
XENSIV™ Shield: All-In-One Sensor Hub for Home Assistant

Things used in this project

Hardware components

Infineon XENSIV™ Sensor Shield
×1
Raspberry Pi Pico W
Raspberry Pi Pico W
×1
Raspberry Pi Pico to Uno FlexyPin Adapter
×1
20-Pin Header (female)
×2
20-Pin Header (male)
(only necessary if Raspberry Pi Pico bought without Headers)
×2
PCB Mounting, Lock-In Support
(for desk placement, optional)
×4
Suction Cups
(for the window mount, optional)
×4
Nylon screw set
(for the window mount, optional)
×1

Software apps and online services

Home Assistant
Home Assistant
ESPHome

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
(necessary for the pin headers)
3D Printer (generic)
3D Printer (generic)
(for the window mount, optional)

Story

Read more

Custom parts and enclosures

Mounting Plate 3D Model (schematics)

Autodesk Inventor File for the window mounting plate

Mounting Plate 3D Model (step file)

This is the mounting plate to attach the device to a window with suction cups.

Schematics

Simple Stacking of Kits

Stacked from top to bottom:
XENSIV™ Sensor Shield
Raspberry Pi Pico
FlexyPin Pi Pico to Uno form-factor adapter

Solder necessary headers and stack the boards together.

Code

Custom YAML Configuration

YAML
This is our resulting YAML configuration with everything we have added in this guide.
Note: We excluded the device firmware configurations since they may be different for each user due to e.g. differing connection settings, encryption keys, WIFI SSID and passwords.
# ... device firmware configs...

# Custom configs
external_components:
  - source: github://michal-gora/esphome@xensiv_sensor_shield
    components: [xensiv_pas_co2_base, xensiv_pas_co2_i2c, xensiv_dps3xx_base, xensiv_dps3xx_i2c, bmi270]
    refresh: 0s

i2c:
  sda: GPIO20
  scl: GPIO21

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO19
  miso_pin: GPIO16

sensor:
  - platform: xensiv_pas_co2_i2c
    id: pasco2
    co2:
      name: "CO2"
      id: co2_sensor
    interrupt_pin: GPIO09
    sensor_rate: 1min
    operation_mode: continuous
    pressure_compensation_source: pressure_sensor
    power_pin: GPIO13  # Enable PAS CO2 5V Power (GPIO13 HIGH)
  - platform: xensiv_dps3xx_i2c
    pressure:
      name: "DPS3XX Pressure"
      id: pressure_sensor
    temperature:
      name: "DPS3XX Temperature"
      id: dps_temperature_sensor
    operation_mode: continuous
    update_interval: 10s
    address: 0x76
  - platform: sht3xd
    temperature:
      name: "SHT3X-D Temperature"
      id: sht_temperature_sensor
    humidity:
      name: "SHT3X-D Humidity"
      id: humidity_sensor
    update_interval: 10s
  - platform: bmi270
    address: 0x69
    accel_x:
      name: "BMI270 Accel X"
      id: accel_x
    accel_y:
      name: "BMI270 Accel Y"
      id: accel_y
    accel_z:
      name: "BMI270 Accel Z"
      id: accel_z
    gyro_x:
      name: "BMI270 Gyro X"
    gyro_y:
      name: "BMI270 Gyro Y"
    gyro_z:
      name: "BMI270 Gyro Z"
    update_interval: 5s
    temperature:
      name: "BMI270 Temperature"

# button platform for Home Assistant UI button
button:
  - platform: template
    name: "Measure CO2 Now"
    on_press:
      - lambda: |-
          id(pasco2).measure_now();

binary_sensor:
  # Radar TDET
  - platform: gpio
    pin:
      number: GPIO06  # TDET pin
      mode: INPUT
      inverted: true
    name: "Radar TDET"
    id: radar_sensor_tdet

  # Radar PDET
  - platform: gpio
    pin:
      number: GPIO07  # PDET pin
      mode: INPUT
      inverted: true
    name: "Radar PDET"
    id: radar_sensor_pdet

  # Window open/closed detection using accelerometer Z-axis
  - platform: template
    name: "Window Open"
    id: window_open
    device_class: window
    lambda: |-
      float threshold = -0.5;
      float z = id(accel_z).state;
      // Window closed: z ≈ 0.0 (gravity), Window open: z drops when tilted backwards
      return z < threshold;  // Adjust threshold based on testing

# TFT Display
display:
  - platform: st7735
    model: "INITR_MINI160X80"
    reset_pin: GPIO04
    cs_pin: GPIO17
    dc_pin: GPIO26
    rotation: 90
    device_width: 80
    device_height: 160
    col_start: 26    # Adjust to hide noisy columns on the edges
    row_start: 1     # Adjust to hide the noisy row on the edge
    update_interval: 0s
    invert_colors: True
    use_bgr: True
    lambda: |-
      double co2ppm = id(co2_sensor).state;
      double humidity = id(humidity_sensor).state;
      double pressure = id(pressure_sensor).state;
      double temperature = (id(dps_temperature_sensor).state + id(sht_temperature_sensor).state) / 2.0;

      auto background_color = Color(0, 0, 0);
      auto co2_color = Color(255, 128, 128);
      auto humidity_color = Color(255, 128, 255);
      auto pressure_color = Color(128, 255, 255);
      auto temperature_color = Color(255, 255, 0);
      auto tdet_color = Color(255, 0, 0);
      auto pdet_color = Color(0, 255, 0);

      // Background
      it.fill(background_color);

      // Sensor values
      if(id(co2_sensor).has_state()) it.printf(80, 2, id(my_font), co2_color, TextAlign::TOP_RIGHT, "%.1f ", co2ppm);
      if(id(humidity_sensor).has_state()) it.printf(80, 22, id(my_font), humidity_color, TextAlign::TOP_RIGHT, "%.1f ", humidity);
      if(id(pressure_sensor).has_state()) it.printf(80, 42, id(my_font), pressure_color, TextAlign::TOP_RIGHT, "%.1f ", pressure);
      if(id(dps_temperature_sensor).has_state() && id(sht_temperature_sensor).has_state()) it.printf(80, 62, id(my_font), temperature_color, TextAlign::TOP_RIGHT, "%.1f ", temperature);
      if(id(radar_sensor_tdet).has_state() && id(radar_sensor_tdet).state){
        auto motion_color = id(radar_sensor_pdet).has_state() && id(radar_sensor_pdet).state ? pdet_color : tdet_color;
        it.printf(125, 28, id(emoji_font), motion_color, TextAlign::TOP_LEFT, "👋");
      }

      // Sensor units
      it.printf(80, 2, id(my_font), co2_color, TextAlign::TOP_LEFT, "ppm");
      it.printf(80, 22, id(my_font), humidity_color, TextAlign::TOP_LEFT, "%%");
      it.printf(80, 42, id(my_font), pressure_color, TextAlign::TOP_LEFT, "hPa");
      it.printf(80, 62, id(my_font), temperature_color, TextAlign::TOP_LEFT, "°C");

font:
  - file: "gfonts://Roboto"
    id: my_font
    size: 16
  - file: "gfonts://Noto+Emoji"
    id: emoji_font
    size: 24
    glyphs:
      - "👋"   # Waving hand

Infineon XENSIV™ Sensor Components for ESPHome

Follow the blog post.

Credits

Infineon Team
126 projects • 201 followers
Hands-on projects, tutorials, and code for sensors, MCUs, connectivity, security, power, and IoT. Follow for new builds and ideas.

Comments