Building a smart thermostat

I'd like to have a computer-controller thermostat, that behaves the way I want to, doesn't need to talk to external servers, can measure temperature in multiple rooms.

I'll need:

  • multiple cheap temperature sensors that can report their readings wirelessly
  • a way to start / stop the boiler
  • some clever software to decide when to turn the boiler on/off based on the temperature readings
  • a computer to run that software

The sensors

The current candidate is a ESP32 running off (probably alkaline) batteries, using a DHT11 sensor.

diagram showing a ESP32 microcontroller wired up to a DHT11
sensor
Connections:

microcontroller

sensor

+5V

VCC

GND

GND

pin 13

DATA

The code for the thermometer uses the DHTesp library to read the sensor, and the esp8266-oled-ssd1306 library to drive the display. The final sensor will most probably not have a display.

Talking to the boiler

Using the process described by Steven Hale, Dave Hope, Ross Harper and probably others, I connected a 433MHz receiver to my soundcard:

diagram showing a 433MHz receiver wired up to a stereo audio
cable via resistors
Connections:

From

To

Power +

receiver VCC

Power -

receiver GND

Power -

microphone cable shielding via 22kΩ resistor

receiver data

microphone cable channel via 47kΩ resistor

By turning the knob the thermostat that was installed with the boiler, I generated the on and off signals. I recorded them with Audacity, and spent a few hours puzzling them out. This is what the recorded waveforms look like:

two similar but not identical saw-toothed waveforms, one
above the other
The two signal trains (one for "on" and one for "off")

It took a while to realise that those saw-toothed waves were actually square waves, mangled by all the filters that my soundcard has, and that the heights were different only because of those same filters.

Measuring the number of samples between rising edge and falling edge gave me the timing. Then I had to do the whole thing again when I noticed that the "low" widths where not always equal to the preceding "high" width: it's not a 50/50 duty cycle square wave.

Then I built a transmitter:

diagram showing an Arduino UNO wired up to a 433MHz
transmitter
Connections:

microcontroller

transmitter

+3.3V

VCC

GND

GND

pin 7

DATA

and wrote code to send the correct pulse train. The receiver wired to the boiler recognises the signals and turns on and off.

DatesCreated: 2018-03-25 12:47:54 Last modification: 2023-02-10 12:45:24