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
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!
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.
why my code not work? same code like yours. local ip show different in serial monitor and in esp code?
I like to connect weight scale indicator and get out in url. Please advice
Thank you so much.. i just love your video.. it's just awesome.. keep doing videos like this 😍😍
i have esp8266 module how to connect it with arduino uno to try ur project?
thank for ur amazing videos
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?
thank you so mucho..... ¿How could you send the logs to an external server?
What if I am using micro-python. Is there any way to push the values to the sql database.
what is MFRC522 and purpose of including?
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?
exact same problem i am having
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..
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?
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
Can we use another backend instead of php ?
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
remove the quotes
@@MSuriyaPrakaashJL which quotes, theres alot
is ie necesssary to buy arduino uno and ethernet shield??
we only requore nodemcu and dht11 sensor
here I've used nodemcu and dht11 sensor only
@@embedotronics okk thank you sir
@@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.
Very thanks for all...... but please ¡¡ Transcripcions !!! (Sub-titles in English, please. ) is it possible ??
sir what is the range of the sensor and node mcu?? as long as there is wifi??? thanks
If you use it without antenna , it works good for 5 - 6 m , and with antenna 10m 12 m
thank you sir! Really useful!!!
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
what error you are getting
@@embedotronics problem has been solved after some minor edits in code , thank you
@@YPTechDATIA hello sir can i ask what the edit code. Really appreciate it
@@fakhrulhaikal6375 I will upload a detail video on it , so I request you to follow my channel . Thank you
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
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.
THANKS VERY LOT FOR URE GOOD EXPLAIN AND I HOPE THAT YOU KEEP UP
yeah I'll keep posting such interesting projects.
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)?
@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
Hello, I've been experiencing the same with yours. my table is not updating. could you give me a copy of your php file?
hi how are you?can you make it with stm32?
Sir can you make tutorial to send the sensor data in my SQL to app inventor?
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
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.
sir can you please list the components required all the components!
Bro my nodemcu is not sending the http request and giving response code -1 please help me
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?
i reaaly wonder this issue
Thank you so much sir .
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 ?
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
@@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");
}
}
@@mokarrom_z2 did you solved this error because i m also getting this
@@shovitprusty4050 sadly no
Warning: Undefined array key "temperature" in C:\xampp\htdocs\temperature\dht.php on line 20
please help me
i'm also getting same error. Please help...
Thank you so much
Excuse me, sir, can I have the data base?
Please Upload video about Arduino Uno with ESP 01 Send data to mysql
Sir how to send data continuously?
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
please see my answer above in the comment section
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
Did you put your local IP?
@@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.
@@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?
thanks, but where is the arduino code
???
You can get the source code from video description 👍
hello sear did you get the code ?
Hi. I've been receiving this error when I run the code
MFRC522.h: No such file or directory
help me pls
Add mfrc522 library to ur project
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
every time code is successfully upload but temperature and humidity value found Nan.
please help me.
Your sensor is probably broken
BRO CHANGE THE DATA PIN OF DHT11 TO D2 !! and not D5!
what can i put as my local ip
if you are in windows just write in command prompt "ipconfig" then IPv4 will be your local IP
Displaying Connection Failed :(
Why i connecting failed in arduino
connection failed error displaying can someone pls helpp
connected
Get /testcode)dht.php? humidity=Nan& temperature=nan
This is the output in monitor serie
Help me please
nan means not a number, I think your connection was not correct that's why you are getting this error.
what if my system ip is dynamic?
you can do a port forwarding on router and make your IP publicly accessible
it doesnt work
Hii!!! I receive data in serial monitor but there is no data in database... what is the solution?... please help
...
same here
Put your local ip in the code like this
client.println("Host: 192.......")
The same problem there are no data in DB ...who can resolve this problem..
Same here
Does anyone know the solution to this problem?
Why it shows connection lost
if nodemcu is properly connected it should not shows connection lost, may be this is due to internet connectivity 👍👍