Skip to content
PekawayPekaway
Integrate WLAN temperature sensors

Integrate WLAN temperature sensors

Temperature measurement to control various things is very important for many people. That's why you can connect 4 temperature sensors to our VanPi system. If this isn't enough, you can relatively easily build your own WiFi temperature sensor.

What you need:

- Wemos d1 or another ESP8266 dev board (NodeMCU etc)

- A DS18B20 temperature sensor

- a 4.7k resistor

1. Wiring:

The wiring is quite simple. The power supply comes from the 3.3V pin, ground goes to ground and the signal is plugged into a pin of your choice. Now you have to solder the resistor between the signal and the 3.3V. This is necessary to ensure that the signal is free of interference. The temperature measurements are transmitted via a digital interface.

2. Flashing Tasmota

We are using Tasmota as our firmware again. We also use this open firmware in an adapted form on the Dimmy. :)

The easiest way to install is to use the Chrome browser and go to

https://tasmota.github.io/install/

There we can flash the board connected via USB. You can leave "Tasmota (english)" set as the firmware. After you have pressed connect, select the correct serial interface and then the flashing will begin. (I would recommend erasing the memory.

3. Set up Tasmota

After Tasmota has been flashed and you have re-powered the chip via USB, you should find a WLAN with the name "Tasmota_xxxx". Connect to it and then go to a browser and type in this address:

http://192.168.4.1

You will then be taken to the WiFi settings page of Tasmota. Now we select the device in the VanPi system (or in the network in which your VanPi is running). To do this, simply enter the SSID and password and confirm with "connect". If everything worked, we can now search for the device in the VanPi system. To do this, we connect to the VanPi hotspot and switch to http://van.pi (alternatively: http://192.168.4.1:1880/ui) into the web interface. There we go to the debug page in the config menu. In the item "get assigned dhcp leases" we can now find all devices that have received an IP address from the system. The Tasmota should also be found here. Remember this IP address (192.168.4.x)

Now enter this IP address in a new window and you will see the Tasmota interface. We now have to carry out the configuration there.

First we set the MQTT settings, because we will later receive the temperatures via this protocol.

So we go to Configuration -> Configure MQTT. There we change the host to pekaway.local and the topic to WLANTEMP. This adjusts the communication. If you want to use multiple WLAN sensors, i.e. multiple Tasmota devices, you must use WLANTEMPx (numbering) for the assignment.

Then we have to say that we have connected a DS18B20 temperature sensor. This is done under "Configure Module". First we set "Generic (18)" under Module Type and confirm with "save". The device will now restart. Then we have to select which pin we have the signal from the temperature sensor on. In the example above it is GPIO4.

After we have selected the DS18B20 and confirmed with "save", the temperature should be displayed in the web interface immediately after the restart. If this is not the case, you need to check your cabling.

4. Query temperature via MQTT.

In order to query the values, we need to send a request to the ESP module via MQTT. To do this, we send a "10" as a payload on the topic that we have set to our set topic "%prefix%/%topic%/Status", in this case "cmnd/WLANTEMP/Status. We then receive a response to "stat/WLANTEMP/STATUS10" with the corresponding values. We therefore need to subscribe to this topic in order to receive the values.

This is what it would look like in Node-RED, but please note that we use customized topics in our setup.

Leave a comment

Your email address will not be published..

more tutorials

Open Source needs support

become Patron now

More projects, more tutorials and more supported devices. Our community is growing and would appreciate your support. So become a patron now to always receive the latest content and support the VAN PI project at the same time.

Become a Patron
Cart 0

Your cart is currently empty.

Start Shopping