Introduction: How to Send DHT11 Data to MySQL Server Using NodeMCU

About: Hi all, I'm Pawan Joshi who works on embedded system and IoT. I'm really passionate about embedded system and IoT. Here through this page you will come to know about embedded system from scratch to the latest …

In this Project we've interfaced DHT11 with nodemcu and then we're sending data of dht11 which is humidity and temperature to phpmyadmin database.

Step 1: Software Used:

1. Arduino IDE: As for nodemcu we are using arduino IDE only.You can download the latest Arduino IDE from this link:

Now how to configure nodemcu to arduino IDE, we will tell you that thing in below steps.

2. Installation of XAMPP server: Here we are using XAMPP server it can be used both in windows and Linux, but my suggestion is that if you are in Ubuntu( Any Linux platform) then go with LAMP. Now since we are in windows so we have preferred XAMPP server. So you can download XAMPP server from this link.
Alternatively here are the steps for LAMP server:

1. Install Apache

sudo apt-get install apache2

2. Install MySQL:

sudo apt-get install mysql-server

3. Install PHP:

sudo apt-get install php5 libapache2-mod-php5

4. Restart Server:

sudo /etc/init.d/apache2 restart

5. Check Apache http://localhost/

you will get one apache page by click this above link if you did not get it means something went wrong with your installation

Here we are using PHPMYADMIN that is the web interface of MySQL server so for installing that use command:

sudo apt-get install phpmyadmin

Step 2: Components Used:

1) Node MCU V3 : Node MCU is an open source IOT platform. It includes firmware which runs on the ESP8266 Wi- Fi SoC from hardware which is based on the ESP-12 module. The term "Node MCU" by default refers to the firmware rather than the dev kits.

2) DHT11 sensor: This DHT11 Temperature and Humidity Sensor features a calibrated digital signal output with the temperature and humidity sensor capability. It is integrated with a high-performance 8-bit microcontroller. Its technology ensures the high reliability and excellent long-term stability. This sensor includes a resistive element and a sensor for wet NTC temperature measuring devices. It has excellent quality, fast response, anti-interference ability and high performance.

Step 3: How to Configure Nodemcu in Arduino IDE

Below are the steps to configure nodemcu in arduino IDE

Above I1,I2 and I3 images are there for reference which we will use for our references to make you understand

Step1: First you need to open the Arduino IDE.

Step2: Now click on preferences tab like I1 image. Now you need to copy one URL in the additional board manager. Here is the URL- then click ok

Step 3: Now go to the Tools then select Board Manager. you will get one window like I2.

Just Scroll down on that window and search for esp8266 by ESP8266 Community or you can directly search esp8266 by typing on the search option, now click on install button.

Step4: Restart your Arduino IDE

Step5: Now go to Tools then Select your nodemcu device as we have shown in I3 image

Step 4: Circuit Diagram:

Step 5: Code:

You can get the source code from our Github Link

Step 6: Video:

The whole Project Description is given in above video

If you have any doubt regarding this project feel free to comment us below. And if you want to learn more about embedded system you can visit our youtube channel

Please visit and like our Facebook Page for frequent updates.

Thanks & Regards,

Embedotronics Technologies