Creating your own IoT Cloud from scratch using php, Mysql, ESP12E

Creating your own IoT Cloud from scratch using php, Mysql, ESP12E – Part 4

Introduction:

In this tutorial, we will be Creating your own IoT Cloud from scratch using php, Mysql, ESP12E. This is part 4 of tutorial series. If you are seeing this tutorial directly then I will recommend you to read the Introduction of this tutorial first.

So in part 4 of "Creating your own IoT Cloud from scratch using php, Mysql, ESP12E", we will be controlling three led connected to our esp12e or nodemcu module through an HTML webpage. We will be scripting in javascript and also we will be using css for our HTML page. In the part 2 of tutorial, we have already created the api's to control led. We are not going to consume those api's to control our esp12e or nodemcu module.

Circuit Diagram and Breadboard Image

So start of by making the circuit on the breadboard. Refer the below image for reference.

 

Video

Now watch the below video. I have given step by step instructions in the video:

Code

PHP Api Code

Copy the below code and replace it in the "read_all.php" file which we created on our webhost server.

Arduino Code

Copy the below arduino code and program your esp12e or nodemcu with it. Make sure that you replace the wifi username, password and the webhost url.

 

HTML Code

Copy the below code and paste it in a notepad++ file, and save it as 'index.html'. Make sure that you have replaced webhost url in the code.

Support me by subscribing to my YouTube channel by hitting the below button.

youtube-iotmonk-subscribe

Please login to get access to the quiz
Creating your own IoT Cloud from scratch using php, Mysql, ESP12E – Part 3 (Prev Lesson)
Back to Creating your own IoT Cloud from scratch using php, Mysql, ESP12E

Comments ( 28 )

  • Ovan

    Hi, your tutorial is great and detailed. I have perfectly done it. And i have a question. Can the weather and led Arduino code combine together to become one and send to the ESP-12E to work it?

    • Offcourse you can do it.

  • Md Nirob

    Please extend this tutorial about showing JSON data in chart format. Pls…..

    • I am planning to. But watch my latest video. I am also introducing machine learning.

  • Amirul

    hi, thank you for your great tutorial, its really helpful ! i have a request, can you please make a similar tutorial for iot attendance system using rfid?

    • I think I responded on my youtube channel. 🙂

  • Hakan Tutkun

    Hi ! Firstly, thanks for great tutorials. I got this error while I was trying,

    “parseObject() failed”

    What can cause this error ?

  • Alenth

    hi, your tutorial was helpful..but i got a problem while parsing string and showed the message

    parseObject() failed

    can you help me please?

      • Edwin Abraham Thomas

        I am having the same issue please help me
        The api is workind with posan

        • Edwin Abraham Thomas

          Sorry,
          I meant that the api was working on postman

          • Please check the arduino code again then.

        • Please check the arduino code again then.

  • Deni sugiarto

    hi i get problem. r u can help me? i run webserver locally with MYSQL version Server version: 5.5.39.
    This is result from serial monitor:

    Connecting to Wifi Warga
    ………….
    WiFi connected
    IP address:
    192.168.1.111
    Netmask: 255.255.255.0
    Gateway: 192.168.1.1
    connecting to 192.168.1.102
    Here1
    Requesting URL: /api/led/read_all.php?id=1

    closing connection
    connecting to 192.168.1.102
    Here2
    Requesting URL: /api/led/read_all.php?id=2

    closing connection
    connecting to 192.168.1.102
    Here3
    Requesting URL: /api/led/read_all.php?id=3

    closing connection
    connecting to 192.168.1.102
    Requesting URL: /api/led/read_all.php?id=3

    closing connection.

    led nothing happen when value is on.

  • Satyam singh

    Hello sir, is it possible to show Hardware (NodeMcu) online/offline status when client drop their internet connection or shutdown?

    • Yes, You have to write a server code probably in nodejs which will continuously check the last updated data. Let’s say if your device has not send data or not done any handshake for lets say 1 minute, then you can show the status as offline.

  • Mark

    Hi.. i got a problem.when iam pressing the button from my webpage it was updating on my database,tried with postman tool also but..my led is not responding accordingly.please provide some suggestion sir.

    • Please check your arduino code. If it is updating the database on button press, then the server code is working fine.

  • Shashank Sekhar

    I need a better understanding of how to take data in a database from a localhost server to the NodeMcu board.Can you please help me out? Please add your E-mail so that I can explain to you my problem in details.

    • Sorry Shashank, This is custom project, and I don’t do custom requests until there are lot of request for same topic. Hope you understand. Happy learning 🙂

  • Ravi

    Your video is super and I am inspired and have come with an idea Could you do a custom project for me

    • Thanks Ravi. I am glad that my tutorials are useful for you. Please read the “terms of use” http://iotmonk.com/terms-of-use/ of this website. I cannot do custom request or custom projects until there are lot of requests coming for same project.

  • Ravi

    Your video is super and I am inspired by your teaching and have come with an idea Could you do a custom project for me

    • Thanks Ravi. I am glad that my tutorials are useful for you. Please read the “terms of use” http://iotmonk.com/terms-of-use/ of this website. I cannot do custom request or custom projects until there are lot of requests coming for same project.

  • SickWorm

    Thanks fot tutorial is wery useful. But im interest how to put files in api folder behind protected folder with username and pass… To get more protection of data information?

Post a Reply