ESP8266 Thermostat

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
User avatar
enesbcs
Normal user
Posts: 295
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

ESP8266 Thermostat

#1 Post by enesbcs » 09 Jan 2019, 20:32

ESP8266 Thermostat
Image
Parts required:
  • 107x87x59mm Plastic Electronics Project DIN Rail PLC Box
  • NodeMCU ESP8266 Development Board (ESP12)
  • HLK-PM01 5VDC 3W power supply (HLK)
  • Fuse N400mA 250VAC 5x20mm + fuse socket (Bizt/400mA)
  • Varistor for 275V (VDR/275V)
  • 5x7 cm Prototype Paper
  • 5x7cm Double-Side Protoboard Prototype PCB Board
  • 1x3 Matrix Array Key Membrane Switch Keypad 36x55mm (BTN-L,BTN-R,BTN-M)
  • 5V 1-Channel Relay Module with Optocoupler Level (RELÉ)
  • AC 250V 3A 2 Pin ON/OFF I/O SPST Snap in Mini Rocker Switch (Kapcsoló)
  • 2 Poles/2 Pin 2.54mm/0.1" PCB Universal Screw Terminal Block
  • AM2320 Digital Temperature and Humidity Sensor (AM2320)
  • OLED 1.3" White LCD 4PIN Display Module I2C Interface 128x64 (OLED)
(*)Text between parenthesis is drawing symbols below!

Wiring:
Image
230V AC arrives from left (Line,Neutral) and "Kazán kontaktus" is 2wire that controls the boiler. (either Normally Open start/stop signal, or if boiler is old, it can control 230VAC)

ESP12 pinout:
  • RX (GPIO3/D9) = BTN-M (Menu button)
  • D1 (GPIO5/SCL) = OLED SDA + AM2320 SDA (it is only reversed for easy soldering)
  • D2 (GPIO4/SDA) = OLED SCL + AM2320 SCL (it is only reversed for easy soldering)
  • D5 (GPIO14) = Relay IN
  • D6 (GPIO12) = BTN-M (Left button)
  • D7 (GPIO13) = BTN-R (Right button)

    Inside:
    Image
    Image

    I developed P168 ThermoLED ESPEasy plugin for easy usage:
    https://github.com/enesbcs/ESPEasyPlugi ... rmOLED.ino
    Complete ESPEasy firmware can be downloaded from here:
    https://drive.google.com/file/d/1SVa6bv ... sp=sharing

    P168 features :
    - Displays and use current temperature from specified Device/Value (can be a Dummy for example)
    - Displays and maintains setpoint value
    - on power down/up this plugin maintains and reloads RELAY and SETPOINT values from SPIFFS
    - Supports 3 buttons, LEFT, RIGHT and MODE selection (MODE button cycles modes below,
    LEFT/RIGHT increases-decreases setpoint OR timeout (Mode sensitive)
    - one output relay need to be specified, currently only HIGH level active supported
    - 3 mode is available:
    - 0 or X: set relay permanently off no matter what
    - 1 or A: set relay ON if current temperature below setpoint, and set OFF when
    temperature+hysteresis reached - comparison made at setted Plugin interval (AUTO MODE)
    - 2 or M: set relay ON for specified time in minutes (MANUAL ON MODE), after timeout, mode switch to "A"

    List of commands :
    - oledframedcmd,[OLED_STATUS] Inherited command from P036 status can be:
    [off/on/low/med/high]
    - thermo,setpoint,[target_temperature] Target setpoint, only used in Mode "A"
    - thermo,heating,[RELAY_STATUS] Manually forcing relay status [off/on]
    - thermo,mode,[MODE],[TIMEOUT] Set to either mode X/A/M, if M selected,
    then TIMEOUT can be specified in minutes

    Command Examples :
    - /control?cmd=thermo,setpoint,23 Set target setpoint to 23 Celsius
    - /control?cmd=thermo,mode,1 Set mode to AUTOMATIC so it starts to maintain setpoint temperature
    - /control?cmd=thermo,mode,2,5 Starts pre-heat for 5 minute, does not care about TEMP, then go to AUTO mode after timeout
    - /control?cmd=thermo,mode,0 Switch heating off, absolutely do nothing until further notice


    ESPEasy device settings:
    Image

    P168 control plugin settings:
    Image

    Sample rules:

    Code: Select all

    on System#Boot do
     event,loctemp
    endon
    
    on loctemp do
     TaskValueSet,3,1,[homero#Temperature]
     TaskValueSet,3,2,0
    endon
    
    on exttemp do
     TaskValueSet,3,1,%eventvalue%
     TaskValueSet,3,2,1
     timerSet 1,180
    endon
    
    on Rules#Timer=1 do
     event,loctemp
    endon
    
    on homero#Temperature do
     if [glob#external]=0
      TaskValueSet,3,1,[homero#Temperature]
     endif
    endon
    
    The code above makes it possible to use it's own AM2320 settings as default or if nothing sends to it a remote update.
    Remote temperature can be sent by the following URL:
    http://THERMOSTAT_IPADDRESS/control?cmd=event,exttemp=21.5
Attachments
thermostat_controls.jpg
Thermostat controls
thermostat_controls.jpg (107.13 KiB) Viewed 456 times

User avatar
grovkillen
Normal user
Posts: 2585
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: ESP8266 Thermostat

#2 Post by grovkillen » 09 Jan 2019, 21:28

Love it! Good job! :o
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
enesbcs
Normal user
Posts: 295
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: ESP8266 Thermostat

#3 Post by enesbcs » 09 Jan 2019, 22:31

grovkillen wrote:
09 Jan 2019, 21:28
Love it! Good job! :o
Thanks! It could not have been created without ESPEasy! :) And of course without Plugin_036, which is the base of this one.
Believe it or not, the hardest thing in coding was to create and display a flame icon on the display... :) It took a while until i understood why the flame was mirrored and splitted half after conversion...

asuz
Normal user
Posts: 26
Joined: 31 Oct 2018, 18:22

Re: ESP8266 Thermostat

#4 Post by asuz » 09 Jan 2019, 22:35

Thanks for that project, i will built your project soon :)

User avatar
grovkillen
Normal user
Posts: 2585
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: ESP8266 Thermostat

#5 Post by grovkillen » 09 Jan 2019, 22:45

enesbcs wrote:
09 Jan 2019, 22:31
grovkillen wrote:
09 Jan 2019, 21:28
Love it! Good job! :o
Thanks! It could not have been created without ESPEasy! :) And of course without Plugin_036, which is the base of this one.
Believe it or not, the hardest thing in coding was to create and display a flame icon on the display... :) It took a while until i understood why the flame was mirrored and splitted half after conversion...
Yeah it's always those silly things that takes time :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

papperone
Normal user
Posts: 491
Joined: 04 Oct 2016, 23:16

Re: ESP8266 Thermostat

#6 Post by papperone » 10 Jan 2019, 07:13

great project, well done!!!

I may give a small advice... make the display not always "ON" else you will need to replace the OLED module every 3/4 months due to the fast worn out :(
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

User avatar
enesbcs
Normal user
Posts: 295
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: ESP8266 Thermostat

#7 Post by enesbcs » 10 Jan 2019, 08:34

papperone wrote:
10 Jan 2019, 07:13
great project, well done!!!

I may give a small advice... make the display not always "ON" else you will need to replace the OLED module every 3/4 months due to the fast worn out :(
Thank you. I have motion sensors nearby and Domoticz switches the OLED display off when no motion for 15 minutes, than switches to ON if motion occurs.

riker1
Normal user
Posts: 207
Joined: 26 Dec 2017, 18:02

Re: ESP8266 Thermostat

#8 Post by riker1 » 17 Jan 2019, 12:03

Hi

looks great.

Having a question:

I just want to use the 1x3 Matrix Array Key Membrane Switch Keypad 36x55mm (BTN-L,BTN-R,BTN-M)

How to I need to connect it and get readings for that?

I did

1 vcc
2 gnd
3. D2
4. D1

but do not get readings for it.
Thanks for Hints.

t

User avatar
enesbcs
Normal user
Posts: 295
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: ESP8266 Thermostat

#9 Post by enesbcs » 17 Jan 2019, 18:18

riker1 wrote:
17 Jan 2019, 12:03
I just want to use the 1x3 Matrix Array Key Membrane Switch Keypad 36x55mm (BTN-L,BTN-R,BTN-M)

How to I need to connect it and get readings for that?

I did

1 vcc
2 gnd
3. D2
4. D1
but do not get readings for it.
Thanks for Hints.
Sorry for the missing information, but as you see it has only four connection to three button... so VCC is not needed. It is a simple switching device, you can check with a multimeter, if you connect GND to the 1st pin, than the other 3 pin will go to GND when you press a button. This is the reason why Input-pullup is also necessary, with this setting the GPIO's will go back to HIGH if not pressed, and go to LOW if pressed. (if you left out pullup, than you will surely not see any changes - P168 plugin automatically use input_pullup for button pins)
And D1/D2 is the default I2C pins as you surely know.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests