View Single Post
Old 01-19-21, 01:15 AM   #11
Acuario
Apprentice EcoRenovator
 
Join Date: May 2011
Location: Tortosa, Spain
Posts: 218
Thanks: 2
Thanked 77 Times in 44 Posts
Default

Sounds interesting...
The ESP32 is a good option if starting from nothing as you say, more GPIO and ADC possibilities. There is also onboard bluetooth and it is also possible to connect an ethernet interface. I think the memory is the same though as an ESP12 (which is what I use), 4Mb, although this should be more than enough. It didn't exist when I started my controller, that's why I used the ESP8266.

I added my own design expansion board (controlled with I2C) with a 4 channel ADC and 8 channel I/O to overcome the limitations of the ESP8266 - as I designed my own pcb I also incorporated all the driver circuitry, connectors and relays onto the board. You could certainly build a controller without a custom pcb, just connecting to expansion modules directly with wires.

As stated above, I tried with DS18B20 sensors but in the end went back to 10K NTC sensors.

I control the pump, fan and reversing valve with mechanical relays and the compressor with a SSR, the SSR should work with a 3.3V control but as I have my I/O I'm using a 5V input.

Originally I had a physical interface (buttons and OLED display) for programming but I abandoned that and went 100% web based as it's much more flexible and easier to program.

As an IDE I (still) use the Visual Micro extension to Visual Studio - does pretty much everything I need.

I think most of the libraries I'm using support ESP32 so it shouldn't be too difficult to move to ESP32.

I've attached my code - it's somewhat documented so hopefully understandable. There are a few bits of legacy code and some bits I use when testing out possible new features but that shouldn't cause any problems.

It looks like cloudMQTT no longer have free MQTT accounts so you'll need to look elsewhere and update the MQTT details.

openweather shouldn't be a problem.

Maybe it's worth buying a WemosD1 and loading the code onto that, from there you can move to the ESP32. It should all run quite happily on the WeMos, even without sensors or relays connected. You can check out the web interface etc...


You need to add a file Passwords.h with the following:
Quote:
#pragma once

//Arduino OTA password
constexpr auto OTA_PASSWORD = "<your ota password>";

//MQTT (cloudMQTT.com)
constexpr auto MQTT_USER = "<your username>";
constexpr auto MQTT_PASS = "<your password>";
constexpr auto MQTT_HOST = "m20.cloudmqtt.com";
constexpr auto MQTT_PORT = 19167;

//Wifi networks - add more in WiFiWPS.cpp for more networks
constexpr auto SSID_1 = "<your ssid>";
constexpr auto PASS_1 = "<your pass>";
constexpr auto SSID_2 = "<your ssid>";
constexpr auto PASS_2 = "<your pass>";

//Weather (openweathermap.org)
constexpr auto CURRENT_WEATHER = "/data/2.5/weather?id=3107677&units=metric&APPID=<your id>";
constexpr auto FORECAST_3HR = "/data/2.5/forecast?id=3107677&cnt=3&units=metric&APPID=<your id>";
And a file board.txt
Quote:
# HPControllerESP build property overrides
#
network.password=<your ota password>
network.auth_upload=yes
network.port=8266

# Force LittleFS Usage for ESP8266
runtime.tools.mkspiffs.path=notTheToolYoureLooking For
Have fun! Let me know if you need any help.

Attached Files
File Type: zip data.zip (78.5 KB, 61 views)
File Type: zip HPController.zip (42.8 KB, 65 views)
Acuario is offline   Reply With Quote
The Following User Says Thank You to Acuario For This Useful Post:
Automate (01-28-21)