Close Menu
Circuit of Things
  • Home
  • About Us
  • Contact Us
  • 3D Print
  • Shop Now !
  • Projects
    • Raspberry Pi Projects
    • Arduino Projects
    • ESP8266 Projects
    • ESP32 Projects
    • IoT Tutorials
    • Sensors & Modules
    • IoT Basics
  • KSP Tools

Get Free Tutorials & Discounts!

Subscribe for the latest IoT tutorials and exclusive KSP Electronics discount codes.

Instagram WhatsApp
  • Terms and Conditions
  • Disclaimer
  • Privacy Policy
  • Contact Us
Circuit of Things Circuit of Things
  • Home
  • About Us
  • Contact Us
  • 3D Print
  • Shop Now !
  • Projects
    • Raspberry Pi Projects
    • Arduino Projects
    • ESP8266 Projects
    • ESP32 Projects
    • IoT Tutorials
    • Sensors & Modules
    • IoT Basics
  • KSP Tools
Hire us
Circuit of Things
Home»ESP8266 Projects»NodeMCU ESP8266 Sensor Data to ThingSpeak IoT Platform
ESP8266 Projects

NodeMCU ESP8266 Sensor Data to ThingSpeak IoT Platform

Sai Preetham KoyyalaBy Sai Preetham KoyyalaMay 4, 2026Updated:May 7, 2026No Comments2 Mins Read
Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
Share
Facebook Twitter LinkedIn Pinterest Email
Contents
  • Introduction
  • Components Needed
  • Step 1: Create ThingSpeak Channel
  • Install Libraries
  • The Code
  • Viewing Your Dashboard
  • Conclusion

Introduction

ThingSpeak is a free IoT analytics platform by MathWorks that lets you collect, visualize, and analyze sensor data from your microcontrollers. In this tutorial, we connect an ESP8266 NodeMCU to ThingSpeak and create a live temperature and humidity dashboard visible from anywhere in the world.

Components Needed

  • ESP8266 NodeMCU
  • DHT11 or DHT22 sensor
  • Free ThingSpeak account (thingspeak.com)

Step 1: Create ThingSpeak Channel

  1. Sign up at thingspeak.com.
  2. Click New Channel and create two fields: Field 1 = Temperature, Field 2 = Humidity.
  3. Save and note your Write API Key from the API Keys tab.

Install Libraries

Install ThingSpeak by MathWorks and DHT sensor library by Adafruit via the Library Manager.

The Code

#include <ESP8266WiFi.h>
#include <ThingSpeak.h>
#include <DHT.h>
#define DHTPIN D4
#define DHTTYPE DHT11
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
const char* apiKey = "YOUR_THINGSPEAK_WRITE_API_KEY";
unsigned long channelID = 1234567; // Your channel ID
WiFiClient client;
DHT dht(DHTPIN, DHTTYPE);
void setup() {
  Serial.begin(115200);
  dht.begin();
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) delay(500);
  ThingSpeak.begin(client);
  Serial.println("Connected!");
}
void loop() {
  float t = dht.readTemperature();
  float h = dht.readHumidity();
  if (!isnan(t) && !isnan(h)) {
    ThingSpeak.setField(1, t);
    ThingSpeak.setField(2, h);
    int code = ThingSpeak.writeFields(channelID, apiKey);
    Serial.println(code == 200 ? "Data sent!" : "Error: " + String(code));
  }
  delay(20000); // ThingSpeak requires min 15s between updates
}

Viewing Your Dashboard

Go to your ThingSpeak channel and click the Private View tab. You will see beautiful auto-updating charts for temperature and humidity!

Conclusion

ThingSpeak is one of the fastest ways to get an IoT cloud dashboard up and running. With its built-in MATLAB analytics, you can also set alerts, perform calculations, and export data for machine learning projects.

Related Tutorials

  • ESP32 MQTT Tutorial: Publish and Subscribe with HiveMQ
  • ESP8266 NodeMCU Web Server: Control LEDs from Any Browser
  • ESP8266-01 Pinout: A Comprehensive Guide to Pin Configuration
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleESP32 Firebase Realtime Database: Send and Receive Data from the Cloud
Next Article Relay Module with Arduino: Control High Voltage Appliances Safely
Sai Preetham Koyyala
  • Website
  • Facebook
  • X (Twitter)
  • Instagram
  • LinkedIn

Hello, I am Sai Preetham Koyyala. I'm an electronics engineer by profession, a DIY enthusiast by passion. ESP32 and Arduino are the main topics of my work.

Related Posts

ESP8266 Projects

Choosing the Right Microcontroller: ESP32 vs. ESP8266 Comparison

May 6, 2026
IoT Tutorials

How to Build a DIY Robotic Hand using Flex Sensors and Arduino

May 6, 2026
IoT Tutorials

How to Build a DIY Robotic Hand using Flex Sensors and Arduino

May 6, 2026
Add A Comment
Leave A Reply Cancel Reply


⚡

Circuit of Things

Free IoT tutorials & electronics projects — powered by KSP Electronics.

📸 Instagram 💬 Community
✓ Official Partner Store

Everything for Your
Next IoT Build

Boards, sensors, modules & kits — fast delivery across India.

ESP32 Arduino Sensors Raspberry Pi 3D Print
🛒 Shop KSP Electronics →
Top Posts

Raspberry Pi: How to Control a DC Motor with L298N and PWN on a Web Server

July 14, 2023

Step-by-Step Guide: Interface DHT11 and DHT22 Sensors with ESP32

May 6, 2026

Esp8266 / NodeMCU Pinout: A Comprehensive Guide for Beginners

June 25, 2023
Available for Projects

Hire Us for IoT Development

End-to-end solutions for your needs:

  • → ESP32 & Embedded Systems
  • → LoRaWAN & Cloud Dashboards
  • → Custom Hardware Design
  • → IoT Product Prototyping
View Services →

Get Free Tutorials & Discounts!

Subscribe to get the latest IoT tutorials and exclusive hardware discount codes for KSP Electronics delivered directly to your inbox.

Follow Us
  • Instagram
  • Telegram
About Circuit of Things

We are a community-driven engineering platform dedicated to IoT, Robotics, and DIY electronics tutorials.

Proudly partnered with KSP Electronics.

Quick Links
  • Home
  • ESP32 Projects
  • Arduino Projects
  • IoT Tutorials
  • Sensors & Modules
  • Shop on KSP Electronics
  • Electro Calc
Legal & Support
  • Terms and Conditions
  • Disclaimer
  • Privacy Policy
  • Contact Us
📩

Get Free Tutorials & Discounts!

Subscribe for IoT tutorials and exclusive KSP discount codes.

Subscription Form


By subscribing, you agree to our Privacy Policy. No spam, ever.

X (Twitter) Instagram YouTube WhatsApp
  • Terms and Conditions
  • Disclaimer
  • Privacy Policy
  • Contact Us
© 2026 Circuit of Things. Designed by Sai Preetham Koyyala.

Type above and press Enter to search. Press Esc to cancel.