
Reliable temperature measurement is one of the most important elements of a smart home system. Continuous monitoring of room temperatures, outdoor temperatures, heating system pipes, domestic hot water tanks and buffer tanks provides the foundation for many intelligent control functions.
Using a Wemos D1 mini and a DS18B20 digital temperature sensor, we can build a simple, low-cost Wi-Fi temperature sensor that can be directly integrated into the Domoticz smart home system using Tasmota firmware.
The solution operates entirely within the local network and does not require an external cloud service, a manufacturer-specific mobile application or a subscription.
The completed Wi-Fi temperature sensor can be used for various applications, including:
The measured temperature data can also be used by the custom-developed DSVT heating, cooling, domestic hot water and buffer tank controller of the Szélessáv SmartHome system.
Related solution: DSVT – Intelligent Heating and Cooling Control
The Wemos D1 mini is a versatile Wi-Fi-enabled development board based on the ESP8266 microcontroller. It is compatible with Tasmota firmware, which provides built-in MQTT communication and Domoticz integration.
The module is available from various local and international suppliers, including:
The DS18B20 is a digital temperature sensor using the 1-Wire communication protocol, which can easily be connected to an ESP8266 microcontroller.
For the design presented here, we recommend the wired version with a protective metal probe. It can easily be positioned at different measurement points and, when properly attached, can also be used to measure pipe surface temperatures.
AliExpress – DS18B20 temperature sensor with protective metal probe
For proper operation of the DS18B20 sensor, a 4.7 kΩ pull-up resistor is required between the 3.3 V power supply and the sensor data line.
Detailed wiring information is also available in the Tasmota documentation:
Tasmota – DS18x20 temperature sensor
Continuous operation of the Wemos D1 mini module requires a suitable, stable 5 V USB power supply and a USB cable compatible with the module's connector.
The design presented here is intended for continuous external power supply rather than battery-powered operation.
The electronics can be installed in a small standard junction box. However, we have also designed a custom enclosure that can be manufactured using a 3D printer.
The enclosure provides a compact housing for the Wemos D1 mini module and the DS18B20 temperature sensor with its protective metal probe.
The STL files required for 3D printing are freely available for download:
The enclosure presented here is not a certified waterproof housing. For outdoor or humid environments, the electronics must be installed in an enclosure with an appropriate protection rating.
The following steps describe the assembly method we use. Other mechanical arrangements can also be implemented.
Insert one lead of the 4.7 kΩ resistor into the 3.3 V (3V3) connection point of the Wemos D1 mini and the other lead into the D5 connection point.
The D5 connection point corresponds to GPIO14 of the ESP8266 microcontroller.
If our custom-designed 3D-printed enclosure is used, cut the temperature sensor cable to approximately 90 mm, measured from the upper end of the protective metal probe.
Remove approximately 35 mm of the outer cable insulation, then strip approximately 2 mm of insulation from the end of each individual wire for soldering.
The three-wire DS18B20 sensor used in our design is connected as follows:
| DS18B20 Wire | Function | Wemos D1 mini |
|---|---|---|
| Red | Power supply (VCC) | 3V3 |
| Yellow | Data line (DATA) | D5 (GPIO14) |
| Black | Ground (GND) | GND |
The 4.7 kΩ resistor is connected between the 3V3 and D5 connection points. The red and yellow wires can be soldered alongside the corresponding resistor leads.
Important: wire colors may vary between manufacturers. Always check the documentation of the specific sensor before connecting it. Perform all soldering with the power supply disconnected.
After completing the assembly, connect the Wemos D1 mini module to your computer using a USB cable that supports data communication.
Using Google Chrome or another compatible browser with Web Serial support, open the official Tasmota online installer:
https://tasmota.github.io/install/
For the ESP8266-based Wemos D1 mini module, select the Tasmota Sensors (tasmota-sensors) firmware version. This version includes the required sensor support.
After selecting the appropriate firmware, start the installation by clicking Install, then select the serial port associated with the Wemos D1 mini module.
When configuring a new device or a module previously used with different firmware, we recommend selecting the Erase device option.
This removes the previous firmware and its stored settings, allowing the device to be configured from a clean installation.
After the firmware has been successfully installed, continue with the wireless network configuration.
Select the local Wi-Fi network you want to use and enter its password.
The ESP8266-based Wemos D1 mini module supports 2.4 GHz Wi-Fi networks.
After successfully connecting to the local network, open the device's own web interface to complete the remaining configuration steps.
The Tasmota web interface provides access to the configuration options required for the device to operate correctly.
Under Configuration / Configure Other, change the contents of the Device Name field so that the device can easily be distinguished from other Tasmota devices on the network.
For example:
1_D1_mini_DS18B20
The easiest way to configure the hardware is to use the following Template:
{"NAME":"D1_mini_DS18B20","GPIO":[1,1,1,1,1,1,1,1,1,1,1312,1,1,1],"FLAG":0,"BASE":18}
After entering the Template, make sure that the Activate checkbox is selected before saving the configuration.
Under Configuration / Configure WiFi, change the contents of the Hostname field, for example to:
1-d1-mini-ds18b20
This makes it easier to identify the device in the router's DHCP client list.
If the previously specified Template has been activated, the GPIO14 configuration for the DS18B20 temperature sensor has already been completed.
If the Template is not used, the configuration can also be performed manually under Configuration / Configure Module:
After saving the configuration and restarting the device, the temperature measured by the DS18B20 sensor should appear on the Tasmota main page.
Communication between Tasmota and Domoticz takes place using the MQTT protocol. The required MQTT service is included in the Szélessáv SmartHome system.
Other Domoticz installations require an operational MQTT broker and a properly configured Domoticz MQTT connection.
Under Configuration / Configure MQTT in Tasmota, enter the information required to connect to the MQTT broker.
We recommend assigning a unique MQTT Topic to each device, for example:
1_D1_mini_DS18B20
A virtual temperature sensor must first be created within the Domoticz system.
In the Domoticz hardware configuration section, use an existing or newly created Dummy hardware instance and create a virtual sensor of the Temperature type.
The unique identifier (Idx) of the newly created virtual device can be found in the Domoticz device list.
Under Configuration / Configure Domoticz in Tasmota, enter the Idx of the previously created virtual temperature sensor into the Sensor idx 1 Temp field.
After saving the configuration, Tasmota automatically transmits the measured temperature values to the corresponding Domoticz device through the MQTT connection.
The frequency of periodic data transmission in Tasmota can be configured using the TelePeriod parameter.
For example, the following command can be entered in the Tasmota Console to configure data transmission every 60 seconds:
TelePeriod 60
The appropriate data transmission interval should be selected according to the application of the temperature sensor and the requirements of the control system.
Detailed documentation of communication between Tasmota and Domoticz is available here:
Tasmota – Domoticz Integration
If all configuration steps have been completed correctly, the data of the virtual temperature sensor created in Domoticz will be updated automatically.
Domoticz stores the measured temperature values, making it possible to display not only the current temperature but also historical measurement data and charts.
The sensor data can be used directly by the various control modules of the Szélessáv SmartHome system, as well as by other Domoticz automations.
Communication between the Wemos D1 mini, Tasmota firmware, the MQTT broker and Domoticz takes place entirely within the local network.
Temperature measurement, data collection and the local automations based on this data remain operational even if the internet connection is temporarily unavailable, provided that the local network and the required devices are functioning.
This simple and low-cost solution allows us to build custom temperature sensors for our smart home system without depending on manufacturer-specific cloud services.