Go Down

Topic: Send data to mysql through esp8266 and uno (Read 5932 times) previous topic - next topic


Hi all
I have a uno which runs that attached code. I have a esp8266 connected to my tx and rx of uno, can anyone help me modify my program so that arduino can directly insert the temperature to mysql database using mysql connector?

Esp8266 is connected to my WiFi router and my pc is also connected to the same WiFi router

My database setup is like this

I have an odbc with connected to mysql database,  connection name is TEMPLOG

Mysql is installed in my pc and it's ip is

Mysql is in my pc at address localhost

User name root
Pass: @temp@12

Database has 3 column
I'd ( auto incriment)
Date (system date)
Temperature (where we need to insert data)

Is it possible to insert data directly?

This is my sketch

// First we include the libraries
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup(void)
 // start serial port
 Serial.println("Dallas Temperature IC Control Library Demo");
 // Start up the library
void loop(void)
 // call sensors.requestTemperatures() to issue a global temperature
 // request to all devices on the bus
 Serial.print(" Requesting temperatures...");
 sensors.requestTemperatures(); // Send the command to get temperature readings
 Serial.print("Temperature is: ");
 Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? 
   // You can have more than one DS18B20 on the same bus. 
   // 0 refers to the first IC on the wire


I have the same question.   The MySQL database is up and running.  How to put data into a MySQL database.  (I have a Mega 2650.  The application is similar to yours)


Mar 31, 2018, 01:14 pm Last Edit: Mar 31, 2018, 01:14 pm by wildbill
There are several ways. The most common is to create a web page on a server somewhere. Have your arduino act as web client using a GET request to access the web page. Whatever data you want to pass to the web server is sent as parameters in the GET. Parse the returned web page if desired to get results. Often, this step is ommitted as the only point was to pass IoT data to the database. Then the web server stores the data in the database.

You can do it directly too, see here.


Have you attend to send data ??? Can you post the code please ??!!


Hi all

I have a uno which runs that attached code. I have a esp8266 connected to my tx and rx of uno
No level shifters? And the ESP8266, a 3.3V device, still continues to work with the 5.0V device?  I use ESP32's and they do not take much more than 5.1V before they act like fuses.

Go Up