connecting nodemcu with mysql database

   Hello guys in this tutorial i show you how to connect  node mcu with the my sql database in server.
so by doing this you get the data to your website.all your products will be  connected to your database.once you have done this you could do the data analysis and many other things on your recieved data.

THINGS REQUIRED:
 1.NODE MCU
 2.LDR 
 3.RESISTANCE(1k ohm)
 4.BREAD BOARD
 5.CONNECTING WIRES

SOFTWARE REQUIRED:
 1.NODEMCU
       
               Before getting into it you should have the basic knowledge in networking  and also in php.so that you could understand. i have used 000webhost web hosting services i suggest you the same since it is free of cost.you could also try any other webhosting services according to your comfort .
 LDR: the LDR(Light dependent Resistance) is a sensor which is used to measure the light intensity.
  the LDR is interfaced with the NODEMCU so the signals received from the LDR is processed in the NODEMCU next the processed data concatenated  to upload it to my database in my server .i have given the codes below.



above shown are NODEMCU scripts to connect it with the database.At here i have mentioned my website as HOST you could change it server since it could act both as server and client.At here i am sending a single data just a data from LDR you could try various sensor data at that time you need to concatenate all the data into a single string and the LENGTH should be defined so that the server may know how many data needs to be recieved. I am doing POST request in sending.you could try it by using GET request.
                           
the data received from the NOEMCU through the file index.php .inside which a php code is written which establishes the connection with the mysql database in the server and  sends the received data to the database .


 the data received  is shown up in my database.all the data is stored in the database.this will be helpful in future for data analysis.

CIRCUIT DIAGRAM:


connect the sensor to the exact pin in NODEMCU. For pin configuration please check out the pinouts of NODEMCU.so this is all. If you have any problem in uploading data or you get any error please post it.may i solve it for you.if you like this project please comment share and support me.

Comments

Popular posts from this blog

installing the opencv and numpy for python 3.6. in windows