In this tutorial we will show how to build WiFi touch screen thermostat. ESP8266 WiFi touch screen thermostat is example of complex sensor build by ESP8266 EasyIoT Arduino library. We will use Arduino Mega 2560 and TFT 3.2" touch screen display. You will be able to access and control thermostat securely from remote locations. Thermostat will also show some additional data, like outdoor temperature, air pressure and weather forecast.

Improved version is here: ESP8266 WiFi touch screen thermostat (EasyIoT Coud)

ESP8266 touch screen thermostat

ESP8266 WiFi thermostat

Main features of thermostat

  • 6 modes - Auto, Off, LOLO, LO, HI, HIHI
  • Touch screen
  • WiFi connected
  • Four set temperatures (LOLO, LO, HI, HIHI) and weekly schedule
  • Time display
  • Additional data display - temperature in other room, air pressure and weather forecast 

Thermostat configuration

Materials

-Arduino Mega 2560

Arduino Mega 2560Arduino Mega 2560
$9.97
$6.99

 

-ESP8266 WiFi module

ESP8266 ESP-01 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-01 Serial WIFI Wireless Transceiver Module
$2.11
$17.00
ESP8266 ESP-03 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-03 Serial WIFI Wireless Transceiver Module
$2.07
$2.15
ESP8266 ESP-12 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-12 Serial WIFI Wireless Transceiver Module
$2.06
$1.75
ESP8266 ESP-05 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-05 Serial WIFI Wireless Transceiver Module
$1.88
ESP8266 ESP-07 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-07 Serial WIFI Wireless Transceiver Module
$2.18
$1.88

 

-BMP180 Digital Barometric Pressure Sensor

BMP180 Digital Barometric Pressure SensorBMP180 Digital Barometric Pressure Sensor
$1.22
$1.29

 

-DHT22 Digital Temperature And Humidity Sensor

DHT22 Digital Temperature And Humidity SensorDHT22 Digital Temperature And Humidity Sensor
$2.67
$2.45

 

-1 Channel Isolated 5V Relay Module

1 Channel Isolated 5V Relay Module1 Channel Isolated 5V Relay Module
$1.34
$1.12

 

-RTC DS1302 Real Time Clock Module 

RTC DS1302 Real Time Clock Module RTC DS1302 Real Time Clock Module
$0.99
$0.82

 

-3.2" TFT LCD Module Touch Panel+ TFT 3.2" LCD Shield Expansion Board For Arduino

3.2 TFT LCD + 3.2 TFT LCD Shield3.2 TFT LCD + 3.2 TFT LCD Shield
$22.99
$15.45

 

See buying guide at the end for details and please shop in our store to support EasyIoT framework.

Build

Connections

Arduino Meaga 2560 TFT display

This is easy, because we will use shield. Just put TFT 3.2" LCD Shield Expansion Board and 3.2" TFT LCD Module Touch Panel on top of Arduino Mega 2560.

ESP8266

In this case we will use HW serial1 to connect ESP8266 module. Follow Connenct 5V Arduino and ESP8266 tutorial to connect ESP module to Arduino. Arduino Serial1 RX pin is 19, Tx 18 and Reset pin is 12. For 3.3V power supply we will use 3.3 V from TFT shield expansion board. See picture below where to connect 3.3 V.

3.3V voltage for ESP8266

BMP180 

Arduino BMP180 module
VCC VCC
GND GND
20 SDA
21 SLC

DHT22

Arduino DHT22
VCC 1 VCC
GND 4 GND
8 2 DATA

Relay module

Relay module input is connected to pin 13 on Arduino. We also connect VCC and GND.

RTC DS1302

Arduino DS1302
VCC VCC
GND GND
11 CE
10 IO
9 CLK

Source Code

Source code can be found at GitHub.

Code corrections

First we should correct altitude to display correct air pressure. Altitude is in meters.

#define ALTITUDE 301.0 

Next we correct time zone to display correct time. Thermostat will synchronize it's time automatically when connected to EasyIoT server. Default timezone is CET, correct this code lines according to your timezone: 

TimeChangeRule CEST = {

  "CEST", Last, Sun, Mar, 2, 120};     //Central European Summer Time

TimeChangeRule CET = {

  "CET ", Last, Sun, Oct, 3, 60};       //Central European Standard Time

Timezone tzc(CEST, CET);

 

Also don't forget to set access point username and password and server IP address in EasyIoT library.

Configure EasyIoT server

Go to EasyIoT server Web interface to Configure->Drivers->ESP8266 EasyIoT driver and press button Add Node. 

If you successfully added node you should see node addresses (no timeout message).

Then add new sensor nodes to  one of groups. If you done everything correctly you can see thermostat on front Web page. Now you can control and monitor your room temperature remotely.

 

Automation

Our thermostat also shows temperature and humidity in another room and outside. To get temperature and humidity on thermostat we write automation script on EasyIoT server. See EasyIoT server automation manual how to add script. Script is below, correct sensor addresses according to your configuration.

/*

  This code is running one time when program is enabled

*/

public void Setup()

{

   EventHelper.ModuleChangedHandler((o, m, p) =>

    {

 

      // outdoor

      if (m.Domain == Domains.MYSENSORS && m.Address == "N5S0" && p.Property == "Sensor.Temperature")

        DriverHelper.ProcessCommad(Domains.ESP8266, "N1S4", "ControlLevel", p.Value);

      

      // bedroom

      if (m.Domain == Domains.MYSENSORS && m.Address == "N7S0" && p.Property == "Sensor.Temperature")

        DriverHelper.ProcessCommad(Domains.ESP8266, "N1S3", "ControlLevel", p.Value);

 

 if (m.Domain == Domains.MYSENSORS && m.Address == "N7S1" && p.Property == "Sensor.Humidity")

        DriverHelper.ProcessCommad(Domains.ESP8266, "N1S5", "ControlLevel", p.Value);

 

        return true;

    });

}

 

/*

  This code is running periodicaly when program is enabled. 

  Cron job detirmine running period.

*/

public void Run()

{

Future improvements

This is first version of thermostat. For future versions there is idea to add multiple zones to thermostat. Also display graphic design is basic. If we use SD card attached to TFT display we can create screens with nice graphic.

See more tutorials at ​http://iot-playground.com/build​

Improved version is here: ESP8266 WiFi touch screen thermostat (EasyIoT Coud) 

Buying guide

 

To support this site and EasyIoT framework development please buy in our store.

 

Arduino Mega 2560

For bigger Arduino projects.

3.2 TFT LCD + 3.2 TFT LCD Shield

Mega 2560 ATmega2560-16AU Board for arduino + 3.2 TFT LCD + 3.2 TFT LCD Shield

Best price if you need Meaga 2560, TFT screen and shiels.

BMP180 Digital Barometric Pressure Sensor

The BMP180 is the new digital barometric pressure sensor of Bosch Sensortec, with a very high performance.

DHT22 Digital Temperature And Humidity Sensor

The DHT22 is a basic, low-cost digital temperature and humidity sensor.

1 Channel Isolated 5V Relay Module

Be able to control various appliances, and other equipments with large current.

RTC DS1302 Real Time Clock Module

The DS1302 is a Real Time Clock (RTC) or TimeKeeping Chip with a build-in Trickle-Charger

Plastic Project Box Enclosure-6.2

ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module

ESP8266 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module

ESP8266 serial WIFI model ESP-03

ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module

ESP8266 serial Port WIFI wireless module ESP-12

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

5V 2A Charger Micro USB

For Raspberry Pi or sensor modules, cheap and easy power solution.


Comments   

#26 Johana 2019-02-11 17:01
Hello, Great project!!, Could you tell me where I can find the Last 3 Librarys?, please.

#include
#include
#include

Thanks
#25 pedro 2018-03-15 18:55
Hello,
Thanks for the project.

I'm trying to compile the code without any succes.. pleased to ge any help.


esp8266_touch_screen_thermostat:35: error: expected ',' or '...' before '&' token
esp8266_touch_screen_thermostat:35: error: ISO C++ forbids declaration of 'Esp8266EasyIoTMsg' with no type
esp8266_touch_screen_thermostat:29: error: conflicting declaration 'uint8_t SevenSegNumFontPlus []'
C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\UTFT/SevenSegNumFontPlus.h:8: error: 'SevenSegNumFontPlus' has a previous declaration as 'const uint8_t SevenSegNumFontPlus [2204]'
esp8266_touch_screen_thermostat:31: error: conflicting declaration 'uint8_t SevenSeg_XXXL_Num []'
C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\U..........
+1 #24 yooo 2016-11-30 09:40
Quoting Ioannis:
Could plz someone point me to how to program the hysteresis, so it could be inside the settings in order to change it from the menu of the touch screen???

hi ioannis.
where are you find all this libraries?
+1 #23 yooo 2016-11-30 09:38
hi dear
i cant find some of libraries that i need for complile. can you help mi to find?
#22 Ioannis 2016-11-02 13:11
Could plz someone point me to how to program the hysteresis, so it could be inside the settings in order to change it from the menu of the touch screen???
#21 poulayn 2016-02-25 17:42
Does not connect to the waiter(server) to post(show) outside temperature I entered password and sid cubicle(dock,garage) has you there it something has to make it more thank you
#20 Biser Georgiev 2016-01-31 13:20
Great project, but something still can not compile the sketch.
Last gives me an error "expected unqualified-id before '.' token" on line 255
#19 robert fowler 2016-01-20 01:22
Love the project and I am trying to recreate it now.
I could really use some help locating the following libraries.
//#include
//#include
//#include

Thank you in advance.
#18 Clan 2016-01-08 17:02
I struggled for quite a while to compile this project. I could not find the libraries for these 3 include lines.
SevenSegNumFontPlus.h
SevenSeg_XXXL_Num.h
arial_normal.h

In the end I just deleted these three lines and it compiled without a problem. I do not know why this works but it does. Using Arduino 1.6.7
#17 Super User 2015-09-20 12:22
Quoting infodavid:
Hi,

Great project !

Is it possible to use some Wifi transceivers and standard Ethernet ones to use wired and wireless sensors ?

Thanks for this job!


Yes. This is framework, you can build your own sensors connected to ethernet or mysensors network.

You have no rights to post comments

Forum latest

  • No posts to display.