How to send DHT11 data to MySQL server using NodeMCU

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • Hello Guys,
    In this Project I've interfaced DHT11 with nodemcu and then I'm sending data of dht11 which is humidity and temperature to phpmyadmin database.
    if you want to know about how to install xampp server and create database and table in phpmyadmin, please watch this video:
    • Sending Temperature an...
    You can buy tools from amazon India, below are the links:
    Generic ESP8266 Nodemcu Esp8266: amzn.to/2KVIhZi
    Arduino Uno link in amazon: amzn.to/2yYpcyT
    Ethernet Shield link in amazon: amzn.to/2KyTn6i
    DHT11 link in amazon: amzn.to/2z0awiB
    you can get the source code from this link:
    github.com/Emb...
    FB; / embedotronics

Комментарии • 121

  • @eccomusic1386
    @eccomusic1386 3 года назад +1

    To be honest, at first, I did not understand any of this. Until I tried to use the code from github. All these things worked so perfectly. I used this in my project to send read voltage from a 12V battery using my ESP8266 D1 Mini and let it calculate the state of charge (SoC) and the depth of discharge (DoD). Yes I know, the max voltage read cap of the microcontroller is only 3.3V, I used a voltage divider :)
    And now, my problem is how to display these on a web page. HAHAHA
    I will do some more research.
    Thank you again for this very helpful tutorial sir! God bless you more and more!

  • @amarendraranade4099
    @amarendraranade4099 3 года назад

    Thanks for helpful viddeo. Can you pls tell me why my PHP is not running, though connection with local pc is successful ? My PHP file is supposed to create a .txt file. Ive put my PHP in htdocs. Should I make changes in my GET command. I am stuck.

  • @_MohamadRakaWirakesuma-uu2ux
    @_MohamadRakaWirakesuma-uu2ux 2 года назад +1

    why my code not work? same code like yours. local ip show different in serial monitor and in esp code?

  • @suvashishdas7739
    @suvashishdas7739 3 года назад

    I like to connect weight scale indicator and get out in url. Please advice

  • @smrutipragnyadash2143
    @smrutipragnyadash2143 4 года назад +1

    Thank you so much.. i just love your video.. it's just awesome.. keep doing videos like this 😍😍

  • @muathlahlabat
    @muathlahlabat 4 года назад

    i have esp8266 module how to connect it with arduino uno to try ur project?
    thank for ur amazing videos

  • @carlitoespinosa5449
    @carlitoespinosa5449 4 года назад

    sir in your arduino code you set a variable humidityData, how come in your php code you only use humidity? How can it connect sir?

  • @lalosanchez2672
    @lalosanchez2672 4 года назад +1

    thank you so mucho..... ¿How could you send the logs to an external server?

  • @razi_kr
    @razi_kr 3 года назад

    What if I am using micro-python. Is there any way to push the values to the sql database.

  • @arslanishtiaq9322
    @arslanishtiaq9322 2 года назад

    what is MFRC522 and purpose of including?

  • @suster1983
    @suster1983 3 года назад +2

    hi sir, my esp8266 is connected to local server, and I can write manually in the browser to insert the database. But, my esp8266 is not updating the database. Even I allow all the access through firewall, still not updating. anyone has the solution?

    • @YPTechDATIA
      @YPTechDATIA 2 года назад

      exact same problem i am having

  • @AdityaPratama-kh4xt
    @AdityaPratama-kh4xt 4 года назад

    thank you for your tutorial sir, it's helpful my work
    i have a question can i use the same code for online webserver?
    thanks..

  • @andremurilobr
    @andremurilobr 3 года назад

    Hi Sr How to make this on external website? Can you please tell us how could us updating MySQL in cPanel and refresh website automacticaly?

  • @vandhanabharghavi8396
    @vandhanabharghavi8396 3 года назад

    Sir what is that we need to put in the local ip here ? i tried puttng the ipv4 address from ipconfig but its not working

  • @harshivthakkar5734
    @harshivthakkar5734 3 года назад

    Can we use another backend instead of php ?

  • @J3zp3rs
    @J3zp3rs 4 года назад +1

    Hello sir! i get: Errant query: insert into DHT11 set humidity='70', temperature='35' when im trying the php. It works with my local server but not with my live server plz help me

  • @raghavgoel2178
    @raghavgoel2178 4 года назад

    is ie necesssary to buy arduino uno and ethernet shield??
    we only requore nodemcu and dht11 sensor

    • @embedotronics
      @embedotronics  4 года назад

      here I've used nodemcu and dht11 sensor only

    • @raghavgoel2178
      @raghavgoel2178 4 года назад

      @@embedotronics okk thank you sir

    • @raghavgoel2178
      @raghavgoel2178 4 года назад

      @@embedotronics Sir can you suggest some more sensors that can be connected directly to nodemcu and their data can be send to sqL database similarly.

  • @joseluiscabrera8375
    @joseluiscabrera8375 3 года назад +1

    Very thanks for all...... but please ¡¡ Transcripcions !!! (Sub-titles in English, please. ) is it possible ??

  • @ineffableseul
    @ineffableseul 4 года назад

    sir what is the range of the sensor and node mcu?? as long as there is wifi??? thanks

    • @YPTechDATIA
      @YPTechDATIA 2 года назад

      If you use it without antenna , it works good for 5 - 6 m , and with antenna 10m 12 m

  • @jackwei5566
    @jackwei5566 5 лет назад +2

    thank you sir! Really useful!!!

  • @YPTechDATIA
    @YPTechDATIA 2 года назад

    every thing is running fine , but it is unable to send data to table.. i tested php script manually and it is working, i can see data on serial monitor , but not reflecting in database

    • @embedotronics
      @embedotronics  2 года назад

      what error you are getting

    • @YPTechDATIA
      @YPTechDATIA 2 года назад

      @@embedotronics problem has been solved after some minor edits in code , thank you

    • @fakhrulhaikal6375
      @fakhrulhaikal6375 2 года назад

      @@YPTechDATIA hello sir can i ask what the edit code. Really appreciate it

    • @YPTechDATIA
      @YPTechDATIA 2 года назад

      @@fakhrulhaikal6375 I will upload a detail video on it , so I request you to follow my channel . Thank you

  • @VishalKumar-uu1db
    @VishalKumar-uu1db 5 лет назад

    I followed all the steps, but still unable to get data on myphladmin page from nodemcu.
    Is there any additional php file to read the data from nodemcu

    • @embedotronics
      @embedotronics  5 лет назад

      Yes php file will be there, when you will install xampp there in htdocs folder that file you need to save and make a GET request to that file from your arduino code.

  • @riahiyassine7703
    @riahiyassine7703 4 года назад

    THANKS VERY LOT FOR URE GOOD EXPLAIN AND I HOPE THAT YOU KEEP UP

    • @embedotronics
      @embedotronics  4 года назад

      yeah I'll keep posting such interesting projects.

  • @MSuriyaPrakaashJL
    @MSuriyaPrakaashJL 4 года назад

    Hii, I cant get the data to be updated on myphpadmin eventhough in serial monitor its showing that it is connected. I studied PHP, So i created my own php files and it worked when i tested it. But when I use arduino its not getting updated. Can you tell how to make a connection between arduino and server(local host)?

    • @MSuriyaPrakaashJL
      @MSuriyaPrakaashJL 3 года назад

      @Wan Muhammad Irsyaduddin Bin Wan Zohal see it's possible. I think u have to view all the variables used and see if u had used the correct one. See if the data in variable is correct. See many tutorials and u will complete it
      All the best...
      I had completed it but I forgot what difference I made. Sorry

    • @marlonocsan5972
      @marlonocsan5972 3 года назад

      Hello, I've been experiencing the same with yours. my table is not updating. could you give me a copy of your php file?

  • @widcoshop
    @widcoshop 4 года назад

    hi how are you?can you make it with stm32?

  • @adrinovanda5903
    @adrinovanda5903 4 года назад

    Sir can you make tutorial to send the sensor data in my SQL to app inventor?

  • @ganesanjan
    @ganesanjan Год назад

    Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.0.25 Server at localhost Port 80
    that show i to me my browser what i do

  • @rodamps7321
    @rodamps7321 3 года назад

    Amazing!, ok.
    Please, I would like to, as soon as, I receive nodemcu data, show on the server, screens in html, js, or in php, as messages, images, or pages, referring to the given data. Thank you.

  • @raghavgoel2178
    @raghavgoel2178 4 года назад

    sir can you please list the components required all the components!

  • @kcreations5478
    @kcreations5478 Год назад

    Bro my nodemcu is not sending the http request and giving response code -1 please help me

  • @nuradibahzolkepli5223
    @nuradibahzolkepli5223 5 лет назад

    Hi sir. I tried this project but I can't connect to the database. From the serial monitor, it shows "connection failed". I already tried turn off the firewall but it is still the same. Did you know why I can't connect to the database?

    • @mstfsr
      @mstfsr 4 года назад

      i reaaly wonder this issue

  • @durohhidayah4151
    @durohhidayah4151 3 года назад

    Thank you so much sir .

  • @mokarrom_z2
    @mokarrom_z2 4 года назад

    node MCU connection with DHT11 is not clear to me and is Arduino Uno needed to connect to a sound sensor if I use one ?

    • @embedotronics
      @embedotronics  4 года назад +1

      you can check our instructables link for more details.
      www.instructables.com/id/How-to-Send-DHT11-Data-to-MySQL-Server-Using-NodeM/
      And this is nodemcu if you want to use arduino then you need Ethernet shield for internet services

    • @mokarrom_z2
      @mokarrom_z2 4 года назад

      @@embedotronics thank you for your responses.#connectionfailed is showing. can't figure out the error.here is the code below
      /* This arduino code is sending data to mysql server every 30 seconds.
      Created By Embedotronics Technologies*/
      #include
      #include
      #include
      #include
      const int MIC = 0; //the microphone amplifier output is connected to pin A0
      int adc;
      int dB; //the variable that will hold the value read from the microphone each time
      const char* ssid = "baggu";//
      const char* password = "nopasswordforu7849";
      //WiFiClient client;
      char server[] = " 192.168.0.102"; //eg: 192.168.0.222
      WiFiClient client;
      void setup()
      {
      Serial.begin(115200);
      pinMode(A0, INPUT);
      // Connect to WiFi network
      Serial.println();
      Serial.println();
      Serial.print("Connecting to ");
      Serial.println(ssid);

      WiFi.begin(ssid, password);

      while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
      }
      Serial.println("");
      Serial.println("WiFi connected");

      // Start the server
      //server.begin();
      Serial.println("Server started");
      Serial.print(WiFi.localIP());
      delay(1000);
      Serial.println("connecting...");
      }
      void loop(){

      adc = analogRead(MIC); //Read the ADC value from MIC
      dB = (adc + 83.2073) / 11.003; //Convert ADC value to dB using Regression values
      //Serial.print("Sound Level--");
      //Serial.print(dB);
      //Serial.print(",");
      //Serial.println(" dB");
      //delay(100);
      Sending_To_phpmyadmindatabase();
      delay(30000); // interval
      }
      void Sending_To_phpmyadmindatabase() //CONNECTING WITH MYSQL
      {
      if (client.connect(server, 80)) {
      Serial.println("connected");
      // Make a HTTP request:
      Serial.print("GET /testcode/lm.php?sound=");
      client.print("GET /testcode/lm.php?sound="); //YOUR URL
      Serial.println(dB);
      client.print(dB);
      client.print(" "); //SPACE BEFORE HTTP/1.1
      client.print("HTTP/1.1");
      client.println();
      client.println("Host: 192.168.0.102");
      client.println("Connection: close");
      client.println();
      } else {
      // if you didn't get a connection to the server:
      Serial.println("connection failed");
      }
      }

    • @shovitprusty4050
      @shovitprusty4050 2 года назад

      @@mokarrom_z2 did you solved this error because i m also getting this

    • @mokarrom_z2
      @mokarrom_z2 2 года назад

      @@shovitprusty4050 sadly no

  • @teurejonism8531
    @teurejonism8531 3 года назад +1

    Warning: Undefined array key "temperature" in C:\xampp\htdocs\temperature\dht.php on line 20
    please help me

    • @arghyamitra3322
      @arghyamitra3322 3 года назад +1

      i'm also getting same error. Please help...

  • @TopChannel-gj7cc
    @TopChannel-gj7cc 3 года назад

    Thank you so much

  • @boniekandrear761
    @boniekandrear761 Год назад

    Excuse me, sir, can I have the data base?

  • @sivarajsr4292
    @sivarajsr4292 4 года назад

    Please Upload video about Arduino Uno with ESP 01 Send data to mysql

  • @kenpaul8269
    @kenpaul8269 4 года назад

    Sir how to send data continuously?

  • @vishadhgayantha2431
    @vishadhgayantha2431 4 года назад

    I receive data in serial monitor but there is no data in database and local ip and codes are ok... what is the solution?... please help

  • @rohithpalakurthi1135
    @rohithpalakurthi1135 4 года назад +1

    I just copied your code as it is, it is getting connected to database but data not getting updated or data is not getting transmitted

    • @embedotronics
      @embedotronics  4 года назад

      Did you put your local IP?

    • @rohithpalakurthi1135
      @rohithpalakurthi1135 4 года назад

      @@embedotronics yes, I did it. it is connecting to the database but not updating the data I also checked it by refreshing. Thanks for replying.

    • @light_of_the_earth
      @light_of_the_earth 4 года назад +2

      @@rohithpalakurthi1135 I am facing the same problem. Data is shown in the serial monitor, but not update my PHPMyAdmin MySQL database. Did you find any remedies?

  • @muhammadfaizannisar955
    @muhammadfaizannisar955 5 лет назад +2

    thanks, but where is the arduino code
    ???

    • @embedotronics
      @embedotronics  5 лет назад

      You can get the source code from video description 👍

    • @doaaal-sehail3168
      @doaaal-sehail3168 4 года назад

      hello sear did you get the code ?

  • @marlonocsan5972
    @marlonocsan5972 3 года назад

    Hi. I've been receiving this error when I run the code
    MFRC522.h: No such file or directory
    help me pls

    • @alisyifa9623
      @alisyifa9623 3 года назад

      Add mfrc522 library to ur project

  • @7.jael_
    @7.jael_ 4 года назад

    hi sir, will you be generous enough to give the source code of the original one? the one with the rfid thing.... I would be forever grateful if you happen to give it to me.. thanks and more power for this channel

  • @milanthummar1409
    @milanthummar1409 4 года назад

    every time code is successfully upload but temperature and humidity value found Nan.
    please help me.

  • @eswarkrishnamaganti6409
    @eswarkrishnamaganti6409 4 года назад

    what can i put as my local ip

    • @embedotronics
      @embedotronics  4 года назад +1

      if you are in windows just write in command prompt "ipconfig" then IPv4 will be your local IP

  • @rjcapiral7415
    @rjcapiral7415 2 года назад

    Displaying Connection Failed :(

  • @shadowai8458
    @shadowai8458 4 года назад

    Why i connecting failed in arduino

  • @OmKumbhar-hc1xq
    @OmKumbhar-hc1xq 2 года назад

    connection failed error displaying can someone pls helpp

  • @SergioEstebanRomero
    @SergioEstebanRomero 4 года назад

    connected
    Get /testcode)dht.php? humidity=Nan& temperature=nan
    This is the output in monitor serie
    Help me please

    • @embedotronics
      @embedotronics  4 года назад

      nan means not a number, I think your connection was not correct that's why you are getting this error.

  • @subhadeepbardhan7031
    @subhadeepbardhan7031 4 года назад

    what if my system ip is dynamic?

    • @embedotronics
      @embedotronics  4 года назад

      you can do a port forwarding on router and make your IP publicly accessible

  • @bigmama668
    @bigmama668 3 года назад

    it doesnt work

  • @visweshwaran2231
    @visweshwaran2231 4 года назад +1

    Hii!!! I receive data in serial monitor but there is no data in database... what is the solution?... please help
    ...

    • @livelife9353
      @livelife9353 4 года назад

      same here

    • @ezrafebiola5227
      @ezrafebiola5227 4 года назад

      Put your local ip in the code like this
      client.println("Host: 192.......")

    • @issamaz2636
      @issamaz2636 4 года назад

      The same problem there are no data in DB ...who can resolve this problem..

    • @kenpaul8269
      @kenpaul8269 4 года назад

      Same here

    • @vishadhgayantha2431
      @vishadhgayantha2431 4 года назад

      Does anyone know the solution to this problem?

  • @pabitrakumarghorai7623
    @pabitrakumarghorai7623 4 года назад

    Why it shows connection lost

    • @embedotronics
      @embedotronics  4 года назад +1

      if nodemcu is properly connected it should not shows connection lost, may be this is due to internet connectivity 👍👍