DIY: Waterproof Double Probe Temperature Sensor with an ESP32

The needs and wants of smart home power users can be very diverse and distinct. Sometimes it’s impossible to find a company-made ready solution for your particular requirements. Other times you might decide to modify an existing device or gadget, to achieve something you might benefit from without spending a ton of money.

This is why DIY projects are awesome. You realize your idea, save a little money and learn something new along the way. As an example for an awesome smart home DIY project, see this article where I talked about converting a Tuya door/window sensor into a Zigbee pressure pad sensor for bed presence.

In this how-to guide, I’m going to create a Waterproof Double Temperature Sensor using a single ESP32 board and two Dallas DS18B20 probe sensors and integrate the device in Home Assistant via ESPHome.

DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors

Use Cases

Before we go any further, you might wonder why would someone make this kind of a sensor? What would you use it for? In a nutshell, you would use this to monitor temperature in two (or more) different spots near each other on a single ESP board. For example:

  • Equipment Temperature Monitor
  • Water Heater Temperature Monitor
  • Aquarium(s) Temperature Monitor
  • Fridge and Freezer Temperature Monitor
  • Server Room Temperature Monitor
  • Cold Storage Rooms Temperature Monitor
  • Whatever else you can think of

In my case, I’ve decided to install the probes in two water tanks which supply hot water in my house. This would enable me to always know the water temp, without a trip to the basement where they are physically located.

Prerequisites

To create this DIY project, there are two ways you can go about it. The first one requires some basic soldering skills, the other can be done without soldering but needs some Dupont wires and is overall a less elegant solution.

I have decided to showcase the no-soldering solution for pure educational purposes. This can be used to test things out initially and useful for beginners to learn. I suggest soldering the components if you intend to install the device as a temperature monitoring gadget.

If you decide to solder the components, you will create a more secure connection between them and eliminate any points of failure. This is the way I recommend of creating this Double Temperature Probe Sensor.

If soldering is absolutely out of your comfort zone, you can achieve the same results by simply pushing the pins inside a couple of Dupont female connectors and securing the wires on the other end with electrical tape. You would also need to obtain a pre-soldered ESP board if you don’t own one.

Here is a shopping list of the required items, some of which you probably already own and can reuse:

🛒 With Soldering:

🛒 Without Soldering:

Note: If you source the components from AliExpress, this DIY project will be much cheaper. Some of the components you probably already have in your home, such as the Micro USB cable, electrical tape and an old phone charger to power the ESP board.

Connecting the Components

Whether you’ve decided to solder the components or simply connect them with Dupont wires, the wiring diagram is the same. This DIY double probe sensors uses a total of three pins on the ESP board: Ground (GND), 3.3V (Power) and any GPIO pin.

It’s important to understand that different ESP boards will have different labelling on the pins. Here is a board-independent, general wiring diagram showing how to connect two (or more) DS18B20 probes to any ESP8266/ESP32 board.

Important: A 4.7kΩ resistor is a requirement for this project and needs to be connected between the data line (GPIOx) and the 3.3v line (VCC).

DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors wiring diagram
Wiring Diagram

A quick google search will tell you the pinout for your specific board. For example, the board I am using is NodeMCU ESP-32s which has the following pinout:

DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors pinout NODEMCU ESP-32S

So in my case, I’m going to connect the GND, 3.3v and GPIO22, because the connections would be near each other and easy to do. To attach the components without soldering:

  • Push one side of the 4.7kΩ resistor in the female end of the Dupont wire (Yellow)
  • Connect (Yellow) Dupont connector along with the resistor to GPIO22 pin
  • Push other side of the 4.7kΩ resistor in the female end of the Dupont wire (Red)
  • Connect (Red) Dupont connector along with the resistor to 3.3v pin
  • Connect (Black) Dupont connector to GND pin
  • Connect all wires by color to those of the DS18B20 sensors
  • Insulate with electrical tape or heat shrink tubes
DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors wired

The Dupont connectors will secure the resistor in place and won’t allow any wiggle room. Here’s a closeup of the resistor in place:

DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors wired with resistor

Flashing The ESP Board

To setup our DIY Double Temperature Probe Sensor component, we need to initially flash the ESPHome software. There is a couple of way to do this, one of them being connecting the ESP board directly to your Home Assistant server (Raspberry Pi, Intel NUC etc.) via a Micro USB cable:

  • Connect your ESP Board to the computer running Home Assistant
  • Navigate to the ESPHome Dashboard
  • Click the + button in the right corner
  • Name your device and input your Wi-Fi Credentials
  • Choose the correct device type: ESP32/ESP8266
  • Click the three dots under you newly created device
  • Select Install
  • Select Plug into the computer running ESPHome dashboard
  • Select your port and wait for the process to finish

Once you see the logs being populated in the dialog window, it means flashing is completed and you can continue. Click stop to close the popup window.

If you click edit, you will see a basic ESPHome configuration. In my case, I’ve named the device boiler-temperature-sensors:

esphome: name: boiler-temperature-sensors esp32: board: esp32dev framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: encryption: key: "ZPhiIaJIWFmDG3kCSD5Oc4K308VIM5T3I+ocXPAIH/w=" ota: password: "97c0bd3c5d8f698fc8657f901fb33f4b" wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Boiler-Temperature-Sensors" password: "VZNUSKQiEHcO" captive_portal:
Code language: YAML (yaml)

Alternatively, you can use the ESPHome Web Dashboard to initially flash the board and subsequently add it to ESPHome in Home Assistant. Its possible you need to hold the boot button while flashing on some ESP boards, the web dashboard will notify you if you do. If you encounter any issues, visit this page.

Adding Dallas Sensor Config

Once the initial flash is complete, we need to add the dallas hub component to our ESPHome code. This will enable us to fetch the address for each of the temperature probes we want to add to our device.

Click Edit and add the following component to your code:

esphome: name: boiler-temperature-sensors esp32: board: esp32dev framework: type: arduino dallas: - pin: GPIO22 .....
Code language: YAML (yaml)

Under the PIN variable, set the appropriate GPIO pin number you’ve used while soldering and assembling the device. Click Save and flash the software again in the same way. Once the process is complete, you will see a list of sensors discovered in the logs of the dialog window:

DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors ESPHome Initial flash

Copy these two addresses and save in a file somewhere for convenience. We will add them to the configuration in the main boiler-temperature-sensors YAML file.

  • Click Edit under your device in ESPHome
  • Add the following configuration while replacing the addresses with yours
esphome: name: boiler-temperature-sensors esp32: board: esp32dev framework: type: arduino dallas: - pin: GPIO22 sensor: - platform: dallas address: 0xd13cb3f648ef3c28 #Replace name: "Boiler 150l Temperature" - platform: dallas address: 0x5c3c23f648eb7328 #Replace name: "Boiler 100l Temperature"
Code language: YAML (yaml)
  • Click Save at top right corner
  • Click Install and select Plug into the computer running ESPHome Dashboard
  • Wait for the process to finish
  • You will receive some temperature readings in the logs:
DIY ESP32 waterproof double probe temperature sensor with dallas DS18B20 sensors ESPHome readings

The ESPHome configuration is complete. If you are unsure which address corresponds to which temperature probe, you can hold one with your hand and note the temperature reading increase. Subsequently change the corresponding name in the ESPHome configuration.

Adding Sensor to Home Assistant

Once the device is pushing data to Home Assistant through ESPHome, you will receive a notification “New Devices Discovered”:

  • Click Check it out
    • Or navigate to Settings > Devices & Services
  • Click Configure
  • Click Submit
  • Optionally add it to a room
  • Click Finish

Summary

This Waterproof Double Temperature Probe sensor is a great starting point for smart home enthusiasts who are just scratching the surface of DIY automation with ESPHome.

I’ve set up my sensor probes to monitor hot water temperature of my two boilers in the basement. This will save me a trip or two to the basement and I can automate the heater within Home Assistant based on the readings of the probes.

If you do decide to try this neat DIY project, I suggest going for a Wemos D1 Mini [Amazon, AliExpress] and 3m DS18B20 [Amazon, AliExpress] Dallas probes. The D1 mini is more than capable for this device and the 3 meter long probes will give you some wiggle room when positioning the device. I also strongly recommend you solder the components instead of using Dupont wires.



SmartHomeScene.com is a participant in the Amazon Services LLC Associates Program, AliExpress Portals Affiliate Program and Banggood Affiliate Programs. These programs are designed to provide means for websites to earn revenue by linking affiliate products through their content. We are compensated for referring traffic and business to these websites, incurring no additional cost to you as a consumer.
SmartHomeScene © 2023 All rights reserved Privacy Policy | Contact Us | Support


Amazon
Patreon
AliExpress
Buymeacoffee
Banggood
Ko-Fi

SmartHomeScene.com is a participant in the Amazon Services LLC Associates Program, AliExpress Portals Affiliate Program and Banggood Affiliate Programs. These programs are designed to provide means for websites to earn revenue by linking affiliate products through their content. We are compensated for referring traffic and business to these websites, incurring no additional cost to you as a consumer.
SmartHomeScene © 2023 All rights reserved
Privacy Policy | Contact Us | Support

5 thoughts on “DIY: Waterproof Double Probe Temperature Sensor with an ESP32”

  1. Why do you have both sensors going to the same GPIO? Why not two GPIO pins so you have independent readings from the sensors?

    1. They are independent readings, this is the way the dallas component works.

      https://esphome.io/components/sensor/dallas.html

      You add the single GPIO pin to activate the Dallas component/hub and add each sensor as a list.

      Quote: “The dallas sensor component (or “hub”) is an internal model that defines which pins the DS18B20 sensors are connected to. This is because with these sensors you can actually connect multiple sensors to a single pin and use them all at once.”

  2. I really love the idea and was triggered by:
    Fridge and Freezer Temperature Monitor
    My Aqara sensors tent to quit working after a while, either by loosing the connection to the Zigbee network, or by experiencing too much cold temperature.
    Now I was wondering; how did you solve the powering of the sensor when placed within the fridge or freezer?

    1. Actually, the ESP32 is installed outside of the fridge. Only the temperature probes are inside the fridge/freezer.

      They have a pretty thin cable, so I managed to squeeze them in the corner of the rubber frame of the door. You need to make sure the door forms a seal though, so be careful.

      Cheers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top