🏡🌡️🖥️Monitor your central heating with ESPHome

Recently I found some nice Dallas temperature sensors on AliExpress. These sensors came with a metal probe enclosure and one meter wires attached to it. I ordered some without a special reason just have them around. Couple days later I watched a YouTube video from Sir GoodEnough where he added such sensors to his cottage heating system. That inspires me to add these sensors to my central heating as well 🙃.

Top view of the sensors connected to the perfboard with the ESP stacked on
Bench test of the sensors

The Idea

To monitor the temperature of my central heating unit I wanted to place four sensors to the system. One at the hot water tank and three to the heating system itself. All sensors must be attached outside the water system. That way the system stays untouched and I don’t have to be afraid about leaks, etc. All sensors are linked together on a perfboard which also houses a D1 Mini that runs ESPHome to get all the data into Home Assistant. This is a similar design as in my DIY Yardbell project.

Parts list

For the DIY heating monitor we will use the following components:

*Some links are affiliate links. If you use them to buy the parts for your project you will help me and my next project. These links will cause no extra fees or costs to you

Top view off most of the project parts
All components expect the enclosure and one probe

Let’s Go!

Let’s start by placing the screw terminals onto perfboard. I chose to use red for VCC, black for GND and green for data. That way I don’t get confused during connecting the sensors to the board later on. After placing the terminals, solder them to the board. Thx to the sensors, all data ports can be soldered to one dataline (Pin) on the D1 Mini so all data terminals can be bridged.

Downside of the perfboard with the screw terminal soldered on to
Downside of the soldered perfboard

After that, figure out where the D1 Mini has to go. I placed it with the USB port up. That way the pins for VCC, GND and some data pins are facing the screw terminals. Further I soldered one male and female pin header to the board. With this setup it’s impossible to put the D1 Mini in the wrong orientation later on.

Top view of the perfboard and the D1 Mini with soldered connections.
Soldered D1 Mini pins

Choose a pin

Because all sensors will use the same data pin, connecting the sensors to the D1 Mini is quite easy. In my case I selected pin D2 (GPIO4) as the data pin. To prevent the pin from floating, its recommended to use a pull up resistor between data and VCC. ESPHome recommends a 4.7kΩ resistor but the board will use 4 sensors in parallel, so I decided to go with a 1KΩ resistor to create a strong pull up. Choose the value that fits for your setup.

Top view of the board with the soldered data pin connected and the pull up resistor in place
Data line and pull up resistor connected soldered from the backside

Finalizing the board

To provide the sensors with power, they must be connected to the D1 Mini. This is done as same as the data line, from the backside of the board. Its possible to simply bridge the pads or if you have a small spare wire, like me, just use that to connect the screw terminals. I used both methods to connect the GND and VCC terminals to the D1 Mini. The D1 Mini it self uses the power from the micro USB port.

Top view of the backside of the board
Backside with connected VCC and GND

Into ESPHome

After all the soldering, its time to connect the D1 Mini and write / flash the ESPHome sketch. You can do that using the ESPHome web flasher. The easiest way to configure the sensors is to follow the recommendation in the ESPHome documentation. First prepare the basic sketch and connect one sensor. Then check the logs for the sensor address to specify it in the sketch and reflash the sketch after configuring the sensor. Repeat this process with all sensors.

Basic ESPHome sketch

esphome:
  name: heaterroom-thermostat

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "auto-generated-key"

ota:
  password: "auto-generated-password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Heaterroom-Thermostat"
    password: "$up3rP4sSw0rd"

captive_portal:

#temperature sensors
dallas:
  - pin: D2
Screenshot of logs after connection the 3 sensor
Logs after connection the 3 sensor

The final sketch should look similar to this one.

Final ESPHome sketch

esphome:
  name: heaterroom-thermostat

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "auto-generated-key"

ota:
  password: "auto-generated-password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Heaterroom-Thermostat"
    password: "$up3rP4sSw0rd"

captive_portal:

#temperature sensors
dallas:
  - pin: D2

# Individual sensors
sensor:
  - platform: dallas
    address: 0x61b0d35b1f64ff28
    name: "Probe 1"
  - platform: dallas
    address: 0x753d852d1864ff28
    name: "Probe 2"
  - platform: dallas
    address: 0x0f9e4b221864ff28
    name: "Probe 3"
  - platform: dallas
    address: 0x6623872d1864ff28
    name: "Probe 4"

If all sensors are configured properly the ESPHome device can be added to Home Assistant. It shows up as a regular device and promotes all the configured sensors which then can be renamed and added to a Home Assistant dashboard.

Screenshot of the home assistant entity view
Device shown in Home Assistant

Mount all the things

With all the configuration done, its time to mount the sensors to the heating system. I mounted the sensors at 4 points. The first one is the hot water tank. The sensor connects to the exposed metal on the top of the tank which is covered by isolation material.

View of the hot water tank with the sensor connected
Tank sensor

The second and third sensor connect to the fore-run of the heating system. One before and one after the pump. That way I can see if something is wrong with the pump, if these temperatures differ much.

Side view of sensor connected to the fore-run
Sensor connected to the fore-run

The last sensor connects to the return-run of the heating system. That measurement must always be lower than the fore-run, otherwise something is badly wrong 😂. All sensors are fixed with zip tiles and covered by some isolation material to get the most accurate readings.


Last not least, I placed the board into a electrical junction box to protect it from dust and powered it with a phone charger. Pick an enclosure that fits for nearly every enclosure should work.

Top vie of the open junction box
Board in junction box

Sum Up

And that’s it! Your central heating system can now be observed in Home Assistant. The readings might differ a 0.5 – 1.0 degree from the in-pipe-thermostats, but this should not be a big deal if you’re monitoring such an old system😉.

If you like this project feel free to share it and if you have further questions, hit me up on twitter or in the comments below😎.

⚙️🎃💡Automatic Halloween pumpkin light

Recently we went out to carve some pumpkins for Halloween. After we finished our beautiful work my son asked me: “Dad, will they glow in the dark like my marmalade Lamp?”. My first answer was “no”, but then I thought, “Hey, why not 😄?” and on the same day I went to tinkercad to design a circuit.

The automatic Halloween pumpkin light in action

The Idea

I wanted to have a light which turns on automatically when it dark outside. This light must be kinda watertight because it will be used outdoor inside a pumpkin and the circuit should be easy to build. I ended up with this circuit designed in tinkercad.

Image of the circuit from tinkercad
Basic circuit (image from tinkercad)

The circuit works as follows. The N-Channel MOSFET works as a switch. If the voltage on the gate (left pin) is higher than 2V, current can flow from the drain (center pin) to source (right pin). This turns on the LED. The gate is controlled by two resistors. One fixed value and one LDR which has a high resistance in the dark and a low resistance when its exposed to light. These two resistors form a voltage divider and control the voltage at the gate.

So during the day the resistance of the LDR is low which decrease the voltage at the gate and turns the MOSFET including the LED off. From dawn on the resistance of the LDR is getting higher which increases slowly the voltage at the gate. This also slowly turns on the MOSFET and the LED, perfect 😁.

In the real circuit I changed some parts because they weren’t available in tinkercad. The red LED incl. the dropping resistor will be replaced with an cheap white LED strip. The batteries will be replaced by an Li-ion battery incl. changing controller. Last not least I added a switch to the battery to turn everything off if its not in use for a longer time.

Parts list

For the automatic Halloween pumpkin light we will use the following components:

*Some links are affiliate links. If you use them to buy the parts for your project you will help me and my next project. These links will cause no extra fees or costs to you

All components needed for the project
All components

Breadboard time

Before I fired up my soldering iron I hooked put together on a breadboard, because I wanted to know which resistor value works best for my LED strip and MOSFET. First I started with a 100K resistor but using that value the gate voltage was only 2.2 volts, if there was no light on the LDR. Because I wanted to have a higher voltage at the gate, to turn the MOSFET completely on, I went with an 86K resistor. That increases the voltage at the gate to about 2.9 volts which turns the MOSFET nearly complete on.

Besides of finding the right resistor value I was also able to measure the current used by the whole circuit. ~130 mA incl. the 20 LED’s, not bad🤓.

Circuit from tinkercad on a breadboard
Circuit on a breadboard

Start soldering the power unit for the Halloween pumpkin light

I started with the battery and soldered the wires to it. If you’re like me, add some electrical tape for extra safety.

Top view, battery with wires
Battery with wires

After that, I cut the positive wire in half, added heatshrinks and soldered the switch to the wire.

Front view of the soldered switch to the battery
Soldered switch

To complete the “power unit” I added the USB-C charging unit to the battery by soldering the wires to the battery pads on the circuit board.

The charging unit wired to battery
Wired charging unit for the Halloween pumpkin light

Move on to the transistor circuit

Then I moved to the tricky part. Even if the circuit looks simple it kinda confused me during soldering, so I had my tinkercad circuit next to me and double checked every wire if I had to add a hearshrink or not.

With that preparation I continued soldering wires to the LDR. Because it will be exposed to the weather, I added some transparent heatshrink to protect the LDR from the rain.

top view of LDR with wires and heatshrink
LDR with wires and heatshrink

After that step I soldered some wires to the LED strip and drilled two holes in my enclosure to put the wires from the strip and LDR trough it. It’s important to do that before soldering the other components to the wires! Trust me, I did that mistake about 100 times 😄.

Top view of LED strip and LDR wires inside the enclosure.
LED strip and LDR wires inside the enclosure

With my tinkercad drawing next to me I added heatshrinks to the LDR wires and soldered them to the gate (left pin) and the source (right pin) of the MOSFET.

LDR wires soldered to the gate and source of the MOSFET
LDR soldered to the MOSFET

To create the voltage divider I added the 86K resistor to the gate (left pin) of the MOSFET.

86K resistor soldered to the gate of the MOSFET
86K resistor added to the gate

Then I soldered the negative LED strip wire to drain (center pin) of the MOSFET. Same as before, don’t forget the heatshrink 😉.

Topview of the negative wire soldered to the drain of the MOSFET
Negative wire soldered to the drain of the MOSFET

To create a connection for the “power unit” I cut off a piece of wire and soldered it to the positive wire of the LED strip. Then I slid a heatshrink over the two wires and moved the heatshrink from the LDR up to the MOSFET before I soldered the two wires to the resistor.

Deatil view of the positive wires connected to the resistor
Positive LED strip wire and spare wire connected to the resistor

Almost done

After finishing the voltage divider I slid up the heatshrink from the drain of the MOSFET and soldered a negative spare wire to the source of the MOSFET. This wire will be also connected to the “power unit”.

Image of the complete soldered MOSFET
The finished MOSFET

In the last step I secured all connections, heated up all heatshrinks and added a big one which fit over the MOSFET. So I ended up with a nice little package.

Front view of the MOSFET with all heatshrinks shrinked
MOSFET with all single heatshrinks
MOSFET with large heatshrink
MOSFET with large heatshrink

The final steps

To complete the wiring I soldered the two spare wires from the MOSFET to the “power unit”.

Image of the final soldering
MOSFET soldered to the “power unit”

Now it was time to put everything into the enclosure and wrap the LED strip into the transparent heat shrink. Last not least I added some hot glue to the holes of the enclosure to prevent moisture inside the pumpkin 🎃.

Image of the finihed project while its charging
The finished automatic light during charging

Sum up

And that’s it, the automatic Halloween pumpkin light is done🎉. If you turn on the switch and cover the LDR with your hand, the LED strip starts to light up.

This was a really fun project; from the idea to tinkercad over to the breadboard till the final soldered result.

As always, if you like this project feel free to share it. If you have any questions, just write a comment or ping me on twitter 🐦.

🏡🔔DIY yard bell with ESPHome and Home Assistant

During the last summer I often missed the bell from our front door when I was working in the back yard. This mostly ended up either in a missed package or pizza delivery which was kinda annoying. The solution for this problem was quite simple, a yard door bell and because I love tinkering I wanted to build my own version instead of buying an off the shelf product.

DIY yard bell circuit in a 3D printed case next to a zigbee button.
DIY yard bell in case with zigbee button

Parts list

For this yard bell we will use the following components:

*Some links are affiliate links. If you use them to buy the parts for your project you will help me and my next project. These links will cause no extra fees or costs to you

Top view of all components except the 3D printed case and the Zigbee button
All components except the 3D printed case and the Zigbee button

Starting on a breadboard

Because I had no clue if my idea would work, I started on a bread board. The D1 Mini is hooked up to 3.3V and the buzzer and the vibration motor are connected to two GPIO pins on the D1 Mini (D5 & D6). The idea is to pull both pins high when the Zigbee button is pressed which then turns on the buzzer and the vibration motor. After some delay both pins should turn low automatically. The D1 Mini is running ESPHome which makes it easy to announce both pins as momentary switches in Home Assistant.

Top view of the main circuit on a solder-less bread borad.
Main circuit on a bread board

The ESPHome sketch and Home Assistant

To make the pins available as momentary switches in Home Assistant I used the following sketch. This sketch connects to my Wifi and defines both pins as switches which auto turn off after 750-1000ms.

esphome:
  name: diy-yardbell

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "SuperSecr3t"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Diy-Yardbell Fallback Hotspot"
    password: "SuperSecr3t"

captive_portal:

switch:
  - platform: gpio
    pin: D6
    id: buzzer
    name: "Buzzer"
    icon: "mdi:volume-high"
    on_turn_on:
    - delay: 750ms
    - switch.turn_off: buzzer
    
  - platform: gpio
    pin: D5
    id: vibrator
    name: "Vibrator"
    icon: "mdi:vibrate"
    on_turn_on:
    - delay: 1000ms
    - switch.turn_off: vibrator

After uploading this sketch to my D1 Mini, the two pins show up as buttons in Home Assistant and I was able to create an automation which triggers both switch 3 times in a row with a delay of two seconds.

Screenshot of the details of the ESPHome device with German titles
Details of the ESPHome device with German titles
Screenshot of the Home Asssistant automation
Automation details triggered by the Zigbee button

With that all set I was able to give the project a first test.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

Lets start soldering

After the successful tests everything was ready to solder. I started with the short female connectors and soldered them onto the perfboard. Then I soldered the positive wire of the vibration motor to the D5 pin and the negative wire to the GND pin.

Top view of female connectors and vibration motor soldered to the perfboard
Female connectors and vibration motor soldered to the perfboard

In the next step I soldered the buzzer onto the perfboard. I chose a position where the negative leg of the buzzer lines up with the negative wire of the vibration motor, for easier connection.

Top view of the aligned buzzer
Buzzer aligned on perfboard

To persist the buzzer I soldered it in place and connected the positive leg to the D6 pin.

Bottom view of the soldered perfboard with buzzer connected to pin D6
The complete soldered perfboard

Last not least I soldered the long female pin headers to the D1 Mini battery shield and the male pin headers to the D1 Mini.

Side view of soldered D1 Mini and battery shield
D1 Mini and battery shield soldered

Stack it up!

With the complete soldering I was able to stack everything together. I stacked the battery shield on top of the perfboard that the pins were lined up and placed the battery next to it. Then I realized that my battery wires were a bit to short so I had to extend them a few cm’s. The vibration motor went on top of the battery to keep the form factor small.

Top view of the perfboard with the battery shield stacked ontop next to the battery
Battery with extended wires.

To finish the assembly I stacked the D1 Mini on top, connected the battery to the battery shield and secured the vibration motor with some electrical tape.

Top front view of the complete functional stack.
The complete stack, ready for the enclosure

The enclosure

As a reaction on my testing tweet I got an DM from Evis Home who asked me If I want to try his tinkercad code block for a project box. This was an awesome coincidence, because I simply had to measure the dimension of the perfboard stack, typed that into his script and within seconds the model was ready. I only had to import the lid into tinkercad to add some holes so that the sound of the buzzer was easier to hear.

Top view of the enclosure during the print on a 3d printer
The enclosure during the print

The final yard bell project

After the print was finished I put the perfboard stack into it. It fit’s perfect 🤩. That was the time to test everything for the last time.

Video of the final test

Sum up

After some months of project break, this was a really fun and also useful one 🤓. I really like how simple such ideas can be realized with ESPHome and Home Assistant. With only a few components I could built a DIY yard bell which is much more flexible than a off the shelf product. E.g. you could replace the Zigbee button with a motion sensor or activate the yard bell only in the evening. It’s also possible to replace the buzzer with a sound module that plays you favorite song. The possibilities are up to you 😁 .

As always, if you like this project feel free to ping me on twitter and share pictures of your own build.