- Set temperature according to your personal preferences
- Lock temperature once set it cannot be reset by another person
- Auto-start to automatically start the thermostat incase the user forgets to turn it on
- Remote control - control the thermostat using your smartphone
- ESP-IDF
- MQTT
- PlatformIO
- ESP32 DOIT DEVKIT
- NTC Thermistor
- HVAC Switch
- Rotary encoder
- SSD1306 OLED screen
- Battery powered - may change
- KICAD - preferably
This circuit uses a 10k NTC thermometer to measure temperature. NTC thermistor's resistance decreases with increase in temperature and vice versa.
For conversion of resistance to analog voltage, we use a voltage divider circuit to measure voltage drop across the known resistor value. We have configures the ADC to use 3.3V MAX and 12 bit. So its highest analog value is 4095. The formula below shows conversion of voltage-divider voltage to analog value:
// voltage divider formula: Vo = (R1 / (R1 + R2) ) * Vin
// where R1 is the know resistor, R2 is the thermistor resistance
// vo is the value read on the analog input pin
// Rearranging to get R2 as below
R2 = R1 * ((4095 / float(vo)) - 1.0);
To calculate the temperature, we use the SteinHart-Hart Equation (See reference below). The function below will return the temperature in degrees Celcius.
uint32_t calculate_temp_in_deg_C(uint32_t vo){
/*
* Calculate temperature in degrees
*/
R2 = R1 * ((4095 / float(vo)) - 1.0);
log_R2 = log(R2);
T = 1 / (A + B * log_R2 + C * log_R2 * log_R2 * log_R2);
T = T - 273.15;
return (uint32_t) T;
}
This formula is guaranteed to give us the desired temperature accurately.
This feature allows the user to set the temperature that the room will be maintained at. Maximum temperature we can set is 100 deg C. Minimum temperature is 25 deg C( room temperature)
The function to set temperature is capped to C MAX_TEMPERATURE
and C MIN_TEMPERATURE
. So when the user rotates the encoder beyond these values, the value is not incremented or decremented.
Of course this depends on the set units; whether Celcius or Farenheit.
In this mode, when the user clicks the encoder button, the set point is saved to the c ESP32 Non Volatile Storage
.
On exit this value is fetched from the NVS and displayed on the homescreen.