ESP8266 with a MySQL database

UPDATE: Please see this post for more information and links to code!

If you been following my blog since the beginning, you should remember a tour of some of the websites I’ve built in the past. The last websites I built back then involved PHP and MySQL databases and, even though it’s been such a long time, it certainly helped with this next experiment I did with the ESP8266 module.

tableI now have the ESP8266 module accessing a URL that contains the sensor information. Some PHP code grabs the information from the URL and inserts it into a table on a MySQL database. Check out the code on GitHub. Soon, I’ll have it sending data to both the database and Thing Speak, as it’s currently only sending data to the database.

You can view the live demo at mwhprojects.com/esp8266.

Once I finish up with the code, it’ll be time to put it into an enclosure… though I’m still waiting for a switch for the LCD backlight…

Thanks for reading!

Advertisements

8 thoughts on “ESP8266 with a MySQL database

  1. Hi, I’m glad to see ur amazing project. I have a question about ur project, when I looked up the php files, I have a problem to insert a value in the coloumn of MySQL database from ur php file, can u tell me the way to create the database ? Thanks

    Like

    • I don’t normally create MySQL database tables with code. I make the structures of my databases and tables in phpMyAdmin. If you look through my code, you’ll be able to identify the names I used: date, time temp, hum, and lum. These are either text or float values in the table’s structure (the table is called data).

      I hope this can help you to get it working for your project. Good luck!

      Like

  2. Hi, first sorry for my english, but is a very nice project!
    Is possible to have more information about the Hardware for temps sensor and wifi connection?
    Thanks a lot!

    Like

  3. I’m using localhost and getting problem in “connecting to host” , how do you write in YOUR_HOST in this :
    const char* host = “YOUR_HOST”;
    when using xampp ??? thanks

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s