DS18b20 Temperature Sensor As a Thermostat

by padeath in Circuits > Arduino

9368 Views, 89 Favorites, 0 Comments

DS18b20 Temperature Sensor As a Thermostat

Build a DS18b20 Temperature Sensor on a ESP8266

This Instructable shows how I built the thermostat for my home-assistant using an ESP8266 and MQTT with a DS18b20 temperature sensor.

Part 1 of this build is to build a temperature senor using a DS18b20 - The video shows how I built the board rather than using the prototype on a breadboard.

Part 2 is to build the relay board that controls the boiler.

Hardware That You Will Need

IMG_9755.JPG
IMG_9756.JPG
  • ESP8266 on daughter board (http://goo.gl/2gBtGn)
  • 5v to 3.3v regulator (http://goo.gl/jh6MyW)
  • DS18b20 sensor (http://goo.gl/wK8J2w)
  • 4.7k Ohm resistor
  • Connecting wires
  • Pin header sockets (http://goo.gl/R3fzEQ)
  • Fan header connectors (if you want to connect power and sensor as I have)
  • Solder
  • Soldering iron
  • Wire cutters
  • Veroboard
  • Veroboard track cutter

MQTT - to Send the Temperature to a MQTT Broker

IMG_9757.JPG

Details on how to use this with a MQTT broker can be found in my Instructable called 'Remote Temperature Monitoring Using MQTT and ESP8266 Modules'

Switching the Heating on and Off

ESP8266 thermostat ready to roll

I've used another ESP8266 using MQTT which subscribes to a switch in home-assistant which will switch the boiler on and off using a relay. I explain how I setup this in my other Instructable 'Using an esp8266 arduino to control a relay using home-assistant'.

Instead of using a switch though, I used a thermostat in home-assistant. The home-assistant configuration I used was as follows:

thermostat:
platform: heat_control name: Livingroom heater: switch.switch1 target_sensor: sensor.living_room min_temp: 15 max_temp: 30 target_temp: 15

This uses the switch.switch1 as the relay, which is switched on and off depending on the temperature which is taken from the sensor.living_room, which is the DS18b20 connected to another ESP8266 that I covered in the video.

The relay is connected to the control unit for my boiler, it has 2 pins that when shorted the boiler comes on, so I just simply connected the normally open pins of the relay to these 2 pins and when the ESP8266 gets a signal to switch on the relay, it then turns on the boiler.

This happens when the temperature in my Living room is lower than the set point which I can change using home-assistant.