Just posting to say a big thanks - you saved me a LOT of work and have done a fantastic job. I've taken your project as starting point and added a remote temperature sensor plus some other bits and bobs to suit my needs.
Excellent work!! Two additional features that I have been thinking about include being able to fall back to the existing system in case something goes wrong and being able to change the temperature controlled to say 2 or 3 different locations in my house. I'd be interested in your comments?
Best to wire it in parallel with the existing system and then switch off the existing system using that as a backup. You could use remote sensors to send over temperature readings of other zones and then expend the test for temperature to three values. The structure is such that should be easy, needs sone good logical names for values to help with the logic.
Thanks again David, this is another great project! I forked it and have been working through getting it operating with my esp32 and sht21 sensor. Ended up merging bme280/sht21 sensor code since their are so similar. I've noticed a few NaN on the display so I started looking at the ReadSensor rates and noticed there is a timed call to ReadSensors() in loop() but also on the HomePage() method which was also getting refreshed at 5sec intervals. I've also added a Makefile to my fork since Arduino IDE v2 doesn't do SPIFFS building and uploading. Fun stuff and thanks again David.
Are you having any trouble with the unit actually switching the state of the thermostat. i have everything up and running but the only way i can get the thermostat to switch is the manual overide. It doesnt matter what i set the tempature to, it does not switch.
@@jonathonhaberkorn233 it was turning on/off on the bench this morning. I have it on the esp-wrover-kit board and the status LED output is set to pin 5 which is the LCD backlight enable so I saw the backlight going on/off matching what the web interface was showing.
@@G6EJD the temperature fluctuates if I interact with it. I even put an ice pac on it and got it down to 11c and still nothing. I decided to “re- upload the code and now it seems to work as it should. I don’t know what I did, but I think I managed to get up and running. Thank you for sharing your knowledge as well as talking the time to respond to questions on a video 2 years old.
@@jonathonhaberkorn233 can you test something? I just tried the Manual Over-ride and noticed if I turn it on, go to status page and see it on, then go back to setup I will see the Manual Override drop-down menu saying it is Off but it is still on. Do you see that too?
Thank you Arthur, you may find the asynchronous webserver features interesting, plus it’s fast and no need to keep polling to check for a connection request hence the name asynchronous.
Thank you Garry, yes I’m in good shape, increasingly doctors want to see me less and less, I’m down to 3-month appointments now, I was every 2-days, I still owe my life to the German donor and I got lucky with a 10/10 match, nowadays it’s the laboratory that saves life. Best wishes and have a happy and safe new year 2021
thanks this might help me get started, I am looking for something that can help control my aquaponic system 10x fish tanks containing 2x 60VDC 1kw heaters 10x grow beds containing 1x 240VAC 500w heater , needing to monitor outside temp / weather so heaters run a higher temp just incase of a long rainy week the temps do not drop too low while running of solar power without any sun around and have heaters off while prioritizing running air pumps
Well if you needed more relays you could fix the IP address, then add another setup and run two independent systems, extending the code for more than 4-relays would be a challenge and push the resource availability of the ESP32.
Hi David , first of all many thanks for the very nice code , great job. i have only one small issue for the moment , when i change the number of day events from 4 to 5 i have troubles with the timer screen (blanc).
This project is so well done, clean and simplified code. Congrats man! Would it be possible to have two separate esp8266 controllers, one with only the temperature sensor and the other with the relay, so that the relay and the sensor can be installed apart in different rooms?
hello i have a question, manual Override Temperatureis not superior to Scheldule? When setting manual heating,the thermostat switches off, if schedule is empty Manula working, thx
Hello, thank you spotting this problem, I have corrected all three versions to ensure the Manual mode is not overridden by the Schedule. Now when Manual is set ON, the schedule has no effect.
@@G6EJDthank you very much, it works 🙂 I would like to ask if it is possible to set the sending of data to the thingspeak, I can't do it, but I managed to translate the program into Czech
@@ludvikg yes there is a Thingspeak example in the IDE examples, there is a supporting library, it requires one line of code to send the variable to TS
Install the Thingspeak library from sketch, library, manage, search for Thingspeak, then take a look at the Thingspeak examples from the examples menu, you may have to wrap your variable in a string() function to convert a numeric to string for the library eg String(variable)
Sie können einfach ein I2C-OLED verwenden und die Bibliothek hinzufügen, z. B. ssd1109 und drucken Sie es dann auf dem Display im Loop-Bereich aus. Es werden nur ein paar Codezeilen benötigt.
The 4-pin boards are connected 3.3-5v on one pin, ground on another then I2C-SDA and SCL, others have separate pins for CS - Chip Select and SDO so they can use a 4-wire SPI bus (SDO, SDA, CS and SCL), some do have an on-regulator.
Hi David, I'm looking for something like this but to control both my air conditioner and heater. It looks like this only works for a heater, is that correct?
Great project ! Any idea why schedule produces a blank screen once in a while? Sometimes refreshing the page will bring it up and although it happens a lot, I am unable to reporduce the issue with any consistency. I can get the schedule to come up after an update and restart and the schedule always comes up when simulating is ON. It seems like it happens more often when I add more items to the schedule, I also see it happening more often after a day or so running. Also, after entering 3 different events for every day of the week AND getting a blank schedule screen after saving and returning to the schedule - The schedule DOES work, just can't see it. I did add ElegantOTA to the script. Ideas ?
Most likely your browser. Also check your memory usage as it’s taking a lot to create all the interfaces via html. Also try removing the OTA add-on and see if the problem persists.
So I did remove ElegantOTA and the problem happens less often but still occurs. I also just entered One On/Off time and temp for each day instead of 3 and that makes it happen less often also. I have checked the memory available and memory used with no issue. Most likely your browser - Well it happens with any browser I use and Mobile or Desktop.
Whilst the code will run on an ESP8266 there is insufficient memory to operate it, the clue is as soon as you add entries it starts to malfunction, you would find the dynamic use of RAM is much more then you might think it measure unless your measurements are done correctly, by contrast the ESP32 has more than sufficient memory.
Change this line : Temperature = sensor.readTemperature(); // Read the current temperature if (Temperature >= 50 || Temperature < -30) Temperature = LastTemperature; // Check and correct any errorneous readings To Temperature = sensor.readTemperature*9/5.0+32; Then change 50 to °F and -30 to °F there are 4 other default temperatures in the early part of the code convert them to °F so 21° becomes 72° etc, that’s it.
Good to hear, you don’t really need humidity I included because the sensor provided the reading. To remove the humidity graph you will need to carefully remove the google charts data.
Very cool and we'll explained as always. Could it be made to work on humidity and not temperature. As I would like to control a fan on humidity levels. Live the UI and history
Yes just replace the lines for temperature testing with humidity so everywhere that it tests for temperature just change those for humidity, if you have any problems let me know it should only be a few lines that need changing
You could do but the ESP saves the WiFi credentials in flash so never needs to be entered again or use the ESP WiFi manager (just one line of code and library inclusion) which will do it for you.
Just getting started with this, and it looks promising. Have two questions. 1) Going to attach this to the wall were old thermostat was after using 3d printer to build a case to hold it all, but how do i best power it withould running a lengthy usb cable across the wall. would it be possible to use a dc-dc converter attached to the furnace Common lead? 2) Would it be possible to change the ide app to drive an attached touch screen (3.5" ili9488 spi) instead of using my phones web browser? OOPS: thought I read that commom had 24 v dc, but I find that it is AVCfrom 24 to 28 volts. between red and common, I have 27.8 V ac So for 1) would it be possible to feed a rectified ac-dc convertor from the thermostat C and R leads to provide 5V into the usb port?
I don’t know or recognise the term furnace: not in the uk anyway, but I think it may be a 12v source, if so, there are many dc-dc converters that would work, they’d need to supply at least 400mA, connected to usually the Vin pin and Gnd. Adding a touch screen would be relatively simple. It would be best to develop the touch elements first by defining screen position say in box areas, and proving the concept, then making sure it was a modular design in functions then using the touch example adding it to the main loop then linking the buttons to a function in the code. It could be a lot of work, but all the building blocks are available.
@@G6EJD Sorry for any confusion. For furnace we have a natural gas powered hot air house heater and is also connected to our air conditioner. As I mentioned, the leads are using 27V AC, with Red carrying power to drive any smart thermostat.
How to add libraries to the project? I am programming the module from the Esp8266AP examples. The module is being programmed. I open your .ino batch, I get an error with the Wifi.h library Could you share the firmware with the libraries?
@@G6EJD I have uploaded esp8266 library. The problem is that when compiling, the arduino downloads from the Wifi library and folder, despite the fact that I have esp8266wifi installed. If I had a batch with libraries, I would upload it without a problem.
@@G6EJD I have a problem with downloading the software. I uploaded the libraries and the error is still there. "Compilation error:ESPmDNS.h.No such file or directory."
@@albertalbert4747 it’s the same process, load the source code, connect your board, select the usb port the board is using, then click on the compile and upload icon on the top left
@@G6EJD And so I do after typing ssidi password at comilation stops me on ESPmDNS. Wrong tile? I'm uploading to ESP8266 Lolin. After setting the plate on Lolin wemos D1 mini clon I just started and cleaned the eprom. But I can't upload the software anymore, the lack of libraries pops up and there's no way around it.
Hi David thank you for sharing your software it looks like a lot of hard work, but when I compile the sketch I get an error, This chip is ESP32 not ESP32-S3. Wrong --chip argument? I am using an ESP32 VEROOM32 so do I need to purchase another type, I see you are using Lolin D32, thanks for any help Bob IN THE UK.
@David - Thanks for all youre hard work! I have trouble runing this code on 8266 - Nodemcu. Have all the libs, no error, upoadet fine but webserver not working. Can't visit the page. Connecting fine to the WiFi, ping is fine, DHCP Server see it fine. On serial monitor and debug -code is showing fine up to wifi is connected but no log after that. Look like not running the code after that. Thanks in advance! p.s. Sorry for my bad English!
You need to downgrade the ESP8266 compiler to 2.7.4 (Tools, Board Manager, search for ESP8266 then choose 2.7.4) then all will work again, the 3 series compiler broke a lot of libraries.
Well it’s a thermostat so generally you only need one GPIO pin to switch in/off a relay, so I’d say that’s more than adequate. You don’t have to use a bme280 you could use a simple one line thermometer like the dht12
@@G6EJD clear, what about BME280? they look like need I2C connection type, and having just GPIO 2 maybe is a trouble? or just use another temperature sensor
I am wondering if we can make it run without connecting to internet using local APN? I see google.charts are being used so seems difficult. But if we plot graphs using html or micropython?
I have tried using html5 and svg but found it too complex to draw even simple graphs. Java is possible but even that is complex to code, google charts are hard enough! I have been searching for a solution but can’t find one. Micro python would be quite slow too.
Really good project and comes with well done presentation. Thanks. Is available the Shield board for a ESP32 PCB here? can you share it ? Merry Christmas and Happy Holidays!
Thank you very much for your work! Tech Note 080 - ESP32/ESP8266 Data Logging Webserver - works great Tech Note 148 - ESP Smart Thermostat/Timer (ESP32 or ESP8266) - does not connect to the web server with any esp 8266 core. ping is good how to switch to AP mode?
Dave, I seem to just get "Error compiling for board" , no matter what board I select , with either ESP8266, Or ESP32 boards, I have all libraries Updated and Boards updated, running Arduino Ver 1.8.13.... I am sure I'm doing something wrong..... Let me know if you have an Idea... Cheers...
Hi Ross, Check out the readme, adding espasychwebserver outside of the manage sketch route does not add in the extra library required, let me know the error message you get.
Working Now Dave !, it was a simple matter, of reading the VERBOSE error Logs, and showed ESPAsyncWebServer.h, was calling ESPAsyncTCP.h, After checking I saw I did not have that Library, once downloaded and added, all compiled Fine...... Thanks again, now time to play with it !... Cheers
It’s usb powered, the esp32 and relays use too much power to provide a web server interface and to operate relays. The relays could be changed for zero power bi-stable or latching types and the esp32 set to sleep with frequent wake up events but I’d expect battery life to be limited. Most smart thermostats are powered with e.g. 5v the Evohome is an example of such, as is Nest.
@@G6EJD By the way you make the best/coolest projects. I’m noticing that it is hard to power the ESP32 full time with battery. Do yo know of a device where I could have a ESP32 normally powered by a 12v battery which is charged by solar and when battery hits low voltage protection it switches to a wall wort usb supply. I would like to build a weather station from a pi zero w have it powered via battery(solar) and when the battery reaches low voltage have a relay switch it to a wall wort Thanks
@@Dasol0246 Thank you. I don’t know of any devices that can meet your battery requirements, but the ESP32 could monitor the 12v battery and you could buy a solid state relay to switch on/off the wall wart again controlled by the ESP32. The lolin d32 has an on-board battery charger and you can buy a HAT for the dpi that provides battery power with a solar input provision. Adafruit sell some variants for the RPi and AliExpress sell them too.
No, but adding that support would be really easy, it’s offered as a foundation for such add-on’s. Most boilers need an add-on to enable communications though.
I've seen you use the "unsigned long mills()" function to generate events. I'm afraid this function will return to zero after about 50 days. The variables you compare with are int. It's right? Thanks again.
Unsigned long is a 64-bit variable that enables a count of 584542046.090626 years! Before it overflows (2^64), this is a 32-bit cpu. There is also provision for LL when required.
What is a great job! Really appretiate it! I am trying to make it work with DS18B20 in order to be able to use it for water heater control, however, it seems my level of knowlage is not high enough to succeed, it there anyone who can help?
You need to study the example code for the DS18B20, then add the library inclusion in this code, remove the references to the SHT30 sensor, then add any needed for the DS18B20 and then modify the setup section to enable the DS18B20 like in the example then remove any references to the old sensor in the read sensor function in this code then add in the ds18b20 temperature read line from the example. You need to assign a 0 value to the variable of humidity then it will all work, let me know if you have problems.
@G6EJD - David I am living in Bulgaria. That is exactly what I am trying to do. I have added needed libraries, changed the "ReadSensor" section and include everything in the code to make DS18B20 work. It is all working fine in the serial monitor, up untill I try to load the web page - then it crashes with folowing (shortened message): "User exception (panic/abort/assert) Panic core_esp8266_main.cpp:120 __yield >>>stack>>>
@@VasilKurdov ok, thanks. That’s strange to get a runtime error, it sounds like you may have an undefined variable, what does your sensor function look like and have you started the sensor in the setup section?
@@G6EJD Thanks for your help! Yes I have started the sensor, otherwise I wouldnfd be getting readings in the Serial monitor... This id the ReadSensor section: void ReadSensor() { if (simulating) { Temperature = 20.2 + random(-15, 15) / 10.0; // Generate a random temperature value between 18.7° and 21.7° Humidity = random(45, 55); // Generate a random humidity value between 45% and 55% } else { sensors.requestTemperatures(); Temperature = sensors.getTempCByIndex(0); // Read the current temperature if (Temperature >= 95 || Temperature < -30) Temperature = LastTemperature; // Check and correct any errorneous readings LastTemperature = Temperature; Humidity = 0; Serial.println("Temperature = " + String(Temperature, 1) + ", Humidity = " + String(Humidity, 0)); } }
I am trying to get your sketch working on a Nodemcu ESP8266. All compiling is ok but when i try te get at the IP with a Browser i get an ERR_CONNECTION_REFUSED
Make sure you have the correct IP address as reported on the serial port and ensure your browser is not refusing the connection because it’s not secure..
@@G6EJD Hey and thank you for your answer. Yes, the IP is correct and this IP is refusing connection. "*.*.*.102 refused to connect." Browser is OK,i often connect to unsecure websites :) Tried different ports also.
Hello there. Could someone tell me what to change for using a BME680 ? Trying for 3 hours now, sensor is working with the test sketch but not with the Thermostat Sketch. I am using this : ae01.alicdn.com/kf/H29aa50470a044f2995630b4ea82b474eK/BME680-Umwelt-Sensor-VOC-Temperatur-Feuchtigkeit-Luftdruck-Modul.jpg_Q90.jpg_.webp
You only need to change the device driver to bme680 then copying in the device definition remove the 280 variant then that’s it. It should be very simple.
Just posting to say a big thanks - you saved me a LOT of work and have done a fantastic job. I've taken your project as starting point and added a remote temperature sensor plus some other bits and bobs to suit my needs.
I was about to embark on a project needing an on/off timer for a relay and here I find everything in a single video. Thank you so much Sir ;)
Wow thanks David! What a great example of how to setup a web server with configurations, history, etc! Love it!
Bonjour, Je viens de réaliser votre projet sur un esp32 et tous fonctionnement parfaitement bien. Merci beaucoup pour la qualité de la présentation.
Your projects on ESP8266 are just amazing...thanks for sharing such wonderful knowledge..👍..Best wishes from India.
A really good demonstration. I am looking to something similar for a garden watering system. Great. Thanks.
Ideal for that.
Great david sir....waiting for stm32 tutorials with deep sleep ...
Look forward to making this, ! Merry Christmas, wishing you well in the new Year !
Merry Christmas Dave & all the nice people in this channel! (oh! Sorry: nice video as well ;-)
A huge thanks from far far away .... Italy ! U R #1 David !
Thanks Dave ,merry Christmas and happy holidays to you all . Up to a new year. Be careful and hopefully continue your health.
Thank you and happy new year
Very good project i apreciate your work .
Please let me know how i can send LED or RELAY status to another ESP like slave ?
Thank you.
I have produced some code to do what you want, see the video with UDP in the title.
Excellent work!! Two additional features that I have been thinking about include being able to fall back to the existing system in case something goes wrong and being able to change the temperature controlled to say 2 or 3 different locations in my house. I'd be interested in your comments?
Best to wire it in parallel with the existing system and then switch off the existing system using that as a backup. You could use remote sensors to send over temperature readings of other zones and then expend the test for temperature to three values. The structure is such that should be easy, needs sone good logical names for values to help with the logic.
David, wonderful work! It must have put a lot of work and testing ...
Yes Josef, lots of testing especially the html
Thanks again David, this is another great project! I forked it and have been working through getting it operating with my esp32 and sht21 sensor. Ended up merging bme280/sht21 sensor code since their are so similar. I've noticed a few NaN on the display so I started looking at the ReadSensor rates and noticed there is a timed call to ReadSensors() in loop() but also on the HomePage() method which was also getting refreshed at 5sec intervals. I've also added a Makefile to my fork since Arduino IDE v2 doesn't do SPIFFS building and uploading. Fun stuff and thanks again David.
Are you having any trouble with the unit actually switching the state of the thermostat. i have everything up and running but the only way i can get the thermostat to switch is the manual overide. It doesnt matter what i set the tempature to, it does not switch.
If you touch your sensor what happens and check the serial port monitor too.
@@jonathonhaberkorn233 it was turning on/off on the bench this morning. I have it on the esp-wrover-kit board and the status LED output is set to pin 5 which is the LCD backlight enable so I saw the backlight going on/off matching what the web interface was showing.
@@G6EJD the temperature fluctuates if I interact with it. I even put an ice pac on it and got it down to 11c and still nothing. I decided to “re- upload the code and now it seems to work as it should. I don’t know what I did, but I think I managed to get up and running. Thank you for sharing your knowledge as well as talking the time to respond to questions on a video 2 years old.
@@jonathonhaberkorn233 can you test something? I just tried the Manual Over-ride and noticed if I turn it on, go to status page and see it on, then go back to setup I will see the Manual Override drop-down menu saying it is Off but it is still on. Do you see that too?
Excellent Christmas present. Can't wait to try this out. I learn so much from looking at you code.
Hope you have a good Christmas
Best wishes
Arthur
Thank you Arthur, you may find the asynchronous webserver features interesting, plus it’s fast and no need to keep polling to check for a connection request hence the name asynchronous.
@@G6EJD Thanks. I'd like to buy you a coffee. Do you have a mechanism for that?
Thank you Arthur via PayPal and here: g6ejd.dynu.com at the bottom of the page
An other great project, thanks again Dave. I hope you're in good shape these days. Seasons greetings and best wishes for he new year! Garry
Thank you Garry, yes I’m in good shape, increasingly doctors want to see me less and less, I’m down to 3-month appointments now, I was every 2-days, I still owe my life to the German donor and I got lucky with a 10/10 match, nowadays it’s the laboratory that saves life. Best wishes and have a happy and safe new year 2021
thanks this might help me get started, I am looking for something that can help control my aquaponic system 10x fish tanks containing 2x 60VDC 1kw heaters 10x grow beds containing 1x 240VAC 500w heater , needing to monitor outside temp / weather so heaters run a higher temp just incase of a long rainy week the temps do not drop too low while running of solar power without any sun around and have heaters off while prioritizing running air pumps
Well if you needed more relays you could fix the IP address, then add another setup and run two independent systems, extending the code for more than 4-relays would be a challenge and push the resource availability of the ESP32.
Hi David , first of all many thanks for the very nice code , great job.
i have only one small issue for the moment , when i change the number of day events from 4 to 5 i have troubles with the timer screen (blanc).
That's because the ESP will be out of memory, I have a comment in the code to that effect, 4 is as good as it gets.
@@G6EJDthanks ! I'm now trying a esp32-wroom , first impressions ....much better then esp8266.....
This project is so well done, clean and simplified code. Congrats man!
Would it be possible to have two separate esp8266 controllers, one with only the temperature sensor and the other with the relay, so that the relay and the sensor can be installed apart in different rooms?
Yes that would work, next week I shall try to publish a 4-relay timer version no thermostat.
This code is great. Hope your having a good day!
hello i have a question, manual Override Temperatureis not superior to Scheldule? When setting manual heating,the thermostat switches off, if schedule is empty Manula working, thx
Hello, thank you spotting this problem, I have corrected all three versions to ensure the Manual mode is not overridden by the Schedule. Now when Manual is set ON, the schedule has no effect.
@@G6EJDthank you very much, it works 🙂 I would like to ask if it is possible to set the sending of data to the thingspeak, I can't do it, but I managed to translate the program into Czech
@@ludvikg yes there is a Thingspeak example in the IDE examples, there is a supporting library, it requires one line of code to send the variable to TS
@@G6EJD thanks for the reply, i tried it but i am making a mistake somewhere and i can't compile the project well...I will try it again :)
Install the Thingspeak library from sketch, library, manage, search for Thingspeak, then take a look at the Thingspeak examples from the examples menu, you may have to wrap your variable in a string() function to convert a numeric to string for the library eg String(variable)
Wonderfully done! Merry Christmas and Happy Holidays!
Hallo, Klasse Projekt. Wie kann ich noch ein OLED einbinden, um die aktuelle und die Zieltemperatur an zu zeigen?
Sie können einfach ein I2C-OLED verwenden und die Bibliothek hinzufügen, z. B. ssd1109 und drucken Sie es dann auf dem Display im Loop-Bereich aus. Es werden nur ein paar Codezeilen benötigt.
Nice video!!! What is the difference between the two versions of the BME280 sensor (4 pins and 6 pins)? They both work in 3.3V?
The 4-pin boards are connected 3.3-5v on one pin, ground on another then I2C-SDA and SCL, others have separate pins for CS - Chip Select and SDO so they can use a 4-wire SPI bus (SDO, SDA, CS and SCL), some do have an on-regulator.
@@G6EJD Thank you
Unfortunately I can't find all the parts. The sensors are not a problem. But what kind of relay is that?
Amazon has loads of what they call Arduino Relay boards, you can get 1, 2 or 4 or 8 and more relays, none are more than a few £/$
Hi David, I'm looking for something like this but to control both my air conditioner and heater. It looks like this only works for a heater, is that correct?
It’s a single channel system, but if you reverse the relay connections then it can control air conditioning.
@@G6EJD ok thanks much
Great video. How easy could this be integrated into Home Assistant?
Great project ! Any idea why schedule produces a blank screen once in a while? Sometimes refreshing the page will bring it up and although it happens a lot, I am unable to reporduce the issue with any consistency. I can get the schedule to come up after an update and restart and the schedule always comes up when simulating is ON. It seems like it happens more often when I add more items to the schedule, I also see it happening more often after a day or so running. Also, after entering 3 different events for every day of the week AND getting a blank schedule screen after saving and returning to the schedule - The schedule DOES work, just can't see it. I did add ElegantOTA to the script. Ideas ?
Most likely your browser. Also check your memory usage as it’s taking a lot to create all the interfaces via html. Also try removing the OTA add-on and see if the problem persists.
So I did remove ElegantOTA and the problem happens less often but still occurs. I also just entered One On/Off time and temp for each day instead of 3 and that makes it happen less often also. I have checked the memory available and memory used with no issue. Most likely your browser - Well it happens with any browser I use and Mobile or Desktop.
@@myname4102 and an ESP32?
Just on a ESP8266 and ESP01 - same results - Have not worked with the ESP32 yet
Whilst the code will run on an ESP8266 there is insufficient memory to operate it, the clue is as soon as you add entries it starts to malfunction, you would find the dynamic use of RAM is much more then you might think it measure unless your measurements are done correctly, by contrast the ESP32 has more than sufficient memory.
Could you have the ESP32 set to run as the AP? I want to run a warming lamp at my boat and automatically turn on when temps get close to freezing.
Yes just change the WiFi mode to AP and if necessary set an ssid and password, then use say a phone to connect to it and provide status and control
@@G6EJD Thank you kindly sir!
Super! Thank you. Does the settings provide for Fahrenheit or does it require a code mod? If code mod appreciate any suggestions.
Change this line :
Temperature = sensor.readTemperature(); // Read the current temperature
if (Temperature >= 50 || Temperature < -30) Temperature = LastTemperature; // Check and correct any errorneous readings
To Temperature = sensor.readTemperature*9/5.0+32;
Then change 50 to °F and -30 to °F there are 4 other default temperatures in the early part of the code convert them to °F so 21° becomes 72° etc, that’s it.
Thank you so much! You saved me a lot of time, I just wanted to write something like that. I will fork it soon to add a simple NTC temperature sensor.
Good to hear, you don’t really need humidity I included because the sensor provided the reading. To remove the humidity graph you will need to carefully remove the google charts data.
Very cool and we'll explained as always. Could it be made to work on humidity and not temperature. As I would like to control a fan on humidity levels. Live the UI and history
Yes just replace the lines for temperature testing with humidity so everywhere that it tests for temperature just change those for humidity, if you have any problems let me know it should only be a few lines that need changing
Would you add a window to enter the SSID and Password on initial startup? Thanks.
You could do but the ESP saves the WiFi credentials in flash so never needs to be entered again or use the ESP WiFi manager (just one line of code and library inclusion) which will do it for you.
Just getting started with this, and it looks promising. Have two questions.
1) Going to attach this to the wall were old thermostat was after using 3d printer to build a case to hold it all, but how do i best power it withould running a lengthy usb cable across the wall. would it be possible to use a dc-dc converter attached to the furnace Common lead?
2) Would it be possible to change the ide app to drive an attached touch screen (3.5" ili9488 spi) instead of using my phones web browser?
OOPS: thought I read that commom had 24 v dc, but I find that it is AVCfrom 24 to 28 volts. between red and common, I have 27.8 V ac
So for 1) would it be possible to feed a rectified ac-dc convertor from the thermostat C and R leads to provide 5V into the usb port?
I don’t know or recognise the term furnace: not in the uk anyway, but I think it may be a 12v source, if so, there are many dc-dc converters that would work, they’d need to supply at least 400mA, connected to usually the Vin pin and Gnd. Adding a touch screen would be relatively simple. It would be best to develop the touch elements first by defining screen position say in box areas, and proving the concept, then making sure it was a modular design in functions then using the touch example adding it to the main loop then linking the buttons to a function in the code. It could be a lot of work, but all the building blocks are available.
@@G6EJD Sorry for any confusion. For furnace we have a natural gas powered hot air house heater and is also connected to our air conditioner. As I mentioned, the leads are using 27V AC, with Red carrying power to drive any smart thermostat.
@@martyngriffin5943 ok, but converting (easily) 27AC to 5v DC is not easy unless there are ready made units around.
@@G6EJD I ordered a 12-28V ac to 12V dc unit from amazon. Then I just need to drop it to 5V. Working on that.
Is there a minimum runtime and minimum idle time for safety?
No, but you could add that, I provided the code as a foundation to build on.
Thank you for sharing. Merry Christmas 🎅
Merry Christmas
How to add libraries to the project? I am programming the module from the Esp8266AP examples. The module is being programmed. I open your .ino batch, I get an error with the Wifi.h library Could you share the firmware with the libraries?
That’s because you have to include the ESP8266 variants, eg ESP8266WiFi.h
Are you using the ESP8266 version on the GitHub?
@@G6EJD I have uploaded esp8266 library. The problem is that when compiling, the arduino downloads from the Wifi library and folder, despite the fact that I have esp8266wifi installed. If I had a batch with libraries, I would upload it without a problem.
How did you upload the firmware? The extension is on .ino but I have a problem with arduino. You don't have the firmware in .bin?
You have to load the source code into the Arduino IDE, then choose the correct board, then compile the code, then upload to the board.
@@G6EJD I have a problem with downloading the software. I uploaded the libraries and the error is still there.
"Compilation error:ESPmDNS.h.No such file or directory."
@@G6EJD I have arduino 2.0.3
@@albertalbert4747 it’s the same process, load the source code, connect your board, select the usb port the board is using, then click on the compile and upload icon on the top left
@@G6EJD And so I do after typing ssidi password at comilation stops me on ESPmDNS. Wrong tile? I'm uploading to ESP8266 Lolin. After setting the plate on Lolin wemos D1 mini clon I just started and cleaned the eprom. But I can't upload the software anymore, the lack of libraries pops up and there's no way around it.
Hi David thank you for sharing your software it looks like a lot of hard work, but when I compile the sketch I get an error, This chip is ESP32 not ESP32-S3. Wrong --chip argument?
I am using an ESP32 VEROOM32 so do I need to purchase another type, I see you are using Lolin D32, thanks for any help Bob IN THE UK.
What is the error, make sure you select the Wemos D32 board type
Thank you for your prompt reply, I changed to the Wemos Lolin D32 and the sketch compiled Many thanks, Bob @@G6EJD
I hope your health is going well. Great project as usual. I have tried almost all of your projects and this should be next one :).
Thanks a lot.
It is very useful and interesting project. it would be great to have the code for DHT22 sensor as well. Thank you
Indeed, but the DHT22 is highly inaccurate.
@@G6EJDStill it works for me! Thanks for your quick response.
Wspaniała prezentacja.
@David - Thanks for all youre hard work! I have trouble runing this code on 8266 - Nodemcu. Have all the libs, no error, upoadet fine but webserver not working. Can't visit the page. Connecting fine to the WiFi, ping is fine, DHCP Server see it fine. On serial monitor and debug -code is showing fine up to wifi is connected but no log after that. Look like not running the code after that.
Thanks in advance!
p.s. Sorry for my bad English!
You need to downgrade the ESP8266 compiler to 2.7.4 (Tools, Board Manager, search for ESP8266 then choose 2.7.4) then all will work again, the 3 series compiler broke a lot of libraries.
@@G6EJD God bless you ! 7 days trying to fix it ! You are the MAN !
really interesting, well done, one question is it possible to realise similar project by esp8266-01? thes simplest model ?
Yes the code will run on an esp8266
@@G6EJD also if i have just a GPIO 0 and GPIO 2?
Well it’s a thermostat so generally you only need one GPIO pin to switch in/off a relay, so I’d say that’s more than adequate. You don’t have to use a bme280 you could use a simple one line thermometer like the dht12
@@G6EJD clear, what about BME280? they look like need I2C connection type, and having just GPIO 2 maybe is a trouble? or just use another temperature sensor
ooops you already answered to me apologies. thanks a lot and again compliments
Great project David ! Many thanks from me !
I am wondering if we can make it run without connecting to internet using local APN? I see google.charts are being used so seems difficult. But if we plot graphs using html or micropython?
I have tried using html5 and svg but found it too complex to draw even simple graphs. Java is possible but even that is complex to code, google charts are hard enough! I have been searching for a solution but can’t find one. Micro python would be quite slow too.
Really good project and comes with well done presentation. Thanks.
Is available the Shield board for a ESP32 PCB here? can you share it ?
Merry Christmas and Happy Holidays!
I will post the link to the carrier board on jlcpcb they would cost about $2 each plus delivery.
oshwlab.com/g6ejd/carrier-v2
Thanks to care about. Regards, Anibal
If you order with jlcpcb 5 will cost $2 plus postage
Thank you very much for your work!
Tech Note 080 - ESP32/ESP8266 Data Logging Webserver - works great
Tech Note 148 - ESP Smart Thermostat/Timer (ESP32 or ESP8266) - does not connect to the web server with any esp 8266 core. ping is good
how to switch to AP mode?
It’s a compiler issue, go back to an earlier version and it will work, maybe 10 or more versions.
@@G6EJD Yes, I will try, AP mode (without Internet) graphics and gauge are available?
what is the final version on github ?
They are all version-1 the only difference is the sensor type.
Very nice ! Thanks for sharing another great project .
Dave, I seem to just get "Error compiling for board" , no matter what board I select , with either ESP8266, Or ESP32 boards, I have all libraries Updated and Boards updated, running Arduino Ver 1.8.13.... I am sure I'm doing something wrong..... Let me know if you have an Idea... Cheers...
Hi Ross, Check out the readme, adding espasychwebserver outside of the manage sketch route does not add in the extra library required, let me know the error message you get.
Working Now Dave !, it was a simple matter, of reading the VERBOSE error Logs, and showed ESPAsyncWebServer.h, was calling ESPAsyncTCP.h, After checking I saw I did not have that Library, once downloaded and added, all compiled Fine...... Thanks again, now time to play with it !... Cheers
Good to hear, have fun.
Cool project, How do you power this and how long does it last
It’s usb powered, the esp32 and relays use too much power to provide a web server interface and to operate relays. The relays could be changed for zero power bi-stable or latching types and the esp32 set to sleep with frequent wake up events but I’d expect battery life to be limited. Most smart thermostats are powered with e.g. 5v the Evohome is an example of such, as is Nest.
@@G6EJD By the way you make the best/coolest projects. I’m noticing that it is hard to power the ESP32 full time with battery. Do yo know of a device where I could have a ESP32 normally powered by a 12v battery which is charged by solar and when battery hits low voltage protection it switches to a wall wort usb supply. I would like to build a weather station from a pi zero w have it powered via battery(solar) and when the battery reaches low voltage have a relay switch it to a wall wort Thanks
@@Dasol0246 Thank you. I don’t know of any devices that can meet your battery requirements, but the ESP32 could monitor the 12v battery and you could buy a solid state relay to switch on/off the wall wart again controlled by the ESP32. The lolin d32 has an on-board battery charger and you can buy a HAT for the dpi that provides battery power with a solar input provision. Adafruit sell some variants for the RPi and AliExpress sell them too.
I don't see it in the documentation, but is it opentherm compatible?
No, but adding that support would be really easy, it’s offered as a foundation for such add-on’s. Most boilers need an add-on to enable communications though.
could you please help me. i've got a bmp280 connected and all i get is nan. ive tried 0x76 and it doesnt work. either display nan or 0.0 celsius.
You probably have the incorrect pins for the I2C bus, what board type are you using?
@@G6EJD on the gitgub its the middle sensor in the picture
It's the Bosch BMP280
@@broccoliman2293 I meant the ESP board as there are quite a few variations on the pins used for SDA and SCL
@@G6EJD for some reason my comments keep disappearing but my board is the esp32-devkitc-v4
Plz add RTC ..for working without wifi
Hi Sir , you can add a wifi connect timeout in the code , then the thermostats keeps working when there is no wifi for a while.
Thank you for sharing.
Merry Christmas. I tried this with esp8266 and am geting this :Error compiling for board NodeMCU 1.0 (ESP-12E Module). am using arduino 1.8.13
Sorry you need to include the library espasynwrbserver sketch manage add enter espasync should find it
@@G6EJD thank for your quick response I do install the library from github except I installed the wrong one
@@G6EJD thanks for your quick response. I do install the library from GitHub, except the I installed was wrong.
Check the readme if still not working
round PCB corners!
For?
Grazie, grazie, grazie!
I've seen you use the "unsigned long mills()" function to generate events. I'm afraid this function will return to zero after about 50 days. The variables you compare with are int. It's right? Thanks again.
Unsigned long is a 64-bit variable that enables a count of 584542046.090626 years! Before it overflows (2^64), this is a 32-bit cpu. There is also provision for LL when required.
Very nice.
Wow wow and wow!!!!
Thank you Marc
What is a great job! Really appretiate it!
I am trying to make it work with DS18B20 in order to be able to use it for water heater control, however, it seems my level of knowlage is not high enough to succeed, it there anyone who can help?
Which country do you live in?
You need to study the example code for the DS18B20, then add the library inclusion in this code, remove the references to the SHT30 sensor, then add any needed for the DS18B20 and then modify the setup section to enable the DS18B20 like in the example then remove any references to the old sensor in the read sensor function in this code then add in the ds18b20 temperature read line from the example. You need to assign a 0 value to the variable of humidity then it will all work, let me know if you have problems.
@G6EJD - David I am living in Bulgaria. That is exactly what I am trying to do. I have added needed libraries, changed the "ReadSensor" section and include everything in the code to make DS18B20 work. It is all working fine in the serial monitor, up untill I try to load the web page - then it crashes with folowing (shortened message):
"User exception (panic/abort/assert)
Panic core_esp8266_main.cpp:120 __yield
>>>stack>>>
@@VasilKurdov ok, thanks. That’s strange to get a runtime error, it sounds like you may have an undefined variable, what does your sensor function look like and have you started the sensor in the setup section?
@@G6EJD Thanks for your help! Yes I have started the sensor, otherwise I wouldnfd be getting readings in the Serial monitor...
This id the ReadSensor section:
void ReadSensor() {
if (simulating) {
Temperature = 20.2 + random(-15, 15) / 10.0; // Generate a random temperature value between 18.7° and 21.7°
Humidity = random(45, 55); // Generate a random humidity value between 45% and 55%
}
else
{
sensors.requestTemperatures();
Temperature = sensors.getTempCByIndex(0); // Read the current temperature
if (Temperature >= 95 || Temperature < -30) Temperature = LastTemperature; // Check and correct any errorneous readings
LastTemperature = Temperature;
Humidity = 0;
Serial.println("Temperature = " + String(Temperature, 1) + ", Humidity = " + String(Humidity, 0));
}
}
I am trying to get your sketch working on a Nodemcu ESP8266. All compiling is ok but when i try te get at the IP with a Browser i get an ERR_CONNECTION_REFUSED
Make sure you have the correct IP address as reported on the serial port and ensure your browser is not refusing the connection because it’s not secure..
@@G6EJD Hey and thank you for your answer. Yes, the IP is correct and this IP is refusing connection. "*.*.*.102 refused to connect." Browser is OK,i often connect to unsecure websites :) Tried different ports also.
@@familiem.2102 are you using the logical address name set in the code eg localhostname.local/ or example 192.168.0.33/
@@G6EJD i tried both at different ports (192.168.*.102 and thermostat.local)
If you can access the windows command prompt try ping 192.168.0.102 to see if it responds
Hello there.
Could someone tell me what to change for using a BME680 ? Trying for 3 hours now, sensor is working with the test sketch but not with the Thermostat Sketch. I am using this : ae01.alicdn.com/kf/H29aa50470a044f2995630b4ea82b474eK/BME680-Umwelt-Sensor-VOC-Temperatur-Feuchtigkeit-Luftdruck-Modul.jpg_Q90.jpg_.webp
You only need to change the device driver to bme680 then copying in the device definition remove the 280 variant then that’s it. It should be very simple.