ESP32 project that manipulates the outdoor air temperature measurement to adjust the heat pump cycle rate. In case the heat pump is over dimensioned it can increase its efficiency dramatically since you can adjust the cycle rate specifically on your environment and needs.
The manipulated temperature output needs to be connected to the external temperature sensor of the T-Cap.
If you already use an external temperature sensor you can connect it as input sensor for the ESP, in case you don't have a temperature sensor you can use the free OpenWeather API to receive actual temperatures.
Via an optional 0-10V DAC it is also possible to limit the power consumption via Demand Control of the T-Cap.
Note
You can find the measurements, charts and calculations inside the TestsAndCharts.xlsx, device specific information can be taken from the T-Cap Service Manual (PDF)
Tip
Most important Manual pages:
- 49 Wiring Connection Diagram
- 53 Electronic Circuit Diagram
- 56 Main Circuit Board
- 57 Sub Printed Circuit Board
- 76 Cable management
- 78 Temperature Sensor
- 88 Demand Control
- 128 Alternative Outdoor Ambient Sensor Control
Caution
The connection between the T-Cap and the Controller should only be done by a trained professional. There is a danger to life due to high voltage (230V/400V) within the device!
| Feature | Completed |
|---|---|
| Automatic switch between WiFi AP and Client mode | ✓ |
| Hardware sensor for input temperature | ✓ |
| Weather API for input temperature (OpenWeather) | ✓ |
| 0V-10V Demand control (Requires optional board) | ✓ |
| OTA Updates | ✓ |
Captive Portal (if not working use IP 192.168.4.1) |
✓ |
| Custom webinterface for better accessibility | ✗ |
| Name | Required | Description |
|---|---|---|
| ESP32 NodeMCU-32S | ✓ | Microcontroller |
| MCP4151-503E/P | ✓ | Digital Potentiometer 50K, 256 steps, SPI |
| Electrical wire 0.5mm² 20awg | ✓ | For bridges on custom Controller board |
| Electrical wire 0.5mm² 20awg | ✓ | For connection between bords and relay |
| Electrical wire 18awg 2×0.75mm² | ✗ | Connection optional 0-10V Demand Control to T-Cap |
| Electrical wire 18awg 4×0.75mm² | ✓ | Connection temperature output to T-Cap |
| Prototype Board | ✓ | For final board |
| 10k resistor | ✓ | Voltage divider for input sensor |
| 5k resistor | ✓ | Pre-Resistor for Digital potentiometer (defines the possible output temperature, in my case +30°C to -20°C) |
| 2k resistor | ✓ | GND pulldown for unused Digital potentiometer terminal |
| 4CH 5V Relay Module | ✗ | Optional relay module (High-Level-Trigger) for fallback implementation, not required but highly recommended! |
| DFRobot Gravity I2C DAC Module | ✗ | Optional I2C DAC 0-10V for Demand Control |
| Breadboard Kit | ✗ | Prototype Board for testing |
| Connectors | ✗ | Connector for wires |
| Socket for ESP | ✗ | Socket for ESP |
| IC Sockets | ✗ | IC Socket for MCP4151 |
| Name | Description |
|---|---|
| Housing | Housing for Controller, Relay... |
| USB-C Connector | USB connector for power or PC |
| 4-Pin Connector Temperature | Connector for temperature input/output |
| 2-Pin Connector Demand Control | Connector for Demand control (optional) |
| Mount for boards | Connector for Demand control (optional) |
| Power Supply (USB-C) | External USB-C power supply |
- Soldering iron, Solder...
- Multimeter
- Drill (for housing)
- Glue (for housing board mounts)
You can find the electrical drawings and parts inside Documentation\Fritzing as Fritzing (freeware) project.
Note
This project requires Visual Studio Code with the PlatformIO IDE and C/C++ Extension Pack extensions for compile and upload of the firmware to the Microcontroller.
Important
Make sure you have also installed the correct driver for the Microcontroller USB to Serial chip. Usually the driver is not part of the OS. In my case I needed to use the CP210x Universal Windows Driver
For privacy reasons some settings are defined inside a header file that is excluded from git.
Since this information are used inside the classes copy and rename the file Secrets.template.h to Secrets.h to resolve build errors after cloning.
If there is no input sensor available you can use the integrated OpenWeather API.
To do so you need to create a free account to receive the required API Key.
The city ID can be taken from OpenWeather by searching for the location and can then be taken from URL .../city/xxxxxxx.
As alternative you can also use the Latitude + Longitude that can be taken from Google Maps by right-click menu.
The configuration needs to be placed inside the Secrets.h.
Note
Requests for free accounts are limited to to 60 calls/minute or 2000 calls/day
A common way to manipulate the temperature is to connect a parallel resistor (e.g. 75kΩ) to the external sensor. The problem with this approach is that a thermal resistor isn't linear and because of that the temperature offset increases as the real temperature goes down:
Due to the precision problems with a parallel resistor this project has been started, to provide a more granular and comfortable way, without changing hardware if another offset is required.
It also makes it a lot easier at the beginning, since first you need to figure out what offset is the best based on your environment and preferences. To do so you can control input and output temperatures manually until you know where your sweet spot is. Afterwards the controller manipulates the output temperature based on a input temperature fully automated.
- Temperature from hardware sensor (
nanif not connected) - Temperature received from the Weather API (
nanif not configured) - Manual temperature input for testing (if
1and2arenanvalue is used as fallback) - Force manual temperature
3on/off
- Actual output temperature (closest available to
2, limited by the steps of theDigital Potentiometer) - Target temperature (input temperature + offset)
- Manual output temperature for testing (ignores adjustment offsets)
- Force manual output temperature
3on/off
Important
Keep in mind that the components are not perfect and have tolerances. Also, the Digital Potentiometer
works with limited steps, which can't always be on spot.
The Target Temperature is calculated and may not match the Output Temperature that represents the
mathematically closest available resistance. If you want, you can use the T-Cap sensor calibration for compensation.
Below you can find a chart with the delta between Target Temperature, Output Temperature
and the measured output temperature that the T-Cap will read from the physical output resistance:

The T-Cap provides a 0-10V analog input to limit the power consumption. It can be a handy tool to optimize the heat pump even more as what is possible only by temperature adjustments.
To do so you can define temperature areas and its power limit inside the UI.
Note
The Input Temperature will be used to determine the area, this ensures that
temperature adjustments will not influence the power limits.
Tip
The first matching area will be uses (top to bottom). In case no responsible area will be found the output will be set to 0V (not active). If you like to define a default limit place the value inside the last area with start 30°C and end -20°C and define specific areas above. To deactivate areas set start and end temperature to the same value.
- Actual power limit send to the T-Cap
- Manual output power limit for testing (ignores adjustments)
- Force manual output power limit
2on/off
Note
Power limit can be defined in a range between 10%-100% in 5% steps.
Values <10% are handled as not active
Caution
The connection between the T-Cap and the Controller should only be done by a trained professional. There is a danger to life due to high voltage (230V/400V) within the device!
Important
Please check the manual carefully to your specific device, this instruction is based on the WH-SQC16H9E8!
In case you have another unit you might need to use other connectors within the device!
For all connection to the T-Cap I've used 0.75mm², you can also use another cable but you need to use at least 0.3mm²!
If you already use a external temperature sensor, you should use it as input temperature for the controller. In case you don't have an external sensor, you should connect a fallback resistor to simulate e.g. 10°C.
Tip
Alternatively, you can also connect the temperature to the outdoor device instead of the indoor device. Make sure to check the manual for the correct wiring!
Note
You need to change the setting of the T-Cap to use the alternative outdoor sensor, otherwise, the temperature of the outdoor unit will be used.
Important
If there is no temperature sensor available for more than 5s the Device will notice it and log an error. Therefore, it is required to add a fallback resistor sensor if there is no real sensor connected to the controller. This is the reason why the fallback 4CH Relay Module is highly recommended, that will connect the input sensor to the T-Cap while the controller is turned off or during boot until it is ready!
Note
The optional PCB needs to be available, needs to be enabled inside the T-Cap settings and the demand control needs to be enabled inside system settings.
Important
Make sure you have connected the 0-10V GND and 10V to the correct connectors, unlike temperature it is important to pay attention to polarity!
The following libraries are used by this project (Thank you very much!)
- ESPUI for webinterface
- RunningMedian calculation for input temperature sensor
- arduino-timer for time based functions
- MycilaESPConnect inspiration for WiFi AP/Client switching
- ADC-Accuracy ADC accuracy improvement
- DFRobot_GP8403 I2C DAC Module
This project is licensed under MIT license.




















