Sunday, July 4, 2021

ESP Temperature to ThingSpeak smart meter


ESP/Temperature To ThingSpeak is a smart temperature meter that sends temperature to the ThingSpeak service.


It's based on the ESP8266 board and uses the ADS1115 analog to digital converter in order to read the resistance value of up to 4 NTC sensors and convert it to the temperature value. The NTC to temperature convertion is performed using the library you can find here http://davidegironi.blogspot.com/2018/01/esp8266arduino-ntc-library.html

The code is written using the Arduino ESP8266 framework.

The WiFiManager library it is used to simplify the settings of the AP the board has to connect to. If the ESP8266 can not find the last network used, or no network is set, the ESP8266 enters the "forced AP mode", now the user can connect to the device WiFi and set the main WiFi AP to be used for the internet connection.

When it's connected WiFi AP the IP address given by the main AP DHCP server, the default web page is accesible at the ip address of the device or at the address http://esptemperaturetothingspeak001

Through the web interface one can also set the unit of temperature and the ThingSpeak API Key and Channel ID.


A ThingSpeak channel has to be setup, it must have 1 to 4 Fields, depending on the NTC sensor added. Then the Write API Key and the Channel ID should be filled up in the web interface of this mini device in order to allow the temperature to be sent to ThingSpeak.


Each seconds the device read the raw value from the ADC, convert itt to resistance, and then use the resistance value to get the temperature.

Each minute temperatures where sent to ThingSpeak.

The code is really simple and can be modified according to your needs. Just download it, compile and use it.

Code

Notes
  • read risk disclaimer
  • excuse my bad english