Send DHT11 data to PHP MySQL Server using NodeMCU ESP8266

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 มิ.ย. 2024
  • Today, I will show you how to send DHT11 data to MySQL Server. Then you can display temperature and humidity data on your own dashboard in real-time. I have just connect the DHT11 sensor to NodeMcu ESP8266. And after uploading the code, the NodeMCU start sending temperature and humidity data to MySQL Server.
    This is a NodeMcu based internet of things project. And you do not need to use any IOT cloud Platform. I will show you how to build cloud like platform using a PHP and MySQL Server.
    The dashboard of this project is very simple. I've added two gauge meters to display the real-time temperature and humidity data. You can also visualize all the latest data in tabular form. This project is just like having your own weather station dashboard and you can monitor your weather station readings, from anywhere in the world.
    --------------------------------------------------------------------------------------------------------------------
    Parts Buy Links (Affiliate Links)
    --------------------------------------------------------------------------------------------------------------------
    1. NODE MCU - amzn.to/3Zzm1bJ
    2. DHT11 Temperature Humidity Sensor - amzn.to/421TIUD
    3. Breadboard - amzn.to/3ysOvHX
    4. Jumper Wires - amzn.to/3YRafs5
    0:00 - Intro
    0:46 - Advantages of your own IOT Cloud
    1:45 - Project Code and Related Resources
    2:07 - Recommended Hosting for Weather Station Froject
    2:36 - Create a Subdamin
    3:35 - Crate MySQL Database
    4:32 - Uploading SQL file in Database
    5:07 - Upload Project Files to Web Server
    5:42 - Project Configuration
    7:34 - Testing Project with Fake Data
    8:07 - Wiring NodeMCU with DHT11
    8:32 - NodeMCU Sketch (Programming)
    9:04 - Arduino Serial Monitor Tesing
    9:17 - End Screen
    --------------------------------------------------------------------------------------------------------------------
    Useful Video Links
    --------------------------------------------------------------------------------------------------------------------
    NodeMCU SIM800L GPS Tracker
    • NodeMCU SIM800L GPS Tr...
    Arduino IOT Cloud Home Automation With ESP32 and NodeMCU
    • Arduino IoT Cloud Home...
    --------------------------------------------------------------------------------------------------------------------
    Social Media Links
    --------------------------------------------------------------------------------------------------------------------
    GitHub:
    github.com/ahmadlogs/
    TH-cam:
    th-cam.com/users/ahmadlogs?sub...
    --------------------------------------------------------------------------------------------------------------------
    Download Code
    --------------------------------------------------------------------------------------------------------------------
    github.com/ahmadlogs/nodemcu-...
    --------------------------------------------------------------------------------------------------------------------
    Disclaimer
    --------------------------------------------------------------------------------------------------------------------
    Disclaimer: All videos are for educational purposes and use them wisely. Any video may have a slight mistake, please take decisions based on your research. This video is not forcing anything on you.
    #NodeMCU #ESP8266 #ESP8266Projects

ความคิดเห็น • 107

  • @Lovely-bx8se
    @Lovely-bx8se 5 หลายเดือนก่อน +1

    Bonjour, Tous d'abord un grand merci pour ce tuto très complet précis accompagné en plus de l'ensemble des elements.Pour ce qui cherche, ne cherchez plus vous avez trouvé. J'avoue ne pas être un grand spécialiste et grâce a ce tuto j'ai put appliquer l'ensemble du projet ( avec un serveur LAMP ) sur un Raspberry.
    Merci !!!

  • @Lovely-bx8se
    @Lovely-bx8se 5 หลายเดือนก่อน

    Je me permets de revenir vers vous pour une question,peut on rajouter la fonction MQTT a ce projet?Merci de votre reponse

  • @TechTrendsShameer
    @TechTrendsShameer ปีที่แล้ว

    Hi Bro, How to change the maximum value in the gauge from 100 to any other higher value? Please help me.

  • @tariq4846
    @tariq4846 ปีที่แล้ว +1

    How to display multiple sensors data on same page?

  • @abdiqadirmohamednor6101
    @abdiqadirmohamednor6101 2 ปีที่แล้ว

    Thank you so much you helped me deeply

  • @shakerileiwat4341
    @shakerileiwat4341 2 ปีที่แล้ว

    Great project
    Thank you

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      Glad you like it!

  • @user-gm4lh9cl8t
    @user-gm4lh9cl8t 10 หลายเดือนก่อน

    thank you. so helpful vid

    • @AhmadLogs
      @AhmadLogs  9 หลายเดือนก่อน

      thanks

  • @Ahmadmehragohar
    @Ahmadmehragohar 2 ปีที่แล้ว

    very nice and professional best product

  • @kamalkamel7559
    @kamalkamel7559 2 ปีที่แล้ว

    very great project, how control devices, example relay and display temperature!!

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      It is possible. but it required some research.

  • @Lovely-bx8se
    @Lovely-bx8se หลายเดือนก่อน

    Bonjour, J'ai essaye d'adapter votre code pour un capteur DS18B20 mais les valeurs ne change pas elle m'indique 24 et 77.

  • @tamapra57
    @tamapra57 2 ปีที่แล้ว +1

    If you could explain each PHP file that'd be great since im a beginner. Thanks!

  • @rampage_xdit
    @rampage_xdit 2 ปีที่แล้ว

    You are the best

  • @TechnicalidEas07
    @TechnicalidEas07 2 ปีที่แล้ว +2

    Arduino or NodeMCU will have a push switch attached. When I press in that switch, the location will go to our mobile

  • @DiyintheGhetto
    @DiyintheGhetto ปีที่แล้ว

    Hello, What happens if you have multiple sensors on multiple esp866. How can I do that within mysql to store and display them?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว +1

      then lot of changes are required. both in the sketch as well as php myql code

    • @DiyintheGhetto
      @DiyintheGhetto ปีที่แล้ว

      @@AhmadLogs got you thank you.

  • @ahmedtaher4015
    @ahmedtaher4015 2 ปีที่แล้ว

    Verry nice

  • @amirtelecom6898
    @amirtelecom6898 2 ปีที่แล้ว

    Verry Nice ...
    Can this be used with SIM800l ?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      yes, it might be used

  • @rodiasgohoue6014
    @rodiasgohoue6014 2 ปีที่แล้ว

    thanks for this tuto

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      so nice of you

    • @rodiasgohoue6014
      @rodiasgohoue6014 2 ปีที่แล้ว

      @@AhmadLogs i really like this tuto .Actually im working on how to send data to laravel mysql. Have you an idea to how display data through gauge

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @Rodias Gohoue laravel is a php framework. you need to convert all the php code to laravel.
      To work with laravel you need to learn basics of this framework for
      1. inserting data in the database
      2. displaying it on the web page in a nice format.
      I have used Google Gauge in the tutorial. and you can use the same with laravel. the same code will work for laravel that I have used at the end of the index.php file. there is a tag. and all the code for gauge in available within the tag. this is a java script code and you can use JavaScript with any web based programming language and framework.

    • @rodiasgohoue6014
      @rodiasgohoue6014 2 ปีที่แล้ว

      @@AhmadLogs thanks . Im working on it

    • @rodiasgohoue6014
      @rodiasgohoue6014 2 ปีที่แล้ว

      it's work now thanks a lot

  • @virenrao82
    @virenrao82 ปีที่แล้ว

    monitor in showing http 200 code at nodemcu side, but data not available on php page.
    I am using infinity web hosting

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      there are just two free web hostings that work with the project. 000webhost, and AwardSpace

  • @TechTrendsShameer
    @TechTrendsShameer 2 ปีที่แล้ว

    Hi bro. How to change the color of the gauge in the output. I tried in the script, but the color goes to blank

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      I have used Google Gauge in this project. and the Google Gauge have limited colors only 3 red, green and blue.
      try this on line number 115 of index.php
      redColor: "rgba(198, 0, 0, 0.67)",

    • @TechTrendsShameer
      @TechTrendsShameer 2 ปีที่แล้ว

      @@AhmadLogs Ok bro. Thank you

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      @@TechTrendsShameer so nice of you

  • @annoorkhan4219
    @annoorkhan4219 ปีที่แล้ว

    Nice ,I tested your projects and it worked perfect but now I need to control few LED from web page, so what I have to do ?do I have to use mqtt broker?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      I pefer to suggest mqtt broker

  • @syaduinotech3681
    @syaduinotech3681 ปีที่แล้ว

    Thanks for sharing. I try already but fail to get the function. I am using personal website.. its so hard many creator using free..huhu. can you share video about own personal website. I try using randomnerdtutorial get the http code 300. Mind to help. Using the personal website. I did not know the host name.

  • @SAURABHKUMAR-py9or
    @SAURABHKUMAR-py9or 2 ปีที่แล้ว +1

    Hi bro
    I did everything like u said. Database is getting data if we try to add fake data through post_data_test.php and nodemcu is also sending data successfully as it's showing http code 400 on serial monitor but it is not saving in database of the website if we check in database.
    Can you tell me the reason?plz

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      http code 400 means the data is not sending successfully to the database. please post your full serial monitor output here.

    • @SAURABHKUMAR-py9or
      @SAURABHKUMAR-py9or 2 ปีที่แล้ว

      @@AhmadLogs Connecting...........Connected to WiFi network with IP Address: ***********Temperature: 31.30Humidity: 39.20--------------------------temperature_data: api_key=hello world&temperature=31.30&humidity=39.20HTTP Response code: 400

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      @@SAURABHKUMAR-py9or which web server you have used awardspace or any other

  • @user-oy1kq4ck8y
    @user-oy1kq4ck8y ปีที่แล้ว

    my serial monitor is not displaying anything

  • @rikinurfalakhi8943
    @rikinurfalakhi8943 ปีที่แล้ว

    i have followed your video and i found the https respone code is 400 not 200, what should i fix?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      it means the page you are requesting is not found. just make sure you have properly uploaded the php file on the webserver

  • @nonel7215
    @nonel7215 ปีที่แล้ว +1

    Thank you so much for this. I'm having issues with http.begin(client, SERVER_NAME); It gives error Compilation error: no matching function for call to 'HTTPClient::begin(WiFiClient&, const char*&)' I would appreciate if you can help

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว +1

      install the esp8266 core version 2.6.0 or lower

    • @nonel7215
      @nonel7215 ปีที่แล้ว

      @@AhmadLogs thank you so much!

    • @kaikyonojinbe6388
      @kaikyonojinbe6388 8 หลายเดือนก่อน

      @@AhmadLogs I also get the same error but my esp board is currently version 2.4.0 how to fix it?

  • @AITwo_co
    @AITwo_co 2 ปีที่แล้ว

    please make a video on going live with jazzcash payment gateway...

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      NOT POSSIBLE

  • @EasyOne
    @EasyOne 2 ปีที่แล้ว

    nice

  • @rodiasgohoue6014
    @rodiasgohoue6014 2 ปีที่แล้ว

    Ahmad logs plz help me. Im in trouble
    each time i tried to compile my code on esp8266 this error appear
    double free or corruption (out)
    signal: aborted
    Erreur de compilation pour la carte NodeMCU 0.9 (ESP-12 Module)
    do you know what this means?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      you just flash your esp device

    • @rodiasgohoue6014
      @rodiasgohoue6014 2 ปีที่แล้ว

      @@AhmadLogs oki thanks i'll try it
      Can you give me mail . i'll chat there if need . Thanks

    • @rodiasgohoue6014
      @rodiasgohoue6014 2 ปีที่แล้ว

      hello @@AhmadLogs

    • @rodiasgohoue6014
      @rodiasgohoue6014 2 ปีที่แล้ว

      @@AhmadLogs I need your help
      Did you ever use esp8266-01 ?I want ti know how connect it to php server

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@rodiasgohoue6014 Sorry I never used it before. there is a video on electronoobs channel in which he uses esp8266 for the same purpose

  • @user-om1sv1df1r
    @user-om1sv1df1r ปีที่แล้ว

    how to fix bad requests. response code 400. the file sensordata.php cant find HTTP request, btw im using hostinger as webhost

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      I thinks you did not upload the sensordata.php file at the correct location

  • @rodiladriangaryck6488
    @rodiladriangaryck6488 ปีที่แล้ว

    Can I use this code for esp32 as well?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      not

    • @jeromebla5835
      @jeromebla5835 9 หลายเดือนก่อน

      You have to modify it. I run it on a esp32 with DHT20

  • @bektinurwanto
    @bektinurwanto ปีที่แล้ว

    If using localhost, can i use api key?

  • @mailtorameshhr
    @mailtorameshhr 2 ปีที่แล้ว

    very nice project thank you and why it is giving error like #1226 - User '4071374_tempdb' has exceeded the 'max_connections_per_hour' resource (current value: 1500)

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      this is because you are using free web hosting. you can send 1500 request in an hour using this hosting. for getting more you need to buy a web hosting plan

    • @mailtorameshhr
      @mailtorameshhr 2 ปีที่แล้ว

      @@AhmadLogs thank you

    • @markludwig5805
      @markludwig5805 2 ปีที่แล้ว

      Great video...good stuff. I had the same problem. Awardspace shut down my free account due to abuse. Problem appears to be config.php line 18 according to awardspace. Is there a way to fix or reduce the number of connections/hr????

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@markludwig5805 you just need to buy premium plan.

  • @TechTrendsShameer
    @TechTrendsShameer 2 ปีที่แล้ว

    Good one bro. Shall I use your code for my videos? Any problem ?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      no problem. you might use. the code is free for all

    • @TechTrendsShameer
      @TechTrendsShameer 2 ปีที่แล้ว

      @@AhmadLogs thanks bro.

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@TechTrendsShameer you are welcome

  • @katkatia9255
    @katkatia9255 2 ปีที่แล้ว

    What can i modify if i use xamp ?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      I think you just need to change the URL. I mean change the website url to your locallhost project url. like localhost/your_project_name

  • @fakhriaidil3774
    @fakhriaidil3774 ปีที่แล้ว

    why when it try to run the post_data_test.php ....it come out with error 404 page...i follow all the instruction

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      If you are getting a 404 error when trying to run the post_data_test.php script, it means that the server is not able to locate the script at the specified location. Make sure that the file is located in the correct directory on the server.

  • @mbinacedric3566
    @mbinacedric3566 9 หลายเดือนก่อน

    Hi, i have a video topic for you!!!

  • @yashagrawal3539
    @yashagrawal3539 ปีที่แล้ว

    why am i getting the http 301 error? i have followed all the steps

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      which hosting service you are using?

    • @yashagrawal3539
      @yashagrawal3539 ปีที่แล้ว

      @@AhmadLogs thank you for the reply.
      i have my site on the hostinger platform

    • @l3nnyraw901
      @l3nnyraw901 ปีที่แล้ว

      Im getting the same HTTP code (301). It means that you have a wrong link or so. I host my project too with hostinger. but there is already a wordpress Webpage in my files. So I had to rename the index.php file (wehre the html code is in) to index2.php. So maybe this causes the HTTP Code 301. But I cant find the place in the project files wehre i can link to the index2.php file. /// The "post_data_test.php" makes an entry in the DataBase and works fine but the esp8266 creates no entries. so I cant find the issue.

  • @ahsanejaz1743
    @ahsanejaz1743 2 ปีที่แล้ว

    i will wait for your response

  • @joroxanborata3102
    @joroxanborata3102 ปีที่แล้ว

    sir is this working for hostinger cause my http code: -1

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      it must work

    • @persephone1571
      @persephone1571 ปีที่แล้ว

      @@AhmadLogs same but there are no changes on the index page

    • @persephone1571
      @persephone1571 ปีที่แล้ว

      @@AhmadLogs also can you help me send an email using php?

  • @POTTIVENKATASAICHARANBEC
    @POTTIVENKATASAICHARANBEC ปีที่แล้ว

    website is not working can u check it thanking you

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      I have tested it and it is working fine.

  • @TechnicalidEas07
    @TechnicalidEas07 2 ปีที่แล้ว

    Make GPS project
    GPS and push switch

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      give me some details

    • @TechnicalidEas07
      @TechnicalidEas07 2 ปีที่แล้ว

      Arduino or NodeMCU will have a push switch attached. When I press in that switch, the location will go to our Mobile 📲

  • @emojiit362
    @emojiit362 2 ปีที่แล้ว

    We need to talk Can you check your email?

  • @kiritochanel2351
    @kiritochanel2351 ปีที่แล้ว

    How to fix? : HTTP Response code: -1

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      this is the issue with the free web-hosting. but this is not more frequent issue if occurs time to time. if you buy a hosting plan then the issue will solved forever.

    • @nattanon_mixx3657
      @nattanon_mixx3657 ปีที่แล้ว

      i use localhost?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      @@nattanon_mixx3657 but I did not test it on local host. try http:localhost/yourproject
      http:127.0.0.1/yourproject. make sure not use https. (I am just talking about 's' in the https string)