Introduction: Temperature Logger With Nodemcu Esp8266 D1 Mini to Thingspeak
I know this looks like just another WiFi logger, but this is a little bit more.
It uses Thingspeak free service, can be configured through WiFi AP, and uses minimal components.
It only needs 3 components: Wemos D1 mini (or nodemcu v1.0 if you prefer), a waterproof DS18B20 and a 5V micro USB wall charger. The picture shows a pushbutton switch as well, but if you use nodemcu, that can be omitted. That is just for erasing EEPROM.
Step 1: Introduction
This device can handle up
to 8 temperature sensors.
The sensors are polled every second, and the measured values are transmitted to a dedicated ThingSpeak channel through a formerly set Access Point. In order to accomplish accurate timing, the device uses Network Time Protocol.
After registrating at Thingspeak.com, the user gets a „Write API key” and a „Read API key”. The WiFi logger uses the „Write API key” to send datas to the thingspeak server. This key provides the connection between the datas and the user’s channel.
A thingspeak channel contains up to 8 fields, so maximum 8 temperatures can be stored in a channel. In addition to this, thinspeak.com only accept datas once in every 15 seconds. If multiple devices want to send datas in 15 seconds, then only the first device’s datas are stored, the rest will be ignored.
Step 2: Setup
At first power up, the device start with empty memory (EEPROM), and creates its own Access Point with SSID „temperature”.
The user must connect to this Access Point. The password is the same as the SSID.
After the connection has been established, the device can be accessed through a browser, with IP address: 192.168.4.1 or hostname: „temperature”.
The WiFi logger’s internal webserver provides the web page as shown in the picture.
There is a list of the available Access Points including their signal strength and the protection level.
The user must enter the desired SSID and Password (the WiFi logger will connect to that Access Point).
A desired hostname must be entered in the Hostname field (if multiple devices are in the same network, it is advisable to choose different hostnames).
The Thingspeak API key field stands for „Write API key”.
Step 3: Setup 2
The desired Thingspeak field number must be entered to Start field (1-8). This field is important if multiple devices are sending datas to the same thingspeak channel. For example: 2 WiFi loggers are working simultaneously, each has 3 temperature sensors. The first device sends datas to field 1-2-3 (the Start field (1-8) is 1), the second device sends to field 6-7-8 (the Start field (1-8) is 6).
The user must enter the waiting time after the given hour’s 0. minute and 0. second. This field is also important if multiple devices are sending datas to the same thingspeak channel. Thingspeak’s 15 seconds interval data storage limit must be taken into account. Continuing the previous example: if a device sends data to thingspeak at the beginning of an hour (at 0 min. 0 sec.), then the next device can send its datas at least 0 min. 15 sec. Practically minimum 20 seconds gap shall be used between 2 data storages.
Send interval (1-6 min.) field means how often the WiFi logger sends datas to thingspeak.
The data storage timing can easily be understood in the next example: 3 devices are sending datas to the same thingspeak channel, but into different fields. All the devices are sending at 5 minutes intervals. The first device’s sending interval starts at 0 min. 0. sec., the second device’s start 75 seconds after, and the third device starts sending from 153 seconds after the beginning of a hour.
There is more than 15 seconds gap between two data storages, thus all the information will be available.
Zero timekeeping error between the devices is guaranteed by NTP synchronization. The time server is checked every 12 hours.
Step 4: Setup 3
The setup datas are saved in the EEPROM by pressing the Save button. After saving, the device resets itself and tries connecting to the given Access Point. After connected, the measuring cycle starts immediately.
The Clear EEPROM button clears all settings, then the device starts is Access Point mode.
The actual measurement(s) can be seen at the bottom of the webpage.
Step 5: Usage
After the device
successfully connected to the given Access Point, its own Access Point named „temperature” disappears.
The device has two pushbuttons: RST and FLASH. RST button restarts the device. Pressing the FLASH button for at least 5 seconds, clears the EEPROM. After the EEPROM clear, the device restarts and creates its own „temperature” named Access Point.
Step 6: Software
The source code is attached.
It needs Arduino IDE, with esp8266 library installed.
Also, the onewire and dallastemperature must be included.