DIY Smart Thermostat
Blog Postcircuito teamDecember 11, 2017

Hi everyone, and welcome to another Circuito of the Week. This time we’re going to make a smart thermostat circuit, to help control the humidity and temperature in your home. Like all the other Home Automation circuits, we welcome you to take this example and make it your own by adding or removing components and customizing the circuit to your needs. is here to help you make the magic.

Smart Thermostat Circuit Logic 

The smart thermostat is based on a temperature and humidity sensor.

Build a Smart Thermostat now >>

We can set the smart thermostat to perform different actions once the temperature or humidity levels rise too high or drop too low. These definitions will be programmed into the controller. Here we chose to use NodeMCU since it has built-in wifi. 

The thermostat could have 2 modes, the first automatic, meaning it will self-control the a/c temp and fan speed as well as turn off and on the unit. The second will be manually remote-controlled via the internet. In both cases, the control of the a/c unit will be done by sending an IR signal to the air conditioner using an IR emitter coded with the specific IR code of your a/c. For the second mode, controlling your a/c while you’re not home, you can use an IoT dashboard such as Blynk, or any other IoT platform you choose. You can check out our recommended IoT apps here.

The Smart Thermostat Circuit

Click this link or the image below to see the circuit components.

Main components for smart thermostat

  • DHT22 - A low-cost humidity and temperature sensor.Returned Values: Temperature and Humidity through a single wire digital interface.
  • NodeMCU - An Arduino compatible ESP8266 based micro-controller with onboard WiFi. It is great for the internet of things projects or just as an Arduino replacement.
  • Infrared (IR) Led emitter - A very simple IR emitter, that allows you to build your own IR remote control for devices that can receive an IR signal.
  • Micro OLED - The SparkFun Micro OLED Breakout Board breaks out a small monochrome, blue-on-black OLED. It’s “micro”, but it still packs a punch – the OLED display is crisp, and you can fit a deceivingly large amount of graphics on there. We can use it to display the current thermostat readings.

Secondary components for smart thermostat

‘Secondary components’ is a general name for all the components that you need to add to your circuit in order to make it work. We divide these components into: General secondary components – non-electronic components you can find in almost every circuit. Such as breadboards, jumper wires, etc.Specific secondary components – components added to the circuit according to the specific components we want to use. For example resistors, voltage regulators, capacitors, etc. which are present in order to adjust current flow and voltage levels.You can find information about the secondary components you need for each core component in datasheets and example circuits, and you can also calculate some of their values on your own. When using circuit generator, the values of the secondary components are calculated for you automatically.

Specific secondary components 

  • 10K and 220 Ohm resistors - A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element.In electronic circuits, resistors are used to reduce current flow, adjust signal levels, to divide voltages, bias active elements, terminate transmission lines and much more.Required By: Infrared (IR) LED 950nm and DHT22.
  • Transistor - NPN BC337 - Bipolar Junction Transistors (BJTs) are manufactured in two types, NPN and PNP, and are available as individual components, or fabricated in integrated circuits, often in large numbers. The basic function of a BJT is to amplify current. This allows BJTs to be used as amplifiers or switches, giving them wide applicability in almost every electronic equipment.Required By: Infrared (IR) LED 950nm

Generic secondary components

  • Breadboard – best for prototyping. Allows you to electrically connect different components using jumper wires.
  • Jumper Wires M/F and  M/M – Used for connecting components to the breadboard.
  • USB micro-B Cable – Connects the microcontroller to the computer, for uploading code.
  • Male headers – Soldered to different components, in this case, it is for the Logic Level Converter used by the ESP8266.
  • DC Barrel Jack Adapter - Breadboard Compatible.

Buying the components for the smart thermostat

You can now buy the components for your circuit on*! by clicking on Review and Buy on the right bottom corner. It’s also possible to buy the components from any other distributor, online store or local electronics store. We have a list of some great maker-oriented online stores in this link.

*some of the components may be temporarily out of stock


Click this link or the image below to see the wiring diagram for the smart thermostat

For a detailed step by step wiring guide and test code, click on view project guide at the bottom of the circuit.

Test Code

After wiring the circuit, you can download the test code from the project guide and upload it to your NodeMCU to check your connectivity. Make sure to choose the correct controller model in the Arduino IDE.

Note: not all the components have a test code. You can check if the component has a test code by hovering over the “i” icon next to the component