Log Your Weather Data in Database!

Garin Ichsan Nugraha
Garin ESP32 DEVKIT
Published in
3 min readApr 25, 2020

Hellooo guys! so sad that this project will be our last project in our ESP32 Embedded System Final Project. But don’t worry because there is many things that we can learn from this entire world. There is much more micro controllers that we don’t know yet, that exist for our experiment.

In this project we’ll log our sensor’s output data in online database. Similar to our second project in this final project which we used Google Spreadsheets to store our data. With database we can do much more implementation. So here we go. We’ll use our DHT11 as usual, so here’s our schematic.

After that, lets configure the database first. This time, I’ll use my friend’s hosting that store our entire class experiment. We want to make a weather station that show the weather from around Indonesia with our lock down condition right now. You can use your own online database if you want to.

In this experiment we will use online MySQL database to store our data. You’ll need to make a table first. In this case, our class made a table that consist of Id, Kind of sensor, Location, Temperature, Pressure, and Humidity. Because we’ll use DHT11 so we wont fill the Pressure and let this column null.

After the table exist on the database, we can start to make the PHP files. It consist of two PHP files with one PHP for receiving the data for database trough internet and the other to visualize it on the internet browser. So here is the code. Make sure you configure it with your own specification.

receiving data trough internet
visualize in web browser

After you’ve done configuring your database and web server, we can start to code our ESP32. Here is our code to send the DHT11 data to database through ESP32.

code for ESP32

Try to run the code and, viola! the data will be stored in the database !

serial monitor
phpMyAdmin
web browser

Amusing isn’t it? Check it your own at http://hardyvalen.my.id/18218050/18218050-esp-data.php

See ya in our next project!!

( even it is our last and final project for ESP32 >,<)

--

--