ESP8266 HVAC control

that’s so unfair!

:slight_smile:

1 Like

Great Job
I am new here and kind of lost on setting up the app on the phone
Can you direct me to a tutorial that could explain to me how you did your up (set up the widgets)
I can’t figure out how to tie the slide bar to the gauge.
How do I have a widget changing values of another widget like setting temperature ?
Thanks

@marcelode1 Sure, here’s how I set up the Blynk dashboard…

Thermostat tab
Desired Temperature gauge: Pin V1, range 50 - 80 (I’m in the US, so using Farenheit), Push update frequency
Actual Temperature gauge: Pin V0, range 50 - 80, 2 second update frequency
Set Temperature slider: Pin V3, range 50 - 80, send-on-release set to OFF

Settings tab
Unnamed labeled value display: Pin V10, default range of 0-1023, default label of /pin/ , update frequency 500ms
Settings button: Pin V4, PUSH mode, blank on and off labels
Modify button: Pin V5, PUSH mode, blank on and off labels
On LED: pin V7
Home LED pin v29

For aesthetic reasons, many of the widget labels have been either blanked out, by entering blank spaces in the label name field, or center justified, by adding leading blank spaces before typing the name.

Linking the temperature slider to the desired temperature gauge is not done in the app. It’s done in the code. It’s this section:

//Match temp gauge to slider in Blynk app 
BLYNK_WRITE(V3){
  TempDes = param.asInt();
  Blynk.virtualWrite(V1,TempDes);
}

The BLYNK_WRITE function receives the new desired temperature value from the slider (on pin V3). We transfer that value to the variable TempDes, so that we can continue to use it in our code. Then, we immediately send that value back to the Desired Temperature gauge (on pin V1), with the Blynk.virtualWrite command.

@chrome1000
Thank so much for you prompt response.
I will try it tomorrow.
Regards

Hello
Can I use Nodemcu board with Esp8266?

sorry where should i write ssid and password ?
thank you.

@johnross

Your SSID and password are not stored in the code. When you power up the ESP8266, it will create an access point called “ThermoX”. If you want, you can customize the name of the access point by changing the setup command: wifi.autoConnect(“ThermoX”); Otherwise, just connect your smart phone, tablet, or computer’s wifi to ThermoX. A captive portal should automatically pop up, and ask you for the local wifi and SSID. Input them, and you’re good to go. The ESP8266 will remember them, so unless you change the credentials on your router, you should only have to do this one time.

If you do change routers or router credentials in the future, the automatic login will fail, and you’ll have to repeat the setup. You can also manually erase stored credentials by navigating to “CLEAR WIFI SETTINGS” in the settings menu of the Blynk dashboard, and pressing the Modify button.

I haven’t tested this with NodeMCU, but I assume it would work the same.

heya!

I’m about to re-write my entire HVAC code, which is ifs inside ifs inside ifs inside ifs (not a million, but it feels like it!)…

and I’m a bit daunted by converting to switch statements :worried:

did you rewrite any of yours yet?

You know I never did, but I looked at it. I was looking through Arduino’s guide and it didn’t work the way I wanted/hoped it would. Long story short I rewrote a lot of things over time and ended up happy with the results. I’m sure if I have some memory/storage constraints I would get on it!

hi guys,

Based on this post i want to build a HVAC to control a heating unit on gas.
First of all i want to ask here what i need to change in order to have the temperature in Celsius.
Another thing, is just a suggestion, because i made this project with ESP8266 -12 i have a lot of free pins, so maybe someone can implement a check for open window, maybe with a hall sensor. If window is opened then turn off heating/cooling.

Thanks
edit: i just changed to Celsius by editing line from: float ReadF = dht.readTemperature(true); to float ReadF = dht.readTemperature();

I enjoyed the challenge of doing a lot within the austere constraints of the ESP-01, but with a bunch of additional pins, there are all kinds of possibilities. I like the window open sensor. You might also want to:

  • add a motion sensor or two, so that HOME / AWAY sensing is not reliant solely on your phone.
  • use the DHT’s humidity data to turn on a humidifier, when appropriate
  • add manual temperature and mode controls directly on the unit
  • add a “pulse” mode, as suggested by @gusgonnet
  • split the heat/cool and fan outputs, to implement an energy saving fan only mode
  • add mode indicators, e.g. blue and red LEDs to indicate heating or cooling modes
1 Like

I use the pulse feature a lot, especially when I want to heat a little bit the house (when we wake up in the morning, is convenient for us to pulse the heat for 10 minutes).
This is the thermostat I have running at home, although with a Particle Photon, and not an ESP, just in case you want to take a look at some code.

Gustavo.

I am trying to recreate your 1st code but I cant figure out what library simpletimer is (I’m not very good at code hance trying to copy you)

Crazy but true: the simpletimer library is the simpleTimer library…

You can find this by Google search.

http://playground.arduino.cc/Code/SimpleTimer

(Unless i have misunderstood your question?)

It works, I have tested it.

wow I was searching thru the include libraries thinking it was there

I’ve made some additional changes to my HVAC code, and will be posting it soon. Changes include voice control via the Amazon Echo (Alexa) and IFTTT, and color changing widgets that turn red when heating, blue when cooling, and white when the system is at rest.

Thank you very much for this great project.
I use it in Celsius, and I prefer one screen.
Here I put it to see what you think.

I’ve also added the WEB OTA update here:
http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html

2 Likes

Bravo! The addition of OTA updates is a nice touch. I attempted to do that a few months ago, only to find that it’s not possible with the ESP-01.

Personally, I prefer minimal interfaces, but if the single tab works for you, that’s what counts. BTW, fitting all those widgets together with no gaps is pretty impressive. You must be a Tetris champ.

1 Like