Controlling Esp12E NodeMCU with LED from website using thingspeak from anywhere in the world

Teacher
Vivek Gupta
Vivek Gupta
Role : Writing free tutorials in free time
  • Website : http://vsgupta.in/
  • Experience : 5+ Years
  • Specialist in : IoT, NLP, Machine Learning, Chatbots, Voice Assistants, Hardware Engineering
Read More

Controlling Esp12E NodeMCU with LED from website using thingspeak from anywhere in the world(Part-2)

Control ESP12E from thingspeak using web page. This webpage will be made in html. And we will be using jquery to post the data on the thingspeak server from our HTML webpage. So lets get started. If you are seeing this tutorial directly then you can start from beginning here:

"Controlling Esp12E NodeMCU with LED from website using thingspeak from anywhere in the world"

In the "first part" we have already programmed our NODE MCU ESP12E module with the receiver code. Also , we had previously created a channel in thingspeak and tested it live. Now lets create the HTML page:

Follow the below instructions to create a webpage in HTML:

Open notepad ++ and copy the following code:

  1. We will first write the head code where we will define scripts and title:

2. Now we will create the body. Where we need one text box which will be used for the user to write the API of the thingspeak channel, 2 buttons for controlling each LED. One for on and other for off. So we will need total six buttons. And finally one more text box which will be used to show the activity by user. Like lights turned on, and off etc.

3. Finally put the script which will calls thingspeak rest api to update the channel feed for controlling the ESP12E.

Save the file as "Index.html".

Follow the below instructions for video instructions along with how to use the page to control ESP12E.

Now you have successfully controlled the Node MCU connected with three LED from a webpage using thingspeak as a server. Please subscribe to my youtube channel for more awesome tutorials.

Please login to get access to the quiz
Controlling Esp12E NodeMCU with LED from website using thingspeak from anywhere in the world(Part-1) (Prev Lesson)
Back to Controlling Esp12E NodeMCU with LED from website using thingspeak from anywhere in the world

Comments ( 15 )

  • Freddie

    I have to try this. Thanks

  • Akorede Saheed

    Thanks for this tutorial. I highly appreciate your time

    • Thank you for your appreciation. Please share this website with your friends. 🙂

  • Dheeraj saxena

    Good tutorial.Why there is delay, it should happened instantly?

  • Debanjan podder

    i have not understood the html script part….can u explain?

    • hi debanjan, Can you please be specific what part of video you did not understand? Let me know I will try to explain.

      • Debanjan

        i am talking about the html code…the script part

  • hello. help me please. if i want to show time/date on database when i touch on button led1 on website. i dont’ know do it

    • Duy, when you are updating data in the mysql db, you can post time stamp. While calling the function to turn the button on, you can also update the timestamp in the database. You can retrieve it using the get request.

  • Akhil Mehta

    Hey, Such an interesting project to work on. Thanks for the detailed explanation.
    Just wanted to ask, How secured is our data when there is a link between HTML web page and ThingSpeak?
    If Less, Can you provide some other alternative?

    • Hi Akhil,
      Please see that whatever tutorial I made is only for learning purpose. It is not at all secured. For having a secured end to end connection you have to use end to end encryption supported by unique ID and password of IoT devices. I will suggest you to start of with google firebase if you are using esp8266. Also in long term if you are looking to learn production grade IoT development, start off with the Particle photon device. Its fully production ready, supports encryption and is purely IoT based device.

  • Akhil Mehta

    Hey,
    I tried doing this project. When I upload the code, the LED starts blinking on its own. And when I press the off button, it’s not getting turned off.
    Can you help me with this?

    • Akhil Mehta

      Also LED is flickering randomly? Can you please provide a solution?

Post a Reply