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, Arduino Mega 2560 and TFT 3.2" touch screen display. Thermostat is connected to EasyIoT Cloud and can be controlled over internet.

 

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
  • Connected to EasyIoT Cloud and can be controlled in  WEB interface or native mobile application over internet

 

 

 

Materials

-Arduino Mega 2560

Arduino Mega 2560Arduino Mega 2560
$9.97

 

-ESP8266 WiFi module

ESP8266 ESP-01 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-01 Serial WIFI Wireless Transceiver Module
$2.14
$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.85
ESP8266 ESP-05 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-05 Serial WIFI Wireless Transceiver Module
$1.88
$3.92
ESP8266 ESP-07 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-07 Serial WIFI Wireless Transceiver Module
$2.18

 

-BMP180 Digital Barometric Pressure Sensor

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

 

-DHT22 Digital Temperature And Humidity Sensor

DHT22 Digital Temperature And Humidity SensorDHT22 Digital Temperature And Humidity Sensor
$2.69
$2.52

 

-1 Channel Isolated 5V Relay Module

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

 

-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

 

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

ESP8266 is used as WiFi gateway to EasyIoT Cloud. It is loaded with firmware written in Arduino IDE. In this case we will use HW serial1 on Arduino Mega 2560 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.

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 51 on Arduino. We also connect VCC and GND.

RTC DS1302

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

Source Code

Additional libraries are here: lib.

ESP8266 source program 

ESP8266 source code can be found at GitHub. Upload program with ESP8266 Arduino IDE. If you are using ESP-01 then keep DEBUG in comments. To enable DEBUG use ESP8266 NODE MCU which allows one additional software serial.

Arduino Mega 2560 program

Arduino Mega 2560 program is available at GitHub

Before you upload program to Arduino is recommended to change following lines:


#define DEFAULT_AP_SSID "XXXX"
#define DEFAULT_AP_PASSWORD "XXXX"
#define DEFAULT_CLOUD_USERNAME "XXXX"
#define DEFAULT_CLOUD_PASSWORD "XXXX"

 

Set access point name and password and EasyIoT Cloud username and password. You can later set those settings on thermostat touch screen (Settings->WiFi Cloud), but it's easier to change it in program. Program will automatically add thermostat to EasyIoT Cloud and configure module parameters. Of course you need to register to EasyIoT Cloud first. 

Configure EasyIoT Cloud

Automation

Our thermostat also shows temperature and humidity in another room and outside. First add those modules to EasyIoT Cloud. Add three automation programs to forward value of sensors (temperature 1, humidity 1 and temperature 2) to thermostat. In automation (Configure->Automation) add new program and select program type to Forward value. Then select appropriate module and parameter to forward values. Thermostat parameters are following:

Sensor.Parameter4 - temperature 1

Sensor.Parameter5 - temperature 2

Sensor.Parameter6 - humidity 1

 

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​

 

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.


You have no rights to post comments