Building a $10 Smart Temp Sensor with ESPHome & ESP32-C3

By The Maker Team December 04, 2025
Building a $10 Smart Temp Sensor with ESPHome & ESP32-C3
In this Build Guide:
  • Hardware: Why we use the ESP32-C3 and DHT22.
  • Wiring: Exact pinouts to avoid "boot loops."
  • The Code: Flashing ESPHome via USB.
  • Home Assistant: Creating the automation logic.
  • The Goal: Blue for cold, Green for comfy, Red for hot.

Smart plugs and bulbs are great, but a true smart home needs sensory input. You cannot automate your AC or heater efficiently if your house doesn't know how hot it is.

In this guide, we will build a Wi-Fi-connected temperature and humidity monitor for about $10. Unlike store-bought sensors, this one updates instantly, doesn't require a hub, and includes a visual status LED to tell you the room's "mood" at a glance.


Step 1: Parts & Wiring (ESP32-C3)

We are using the ESP32-C3. It is cheaper and more power-efficient than the classic ESP32, making it perfect for simple sensors.

The Parts List
  • ESP32-C3 DevKit (or SuperMini)
  • DHT22 Sensor (Better accuracy than DHT11)
  • RGB LED (Common Cathode)
  • 3x 330O Resistors (For the LEDs)
  • 1x 10kO Resistor (For DHT22, if not built-in)
The Wiring

Warning: The ESP32-C3 has specific "strapping pins" (GPIO 8, 9) that must be left alone during boot. Use the exact pins below.

  • DHT22 Data: GPIO 10
  • Red LED: GPIO 3
  • Green LED: GPIO 4
  • Blue LED: GPIO 5

Wiring Details

  1. Power: Connect ESP32 3.3V and GND to the breadboard power rails.
  2. DHT22: Connect Pin 1 to 3.3V, Pin 4 to GND, and Pin 2 (Data) to GPIO 10. (Note: Add a 10k resistor between Pin 1 and Pin 2 if your sensor is "bare" plastic).
  3. LEDs: Connect the Long Leg (Cathode) to GND. Connect the other three legs to GPIO 3, 4, and 5 using 330O resistors to limit current.

Step 2: The ESPHome YAML

We will configure the ESP32 to expose the temperature sensor and three separate lights (Red, Green, Blue) to Home Assistant. This allows HA to control the lights based on the temperature logic.

Create a new device in ESPHome and use the following configuration:

esphome:
  name: "bedroom-temp-sensor"
  friendly_name: "Bedroom Monitor"

esp32:
  board: esp32-c3-devkitm-1
  variant: esp32c3

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "YOUR_OTA_PASSWORD"

wifi:
  ssid: "YOUR_WIFI_SSID"
  password: "YOUR_WIFI_PASSWORD"

# The DHT22 Sensor Setup
sensor:
  - platform: dht
    pin: 10
    temperature:
      name: "Bedroom Temperature"
    humidity:
      name: "Bedroom Humidity"
    update_interval: 10s
    model: DHT22

# The Status LEDs defined as generic lights
light:
  - platform: binary
    name: "Status Red"
    output: led_red
  - platform: binary
    name: "Status Green"
    output: led_green
  - platform: binary
    name: "Status Blue"
    output: led_blue

# Define the Output Pins
output:
  - platform: gpio
    pin: 3
    id: led_red
  - platform: gpio
    pin: 4
    id: led_green
  - platform: gpio
    pin: 5
    id: led_blue

Flash this code to your device. Once it reboots, go to Home Assistant > Settings > Devices, and you will see your new "Bedroom Monitor" ready to go.


Step 3: The Automation Logic

Now that Home Assistant knows the temperature and controls the LEDs, let's write the logic. We want a visual indicator of comfort:

  • Cold (< 60°F): Blue LED
  • Perfect (60°F - 90°F): Green LED
  • Hot (> 90°F): Red LED

Add this to your automations.yaml:

alias: "Bedroom Temp Status LEDs"
trigger:
  - platform: state
    entity_id: sensor.bedroom_temperature
action:
  - choose:
      # Scenario 1: It is HOT (> 90)
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_temperature
            above: 90
        sequence:
          - service: light.turn_on
            target: { entity_id: light.status_red }
          - service: light.turn_off
            target: { entity_id: [light.status_green, light.status_blue] }
            
      # Scenario 2: It is COLD (< 60)
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_temperature
            below: 60
        sequence:
          - service: light.turn_on
            target: { entity_id: light.status_blue }
          - service: light.turn_off
            target: { entity_id: [light.status_red, light.status_green] }

    # Scenario 3: It is COMFY (Default)
    default:
      - service: light.turn_on
        target: { entity_id: light.status_green }
      - service: light.turn_off
        target: { entity_id: [light.status_red, light.status_blue] }

Conclusion

You have just built a custom environmental monitor that communicates directly with your home automation system. Unlike battery-powered Zigbee sensors, this device updates instantly and provides visual feedback without you having to check your phone.

Share Your Build

Did you 3D print a case for your sensor? Or maybe you added a motion sensor to the mix? Join Great Meets to find other makers in your area. Create a group to host a "Soldering Sunday" or find an existing meetup near you.


Find or Create a Group ?