Build a DIY NEST‑Like Smart Thermostat with Node‑RED on Raspberry Pi
Control your home’s temperature from anywhere with a custom NEST‑style thermostat built on a Raspberry Pi, Node‑RED, and ESPurna firmware.
Project Overview
After juggling multiple work shifts, I found it impossible to manually tweak my old home thermostat each week. I needed a remote solution that let me turn heating on or off before I arrived home—and save energy while I was away.
I chose to replicate the sleek NEST design using an inexpensive ITEAD 1‑CH Wi‑Fi relay and a DHT22 temperature/humidity sensor. The result is a fully‑functional thermostat that can be monitored and controlled from any internet‑connected device.
Installing Software
- Set up Raspbian Stretch on a Raspberry Pi 3.
- Install the Mosquitto MQTT broker on the Pi.
- Install Node‑RED on the Pi.
- Install Atom + PlatformIO on your PC for firmware development.
Hardware Hacking
The ITEAD 1‑CH module is a 5V, 12V Wi‑Fi relay that comes with a proprietary EWeLink firmware. To avoid vendor lock‑in, I replaced that firmware with ESPurna, an open‑source firmware for ESP8266 devices. ESPurna supports custom sensors, making it ideal for adding a DHT22 to the relay.
I soldered the following pins on the PSA‑01 module (the ESP8266 core):
- GND, 3V3, and GPIO14 to the DHT22.
- TX, RX, and GND for flashing the firmware.
Building the Custom Firmware
After installing Atom+PlatformIO, download the latest ESPurna release and extract it. Add the code folder to a new project via File → Add Project Folder.
Edit /config/sensors.h to enable DHT support:#define DHT_SUPPORT 1
#define DHT_PIN 14
Set env_default = itead-1ch-inching in platformio.ini. Build the project; a successful build ends with a SUCCESS message.
To flash, connect a USB‑to‑Serial adapter to the board, hold the button next to the micro‑USB port while powering on, and watch the LED turn red. Click Upload in PlatformIO; the adapter will blink as the firmware writes to flash.
How to Upload ESPurna Custom Firmware with PlatformIO
After flashing, disconnect the adapter, attach the DHT22 (3V3, GND, GPIO14), and power the device with a 5V mobile charger.
The device boots into a soft‑AP named DEVICE_XXXXXX (password: fibonacci). Connect to it and open https://192.168.4.1 to configure Wi‑Fi and security settings.
Configuring the Thermostat
Once connected to your home network, the ESPurna web interface exposes sensor readings, switch status, and a wealth of MQTT, NTP, HTTP, and home‑automation integrations. Configure the MQTT broker details to match the Mosquitto instance on your Raspberry Pi.
Node‑RED will receive sensor data via MQTT and implement your control logic—turning heating on or off based on temperature thresholds or schedules. The flow editor also allows you to create a custom dashboard for remote monitoring.
With the system in place, you can now set desired temperatures, schedule heating, and view real‑time humidity—all from your phone, tablet, or laptop.
Next Steps
Explore advanced features like Amazon Alexa integration, Thingspeak data logging, or automated schedule creation within Node‑RED. The open‑source nature of ESPurna and Node‑RED means you can extend this project indefinitely.
Read More Detail: DIY Virtual Alike NEST Thermostat with Node-RED
Manufacturing process
- Build a Budget‑Friendly Raspberry Pi Baby Crying Detector – DIY Guide
- Build a DIY VR Skateboard with Arduino, Google Cardboard, and Bluetooth
- DIY Low‑Cost Portable Thermometer with Android Integration
- DIY Arduino J.A.R.V.I.S Voice Assistant with Arc Reactor Design
- Connecting Arduino to NMEA‑0183: A Step‑by‑Step Guide
- Reliable Arduino-Based Device Tester for Power Blough-R Products
- Build a Portable RFID Door Lock with Arduino – Step-by-Step Guide
- Build a Retro-Style FM Radio with the TEA5767 Module – Step‑by‑Step DIY Guide
- Build a Wire‑Free Arduino Robot Arm, Controlled from Your Smartphone
- Transform Your DIY SCARA Robot into a Precise Laser Engraver with Arduino