ESP8266 Thermostat

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
enesbcs
Normal user
Posts: 587
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
Thermostat controls
thermostat_controls.jpg (107.13 KiB) Viewed 81326 times

User avatar
grovkillen
Core team member
Posts: 3621
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: 587
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: 175
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
Core team member
Posts: 3621
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: 497
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: 587
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: 344
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: 587
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.

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

Re: ESP8266 Thermostat

#10 Post by riker1 » 24 Jan 2019, 18:34

ok, thanks will check that

Sounds great

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

Re: ESP8266 Thermostat

#11 Post by riker1 » 29 Jan 2019, 17:43

Hi
nice, it is working.
Thanks

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: ESP8266 Thermostat

#12 Post by Patou » 02 Feb 2019, 20:42

Hello enesbcs,
Very nice project and clear explanations
I will start to build your project for my house
Can I ask 2 questions ? :
- Can we use as temperature sensing device also a BME 280 ?
- Can we integrate in your project a clock task to change the temp setpoint for high to low following day/night
Or is it easier to do this with Domoticz ?
Thanks in advance
Patou

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: ESP8266 Thermostat

#13 Post by kimot » 03 Feb 2019, 11:35

It is very easy schedule temperature setting from Domoticz.
When I was planning my heating regulator, I imagined a similar sophisticated device with a display and buttons.
But the circumstances forced me to make the quick fix, that I have achieved with ESPeasy and Domoticz.
And now almost after two years of operation, I see that it is fully enough to control the heating in my house.
The regulation is performed by ESPEases itself by means of rules and setting of parameters and passing of results (display of temperatures, consumption report, planning, etc.) is ensured by Domoticz.
The display and buttons on the regulators do not miss me, even though I'm thinking about displaying some information - like outside temperatures on some of the visible regulators.

My old version with Wemos D1 and ESPeasy _dev13 ( very very slow responses ) you can see here:

https://www.youtube.com/watch?v=1ef6tRinOQ4

Now I have regulators built on Sonoff Basic with ESPEasy v2.0 and everything is much much faster.

Some sreenshots:
regulator.jpg
regulator.jpg (843.46 KiB) Viewed 80536 times
Screenshot_3.png
Screenshot_3.png (135.58 KiB) Viewed 80536 times
Screenshot_2.png
Screenshot_2.png (204.1 KiB) Viewed 80536 times
2018-12-28-183359_1920x1080_scrot.png
2018-12-28-183359_1920x1080_scrot.png (161.48 KiB) Viewed 80536 times

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

Re: ESP8266 Thermostat

#14 Post by enesbcs » 03 Feb 2019, 16:25

Patou wrote: 02 Feb 2019, 20:42 - Can we use as temperature sensing device also a BME 280 ?
You can use any temperature sensing device, that ESPEasy supports.
Local temperature sensing is a last resort for me, as i have temperature sensors in EVERY room, and Domoticz sends the actual temperature data to the thermostat. (motion sensors helps Domoticz to decide which room needs to be monitored) - This is why i am implemented "Temperature source" setting in my plugin, which can be even a Dummy, for remote management.
Patou wrote: 02 Feb 2019, 20:42 - Can we integrate in your project a clock task to change the temp setpoint for high to low following day/night
Or is it easier to do this with Domoticz ?
I am using LUA in Domoticz to change setpoint on the device based on the Number of people present, based on the specific room temperatures, where motion detected, and of course based on time. (easy if you knew LUA)
Storing the setpoints locally in the device SPIFFS can be done with some programming in Arduino. (not so easy)
Otherwise if you have to do some local setpoint, can be done by ESPEasy rules. (not so hard)

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: ESP8266 Thermostat

#15 Post by Patou » 04 Feb 2019, 12:35

To enesbcs,
Thanks for your explanations. I made a test units and everything works
Also different setpoints related to time with Esp rules
To Kimot,
Thanks also for your informations, as I am only a beginner with Lua script can you send me some of yours so i can adapt them on my situation It will be easier for me than starting from scrach
Patou

alex77k12
New user
Posts: 7
Joined: 10 Apr 2017, 19:13

Re: ESP8266 Thermostat

#16 Post by alex77k12 » 20 Jul 2019, 19:39

hello, can someone explain to me how I can change so that after a while the display turns off and after pressing a key it wakes up for a while? I can't always leave it on and I can't find a way to turn it off, if I interrupt the current to oled then not seen read until restart

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

Re: ESP8266 Thermostat

#17 Post by enesbcs » 20 Jul 2019, 20:03

alex77k12 wrote: 20 Jul 2019, 19:39 hello, can someone explain to me how I can change so that after a while the display turns off and after pressing a key it wakes up for a while? I can't always leave it on and I can't find a way to turn it off, if I interrupt the current to oled then not seen read until restart
If you are using P168 ThermOLED plugin you can switch it by executing "oledframedcmd,off" and "oledframedcmd,on" either by inside Rules or by remotely through UDP/HTTP/MQTT... Triggering a rule based upon a GPIO status also not a big deal with a Switch plugin.
My ThermOLED display for example is switching on by my Domoticz server, when one of the nearby 3 motion sensors are active, and set display off, when all 3 motion sensor is inactive for 15 minutes.

alex77k12
New user
Posts: 7
Joined: 10 Apr 2017, 19:13

Re: ESP8266 Thermostat

#18 Post by alex77k12 » 23 Jul 2019, 18:16

yes, I thank you, I didn't read it right, you wrote it both in the first post and in the code, my fault. Being trying to do with rules and not with domoticz because wifi problems have already happened and the various esp have not worked until a solution to a problem. Since that fact since then I do every independent esp and use domoticz only for things not absolutely necessary so that it should there being a fault does not stop the whole house but only the point where there was the problem
However I really liked your plugin, but personally I would have expanded as a day / night temperature if not even weekly, but that's okay too, we use domoticz to do weekly but in the absence of connection at least the house does not become cold

alienboyxp
New user
Posts: 2
Joined: 13 Nov 2019, 11:00

Re: ESP8266 Thermostat

#19 Post by alienboyxp » 13 Nov 2019, 13:01

enesbcs really good job!!!
it´s my first "complex" project with ESPEasy and I have everything build with no issues. I will use to my 3D printer cabinet to control filament temperature.
I can request a flavor? :oops:
I don´t control really well how rules works and currently I set up a rule to power on and off the OLED display by time but I will like to create a rule to power on different "triggers" like when rele is on, you push the switches and leave on during x seconds for example.
Can you help/guide me on how to do these rules? I will really appreciate your help I read a lot of different documentation and I´m a bit lost currently. I see the option to link with Domotikz but for my use case, I will like to be a totally standalone thermostat.

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

Re: ESP8266 Thermostat

#20 Post by enesbcs » 13 Nov 2019, 18:52

alienboyxp wrote: 13 Nov 2019, 13:01 I don´t control really well how rules works and currently I set up a rule to power on and off the OLED display by time but I will like to create a rule to power on different "triggers" like when rele is on, you push the switches and leave on during x seconds for example.
Can you help/guide me on how to do these rules? I will really appreciate your help I read a lot of different documentation and I´m a bit lost currently. I see the option to link with Domotikz but for my use case, I will like to be a totally standalone thermostat.
Watching the relay status is simple if you are using the same names as me in the first example then:

Code: Select all

on disp#heating>0 do
  event,displayon
endon

on displayon do
 oledframedcmd,on
 timerSet 1,180
endon

on Rules#Timer=1 do
 oledframedcmd,off
endon
Catching button presses needs a bit more work, as it is handled inside the device, you have to define new Switch devices to the button GPIOS and create "on ... do ... endon" event handlers, that calls "event, displayon" when a button pressed. As buttons works with pullups, they usually in State 1, and State will be 0 when pushed. So something like

Code: Select all

on buttonname#State<1 do
 event,displayon
endon
may work.

alienboyxp
New user
Posts: 2
Joined: 13 Nov 2019, 11:00

Re: ESP8266 Thermostat

#21 Post by alienboyxp » 15 Nov 2019, 09:55

Thanks enesbcs, you rock!!!
with your guideline, I have yet configured my ESP thermostat as needed and integrated with Domoticz.
Thak you very much!! I hope if you do any improvements you update this thread or if you have the firmware on Github (or similar) we can follow.

rudolf@webgate.hu
New user
Posts: 1
Joined: 28 May 2020, 13:26

Re: ESP8266 Thermostat

#22 Post by rudolf@webgate.hu » 28 May 2020, 13:33

Hello there!

Very nice project!

Can someone help me how to configure it to monitor multiple rooms and turn on/off the heating acording to the specific room temperature?

Will the thermostat store the rooms setpoint temperature to know when can be the heating turned off, or if he get another setpoint temp from another temp sensor the previous one will be ignored?

I mean in the practice:

Thermostat A with a relay is in the bathroom where the heater is, he can switch on/off the heater
Temperature sensor A is in the bedroom
Temperature sensor B is in the livingroom
etc..
etc..
.
.
i have 7 rooms wich has to bee controlled, so i have 7 temp. sensors and i can send their value to therm A dummy device for example.

If I set the setpoint on therm. A to 24 C, will he keep the relay on until all rooms temperature reaches 24 c?

I understand that you have motion sensors in your rooms so when motion is detected domoticz sends the temperature value to the thermostat, but what happens when you are sleeping and not moving or when you are not at home and want all rooms to be at same temperature?

I hope you get my confusion :)

Thanks in advance for the help

Lastnovik
New user
Posts: 3
Joined: 22 Jul 2020, 12:02

Re: ESP8266 Thermostat

#23 Post by Lastnovik » 22 Jul 2020, 12:08

Hi everyone!

I need this plugin to work with DS18B20. I dicided use espeasy as the sauna thermostat.

I tried to compile with platformio with latest version Espeasy (ESPEasy-mega-20200721), but get a lot of errors...

What I have to do?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP8266 Thermostat

#24 Post by TD-er » 22 Jul 2020, 12:35

Can you be a bit more specific?
For example, what are you trying to compile and what errors do you get?

Lastnovik
New user
Posts: 3
Joined: 22 Jul 2020, 12:02

Re: ESP8266 Thermostat

#25 Post by Lastnovik » 22 Jul 2020, 13:59

TD-er wrote: 22 Jul 2020, 12:35 Can you be a bit more specific?
For example, what are you trying to compile and what errors do you get?
I've got latest source code from github, put in /src directory _P168_Thermostat.ino and Dialog_Plain_18_font.h. Without this files all compiled susses.
Try to compile with VSC Platformio and get errors:

Building in release mode
Compiling .pio\build\normal_ESP8266_4M1M\src\ESPEasy.ino.cpp.o
Archiving .pio\build\normal_ESP8266_4M1M\libFrameworkArduino.a
F:/IoT/ESPEasy-mega/src/_P168_Thermostat.ino: In function 'boolean Plugin_168(byte, EventStruct*, String&)':
F:/IoT/ESPEasy-mega/src/_P168_Thermostat.ino:233:47: error: 'WebServer' was not declared in this scope
strncpy(P168_deviceTemplate[varNr], WebServer.arg(argName).c_str(), sizeof(P168_deviceTemplate[varNr]));
^
*** [.pio\build\normal_ESP8266_4M1M\src\ESPEasy.ino.cpp.o] Error 1

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP8266 Thermostat

#26 Post by TD-er » 22 Jul 2020, 14:50

Rename WebServer to web_server.

Lastnovik
New user
Posts: 3
Joined: 22 Jul 2020, 12:02

Re: ESP8266 Thermostat

#27 Post by Lastnovik » 22 Jul 2020, 15:38

TD-er wrote: 22 Jul 2020, 14:50 Rename WebServer to web_server.
Thanks a lot! It's help me. All compiled ok.

Building .pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin
Retrieving maximum program size .pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf
Checking size .pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [====== ] 55.0% (used 45068 bytes from 81920 bytes)
Flash: [======== ] 84.3% (used 880588 bytes from 1044464 bytes)
Creating BIN file ".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin" using ".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf"
bin_gzip([".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin"], [".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf"])
bin_elf_copy([".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin"], [".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf"])
copy to: build_output\debug\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf
copy to: build_output\bin\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin
copy to: build_output\bin\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin.gz
copy to: build_output\debug\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.env.txt

viewcart
New user
Posts: 4
Joined: 22 Jul 2020, 16:55

Re: ESP8266 Thermostat

#28 Post by viewcart » 22 Jul 2020, 21:03

The thermostat is not battery operated it is a OpenTherm version, of you close the contacts on an OpenTherm boiler you will probably kill the boiler print. It is indeed a OpenTherm unit, hence the text modulation on the front plate. You should get yourself an OpenTherm gateway which is placed in between the boiler and the thermostat and it can manipulated the setpoint (amongst other values). I have had one for year until the boiler maintence guy short circuited the boiler print and now i'm left with an on/off thermostat.

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#29 Post by 2007-i » 10 Oct 2020, 22:53

Tell me how to add a PID controller to control the heater using SSR relay?
Thanks!

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

Re: ESP8266 Thermostat

#30 Post by enesbcs » 11 Oct 2020, 10:51

Tell me what is the PID controller? :)

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#31 Post by 2007-i » 12 Oct 2020, 18:58

enesbcs wrote: 11 Oct 2020, 10:51 Tell me what is the PID controller? :)
https://en.wikipedia.org/wiki/PID_controller
and library
https://github.com/br3ttb/Arduino-PID-Library

It is highly discouraged to use electromechanical relays in the pid-controller, they will fail from frequent switching.
The correct solution would be to use a solid state relay, or a module with a triac.

Here in this video you can clearly see the work of the PID controller; the author uses a halogen lamp as a heater.
https://www.youtube.com/watch?v=9odcsuAquLU
Thanks.

I really liked your menu and the implementation! Thanks a lot for the project!
I redid your project, works well! But the heater heats up until the temperature in the room reaches the set one, so the battery heats up strongly until the required temperature is established. And after turning off the heater, the temperature in the room still rises slightly, because the batteries are still hot.

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#32 Post by 2007-i » 15 Oct 2020, 00:13

Lastnovik wrote: 22 Jul 2020, 15:38
TD-er wrote: 22 Jul 2020, 14:50 Rename WebServer to web_server.
Thanks a lot! It's help me. All compiled ok.

Building .pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin
Retrieving maximum program size .pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf
Checking size .pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [====== ] 55.0% (used 45068 bytes from 81920 bytes)
Flash: [======== ] 84.3% (used 880588 bytes from 1044464 bytes)
Creating BIN file ".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin" using ".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf"
bin_gzip([".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin"], [".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf"])
bin_elf_copy([".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin"], [".pio\build\normal_ESP8266_4M1M\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf"])
copy to: build_output\debug\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.elf
copy to: build_output\bin\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin
copy to: build_output\bin\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.bin.gz
copy to: build_output\debug\ESP_Easy_mega_20200722_normal_ESP8266_4M1M.env.txt
Please tell me, can you put a compiled file with this version or newer here? Older versions do not support csv. This is only in support since May 2020. Unfortunately, I did not manage to build a new version with this thermostat plug-in, I used Arduino ide.

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#33 Post by 2007-i » 29 Oct 2020, 00:42

I compiled the firmware with your plugin and the new version of ESPEasy_ESP82xx_mega-20201009, the compilation was successful except for the points described here:
viewtopic.php?f=4&t=7607&p=47529#p47521

After the corrections indicated by the respected TD-er and Ath, I managed to compile the firmware with plugins:
_P168_ThermOLED
_P159_Pushbutton
but the display does not show all the symbols, there is no full time, signal level and something else.
Unit Name: Thermo
P01029-031307.jpg
P01029-031307.jpg (434.27 KiB) Viewed 60442 times
The files Dialog_Plain_12_font.h and Dialog_Plain_18_font.h are present.
Only now I found the Dialog_Plain_12_font.h file on a third-party resource.

Please tell me the problem may be in updating the library or you need an original file Dialog_Plain_12_font.h ?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP8266 Thermostat

#34 Post by TD-er » 29 Oct 2020, 10:50

If you have it complete, can you make 2 pull requests for both plugins to the main repository?

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#35 Post by 2007-i » 29 Oct 2020, 11:08

Do you mean submit plugins for upload to the repository?
Only these plugins are not mine, I just added them to define_plugin_sets.h and compiled.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP8266 Thermostat

#36 Post by TD-er » 29 Oct 2020, 11:14

If you have made no changes, but found them to be working, then just telling me (via an issue on GitHub) is also enough.
If there's still files missing, then I would also need to know.

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#37 Post by 2007-i » 29 Oct 2020, 11:32

OK I understood.
These plugins worked fine with the ESPEasy_Thermo_4M_c241.bin version.
When building with new versions (ESPEasy_ESP82xx_mega-20201009 and ESPEasy_ESP82xx_mega-20201022), the errors that I described here
viewtopic.php?f=4&t=7607&p=47529#p47521
And after the corrections made, not everything is displayed on the display.

anin
New user
Posts: 1
Joined: 17 Feb 2021, 18:57

Re: ESP8266 Thermostat

#38 Post by anin » 17 Feb 2021, 19:21

2007-i wrote: 29 Oct 2020, 11:32 OK I understood.
These plugins worked fine with the ESPEasy_Thermo_4M_c241.bin version.
When building with new versions (ESPEasy_ESP82xx_mega-20201009 and ESPEasy_ESP82xx_mega-20201022), the errors that I described here
viewtopic.php?f=4&t=7607&p=47529#p47521
And after the corrections made, not everything is displayed on the display.
Hello,

Please explain what and where did you changed in ESP82xx_mega-20201022, i am trayng to compile the firmware and i get some errors. Or maybe you can share your arduino sketch to compare with default sketch.

Thx

adamb94
New user
Posts: 2
Joined: 17 Feb 2021, 20:25

Re: ESP8266 Thermostat

#39 Post by adamb94 » 17 Feb 2021, 20:27

Hi,

I have another problem. I want to use ESPEasy and this plugin to my central heating stove pump. But I need to work it backwards: If Temperature from sensor >= setpoint then turn on relay. If temperature from sensor < setpoint then turn off relay. Do you have any advice how to do it?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP8266 Thermostat

#40 Post by TD-er » 17 Feb 2021, 21:00

anin wrote: 17 Feb 2021, 19:21
2007-i wrote: 29 Oct 2020, 11:32 OK I understood.
These plugins worked fine with the ESPEasy_Thermo_4M_c241.bin version.
When building with new versions (ESPEasy_ESP82xx_mega-20201009 and ESPEasy_ESP82xx_mega-20201022), the errors that I described here
viewtopic.php?f=4&t=7607&p=47529#p47521
And after the corrections made, not everything is displayed on the display.
Hello,

Please explain what and where did you changed in ESP82xx_mega-20201022, i am trayng to compile the firmware and i get some errors. Or maybe you can share your arduino sketch to compare with default sketch.

Thx
Have you tried the PR I still have open for this?
https://github.com/letscontrolit/ESPEasy/pull/3393

adamb94
New user
Posts: 2
Joined: 17 Feb 2021, 20:25

Re: ESP8266 Thermostat

#41 Post by adamb94 » 20 Mar 2021, 09:01

Hi,

I had same issue with your plugin as user 2007-i, but I've resolved it. Please look on my code for modified functions:
For time:
Old:

Code: Select all

void P168_display_time() {
  String dtime = "%systime%";
  String newString = parseTemplate(dtime, 10);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  P168_display->setFont(Dialog_plain_12);
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 0, 28, 13);
  P168_display->setColor(WHITE);
  P168_display->drawString(0, 0, newString.substring(0, 5));
}
New:

Code: Select all

void P168_display_time() {
  char c_dtime[5];
  String dtime = "";
  strcpy(c_dtime,"%syshour_0%");
  strcat(c_dtime,":");
  strcat(c_dtime,"%sysmin_0%");
  dtime = String(c_dtime);
  String newString = parseTemplate(dtime, 10);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  P168_display->setFont(Dialog_plain_12);
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 0, 28, 13);
  P168_display->setColor(WHITE);
  P168_display->drawString(0, 0, newString.substring(0, 5));
}
For degree symbol issue I've replaced it with "*". Please look:
Old:

Code: Select all

void P168_display_page() {
  // init with full clear
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 15, 128, 49);
  P168_display->setColor(WHITE);

  Plugin_168_prev_temp = 99;
  Plugin_168_prev_setpoint = 0;
  Plugin_168_prev_heating = 255;
  Plugin_168_prev_mode = 255;
  Plugin_168_prev_timeout = 32768;

  P168_display->setFont(Dialog_plain_12);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  String tstr = "{D}C";
  String newString = parseTemplate(tstr, 10);
  P168_display->drawString(18, 46, newString.substring(0, 5));

  P168_display_heat();

  P168_display->drawHorizontalLine(0, 15, 128);
  P168_display->drawVerticalLine(52, 14, 49);

  P168_display->drawCircle(107, 47, 26);
  P168_display->drawHorizontalLine(78, 47, 8);
  P168_display->drawVerticalLine(107, 19, 10);

  P168_display_mode();
  P168_display_setpoint_temp(0);
  P168_display_current_temp();

}
New:

Code: Select all

void P168_display_page() {
  // init with full clear
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 15, 128, 49);
  P168_display->setColor(WHITE);

  Plugin_168_prev_temp = 99;
  Plugin_168_prev_setpoint = 0;
  Plugin_168_prev_heating = 255;
  Plugin_168_prev_mode = 255;
  Plugin_168_prev_timeout = 32768;

  P168_display->setFont(Dialog_plain_12);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  String tstr = "*C";
  String newString = parseTemplate(tstr, 10);
  P168_display->drawString(18, 46, newString.substring(0, 5));

  P168_display_heat();

  P168_display->drawHorizontalLine(0, 15, 128);
  P168_display->drawVerticalLine(52, 14, 49);

  P168_display->drawCircle(107, 47, 26);
  P168_display->drawHorizontalLine(78, 47, 8);
  P168_display->drawVerticalLine(107, 19, 10);

  P168_display_mode();
  P168_display_setpoint_temp(0);
  P168_display_current_temp();

}
I've modified line String tstr = "{D}C"; into String tstr = "*C";.

I hope I helped :)

mghaff007
New user
Posts: 4
Joined: 22 Dec 2017, 02:21

Re: ESP8266 Thermostat

#42 Post by mghaff007 » 07 Apr 2021, 22:12

Has anyone been able to get this to compile in platformIO and the latest release? If so how did you accomplish this task? thanks

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP8266 Thermostat

#43 Post by Ath » 07 Apr 2021, 22:20

TD-er wrote: 17 Feb 2021, 21:00 Have you tried the PR I still have open for this?
https://github.com/letscontrolit/ESPEasy/pull/3393
This is updated to compile with current ESPEasy code, and TD-er is using PlatformIO for development (as am I), so...

Latest changes as suggested here, since the PR was made, have not been included, though.
And P168 has been renamed to P109.
/Ton (PayPal.me)

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#44 Post by 2007-i » 01 Oct 2021, 10:10

Please tell me how you can change the thermostat control to PID regulation?
I have powerful semistors so that I do not use mechanical relays that quickly fail. And I want a smoother heating.

2007-i
Normal user
Posts: 18
Joined: 10 Oct 2020, 22:34

Re: ESP8266 Thermostat

#45 Post by 2007-i » 01 Oct 2021, 18:08

adamb94 wrote: 20 Mar 2021, 09:01 Hi,

I had same issue with your plugin as user 2007-i, but I've resolved it. Please look on my code for modified functions:
For time:
Old:

Code: Select all

void P168_display_time() {
  String dtime = "%systime%";
  String newString = parseTemplate(dtime, 10);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  P168_display->setFont(Dialog_plain_12);
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 0, 28, 13);
  P168_display->setColor(WHITE);
  P168_display->drawString(0, 0, newString.substring(0, 5));
}
New:

Code: Select all

void P168_display_time() {
  char c_dtime[5];
  String dtime = "";
  strcpy(c_dtime,"%syshour_0%");
  strcat(c_dtime,":");
  strcat(c_dtime,"%sysmin_0%");
  dtime = String(c_dtime);
  String newString = parseTemplate(dtime, 10);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  P168_display->setFont(Dialog_plain_12);
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 0, 28, 13);
  P168_display->setColor(WHITE);
  P168_display->drawString(0, 0, newString.substring(0, 5));
}
For degree symbol issue I've replaced it with "*". Please look:
Old:

Code: Select all

void P168_display_page() {
  // init with full clear
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 15, 128, 49);
  P168_display->setColor(WHITE);

  Plugin_168_prev_temp = 99;
  Plugin_168_prev_setpoint = 0;
  Plugin_168_prev_heating = 255;
  Plugin_168_prev_mode = 255;
  Plugin_168_prev_timeout = 32768;

  P168_display->setFont(Dialog_plain_12);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  String tstr = "{D}C";
  String newString = parseTemplate(tstr, 10);
  P168_display->drawString(18, 46, newString.substring(0, 5));

  P168_display_heat();

  P168_display->drawHorizontalLine(0, 15, 128);
  P168_display->drawVerticalLine(52, 14, 49);

  P168_display->drawCircle(107, 47, 26);
  P168_display->drawHorizontalLine(78, 47, 8);
  P168_display->drawVerticalLine(107, 19, 10);

  P168_display_mode();
  P168_display_setpoint_temp(0);
  P168_display_current_temp();

}
New:

Code: Select all

void P168_display_page() {
  // init with full clear
  P168_display->setColor(BLACK);
  P168_display->fillRect(0, 15, 128, 49);
  P168_display->setColor(WHITE);

  Plugin_168_prev_temp = 99;
  Plugin_168_prev_setpoint = 0;
  Plugin_168_prev_heating = 255;
  Plugin_168_prev_mode = 255;
  Plugin_168_prev_timeout = 32768;

  P168_display->setFont(Dialog_plain_12);
  P168_display->setTextAlignment(TEXT_ALIGN_LEFT);
  String tstr = "*C";
  String newString = parseTemplate(tstr, 10);
  P168_display->drawString(18, 46, newString.substring(0, 5));

  P168_display_heat();

  P168_display->drawHorizontalLine(0, 15, 128);
  P168_display->drawVerticalLine(52, 14, 49);

  P168_display->drawCircle(107, 47, 26);
  P168_display->drawHorizontalLine(78, 47, 8);
  P168_display->drawVerticalLine(107, 19, 10);

  P168_display_mode();
  P168_display_setpoint_temp(0);
  P168_display_current_temp();

}
I've modified line String tstr = "{D}C"; into String tstr = "*C";.

I hope I helped :)

Thanks for the fix, everything works. But I changed the degree icon like this and it works.
String tstr = "°C";

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests