Aarush Sood
Published © GPL3+

Control LED with esp8266 and ThingSpeak server

Here I'm building basic led on/off circuit which can be controlled using a mobile application through ThingSpeak server.

BeginnerProtip2 hours6,058

Things used in this project

Hardware components

LED (generic)
LED (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

ThingSpeak API
ThingSpeak API
MIT App Inventor 2
MIT App Inventor 2

Story

Read more

Schematics

Circuit

Code

LED ON/OFF WITH ESP8266

C/C++
You can refer the code below,don't forget to add the specific channel id and API key!!!
#include <ThingSpeak.h>               // add librery
#include <ESP8266WiFi.h>

WiFiClient  client;
unsigned long counterChannelNumber = 1446902;                // Channel ID
const char * myCounterReadAPIKey = "706NXHEFFEG98JF4";      // Read API Key
const int FieldNumber1 = 1;                                 // The field you wish to read
const int FieldNumber2 = 2;                                 // The field you wish to read

void setup()
{
  pinMode(13,OUTPUT);
  Serial.begin(115200);
  Serial.println();

  WiFi.begin("wifi name", "password");           // write wifi name & password           

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();
  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
  ThingSpeak.begin(client);
}

void loop() 
{
 int A = ThingSpeak.readLongField(counterChannelNumber, FieldNumber1, myCounterReadAPIKey);
 Serial.println(A);
 digitalWrite(13,A);
}

Credits

Aarush Sood
5 projects • 10 followers
Technology enthusiast , ECE graduate from India. An electronics hobbyist who loves working with arduino's and esp's.
Contact

Comments

Please log in or sign up to comment.