Trying to connect Uno R3 to MySQL using ESP-01

Hello
I’m a newbie of Arduino.
I’m trying to make Arduino uno R3 to connect to MySQL by using Esp-01(or nodemcu).
But I just find out most of the guide for Arduino connect to WiFi and MySQL are in old version(I’m using 2.3.2 now).
I can’t even use ESP8266WiFi at all.(Also can’t find the library)
Is there any suggestion for me to fix this problem?
Thank you.
(English is not my mother language,but I’ll try to understand)

*Windows user

Hi @rockcold0119.

Please provide links to the guide you attempted to follow in a reply here on this forum thread.

Generally a guide will be applicable to Arduino IDE 2.x even if the guide author was using Arduino IDE 1.x so you should be able to simply follow it as is.

There are two common ways the ESP8266 is used by the Arduino community:

  • As a WiFi adapter module controlled by a standard Arduino board (e.g., Uno, Mega) over a serial connection using AT commands. In this usage, you will be writing Arduino sketches for and uploading to the standard Arduino board, not the ESP8266.
  • As a standalone Arduino board. In this usage, you will be writing Arduino sketches for and uploading directly to the ESP8266.

The "ESP8266WiFi" library is bundled with the "esp8266" boards platform. It can only be used when you are programming the ESP8266 microcontroller directly. It can not be used in sketches that will be uploaded to an Uno R3 board. From the information you have provided so far, it appears you are using the ESP8266 in the first of the two ways I described above. If so, you can not use the "ESP8266WiFi" library.

This is the guide I'm trying to follow.(Using Arduino connect to MySQL)

Do you mean I should use AT command to control my WiFi module,not by programming on Arduino IDE(Arduino sketches)?
Is there any guide for AT commands?
Should I make connecting to WiFi and MySQL as different part?(connect WiFi by AT,connect MySQL by sketches)

The guide is not directly applicable to your hardware because they are using a board with an ESP32 microcontroller.

In their system, they only have a single Arduino board so they don't need to worry at all about communication between the primary board and the Wi-Fi interface as you would need to do with your hardware.

The ESP32 has different libraries than the ESP8266 so, even if you were only thinking about programming the ESP-01 module on its own you would still need to make adjustments to the code provided by the guide. The ESP-01 modules tend to have relatively limited amounts of flash memory (the flash is a separate chip so it can vary depending on the module you have) so you might even find that your program is too big to upload to the ESP-01 if you make a very complex program that uses a lot of libraries. The ESP32 has significantly more memory so this is less likely to occur with that hardware.

Are you set on using the ESP-01 module? The project might be a lot easier if you just buy an ESP32-based board. This approach of using an ESP-01 module as a Wi-Fi communication adapter for another Arduino board is not very common these days now that boards with integrated Wi-Fi radios are so readily available.

I'm not advising you either way. I was only explaining why you couldn't use the "ESP8266WiFi" library in a sketch for your Uno R3 board.

If you want a library to use in your Uno R3 sketch to handle controlling the ESP-01 module via AT commands, you can try this one:

I'm not aware of one for this specific application. Maybe one of the other forum helpers can suggest one.

First of all, thank you for all the answer above :slight_smile:

I'd seen your advice and kept making research for the difference between different chips.
I have 3 kind of different chips 1. Esp-01 2. NodeMCU ESP8266MOD 3. NodeMCU ESP-32S

I'm not set on using ESP-01.As i mentioned above I have three different kind of chips,Esp-01,NodeMCU ESP8266MOD,NodeMCU ESP-32S

I'll explain what I want to do.

First I have already built a prosthetic hand made with 1 Uno R3(as controller) + 1 PWM servo shield + 14 servo(as joint) (already able to control it by typing on Serial)

Now I wish to make this hand able to connect to WiFi and get the data(for controlling servo) on MySQL not by typing on Serial.

With the three chips I have above,I just make three chips able to connect to WiFi this week,but i still have no idea how to make these chips get the data from MySQL.

Is there any advice for me to try?
Because it seems the library
https://github.com/ChuckBell/MySQL_Connector_Arduino/wiki
Doesnt work in my case?

If you need more detail about my case,please tell me,I'll answer you as fast as I can.

Thank you again for all the answer above.

Cool project!

My advise is to start by setting the prosthetic hand aspect of your project aside for now and focusing exclusively on getting a simple "hello world" type of MySQL project working 100% perfectly. Once you know you can connect the board to the database and work with the data from it on a basic level, you will be better equipped to integrate that functionality into your full project.

I recommend using one of the "NodeMCU" boards for this phase of the project simply because the on board USB interface on those board makes it is much more convenient to upload sketches to them and to get debug output from the Arduino IDE Serial Monitor. The ESP-01 does not have an on board USB interface so you must wire one up and also follow the right procedure to put the ESP8266 microcontroller into boot mode before each upload. That means there is an extra level of complexity to using the ESP-01 and I'm sure the MySQL aspect will be plenty complex on its own.

As for the choice of whether to use the ESP8266-based "NodeMCU" board or the ESP32, I would say it depends on whether or not you want to use the ESP-01 in your final project. If you do plan to use the ESP-01, then use the ESP8266-based "NodeMCU" board while doing the initial work on the MySQL functionality. The knowledge and code you gain from that process will transfer over to the ESP-01 more smoothly than it would if you did the initial work with the ESP32 and then tried to switch gears to the ESP8266.

The most important thing is to just roll up your sleeves and jump into the project with a spirit of determination. This is a challenging endeavor, but I'm sure you can achieve success if you have enough persistence.

I wouldn't say that. It is not designed to be used in an application where an ESP-01 module is used as a Wi-Fi adapter running the AT firmware. But that is only one of the possible approaches you can take to your project.

It does look like the "MySQL Connector Arduino" library itself can be used with either ESP8266 or ESP32.

I'm working on Esp32 on two different way for one month already
1.make Esp32 connect to MySQL by the library i mentioned about
2.set a httpserver on Esp32 to recieve the data
(both using the example sketch

but My problem is that both side neither works and both return "timeout error"
Is there any way to fix this problem?or how can i check where the problem is?

I'm afraid I won't be able to assist with the problem, but other forum helpers might well be willing to do so.

You should provide a simple sketch that produces the "timeout error" problem in a reply here on the forum thread. Make sure to provide all information that a helper would need to reproduce the problem on their own system.

got it!
tks for helping!
really appreciate:)

is there any suggestions for what kind of module i can try in this case?(require at least 14 wire and wifi to database,as my project needed)(i used to think of making wire between Esp32 and arduino uno r3,but it might be a bit complicate)
cause im now thinking will it might be the module problem?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.