ProMini + ESP8266 - Sending Commands Via ProMini

Hey all!

I have been all over the internet trying to find some examples of how to do something.... and no luck!

Here is what I am trying to do: Connect a Pro-mini and an ESP8266 together and connect to wifi w/ error checking.

So far, I can easily hook the two together. Upload the sketch to the pro-mini and have the pro-mini (via void setup) connect to a network.

I want to add some error checking. Meaning I want to check if I get an "OK" or and "ERROR". This does not seem so trivial to do. Sample code is below.

Ultimately this is going to connect to Firebase. I have already connected an ESP8266 directly to Firebase without an Ardiuno board.

This would be Arduino Pro-mini + ESP8266 --> Firebase. Ill be able to import the firebase lib without much of a challenge, but properly navigating connections is my main concern right now.

void setup() {
// put your setup code here, to run once:

Serial.println(" ");
Serial.print("Baud rate is set at ");
Serial.println("Set monitor to NL & CR");
Serial.println(" ");

Serial.println(" ");

//Serial.println("Send AT command");



you could use a library. WiFiEsp library has standard Arduino networking api


Hey thanks! I completely missed this one. It looks like this will work for connecting via an ESP to the internet and not have to manually enter AT commands. I will test today and confirm later. :slight_smile:

Separately, looking for a little advice. To send data to firebase or anything for that matter, do I need to pass the info through the ESP or once I have established connection to a network can I push directly from Arduino. I am trying to wrap my head around how to get the info directly to firebase with a Pro-mini connected to an ESP.

Of course you need to send it through the ESP8266 from your Arduino. It's your network adapter and you are communicating with Firebase through the network.

Just beware, if you use the WiFiEsp library, it does considerable filtering of the responses from the 8266. It not only disappears a lot of responses, it also, depending on the debug mode setting in debug.h, it throws in huge quantities of other stuff. So, you basically have two choices if you want to expand the supported functions:

  1. Modify the WiFiEsp library and its sub-libraries
  2. Send ESP commands directly, and filter all the responses yourself.

I have run into this problem myself, and plan to make extensive changes to WiFi8266 to make it easier to deal with for non-standard applications. The one change I have mad already is to make the "sendCmd" functions in EspDrv public, so the top-level application can at least run commands and let EspDrv filter the responses for OK and ERROR.

Ray L.


Just beware, if you use the WiFiEsp library, it does considerable filtering of the responses from the 8266.

what filtering? I test WiFiEsp in these days and I loose data only if I do not read them fast enough. I test at 115200 on Uno WiFi where the ESP is connected with I2C UART with 64 bytes FIFO buffer. The UART has a flag if overrun of buffer occurs.

In WebClient example I was loosing the beginning of the data because the request is in setup and the response is read in loop. Then at the end of the first data package from esp I lost data again because of delay(5) in getData() in EspDrv.cpp.

The I tested with my older sketch and again I had seemingly random overruns. The I discovered that when I wait for the response in a helper function I wait too long between client.available(). It takes a second before the server responds but then the data are coming fast.

Thank you everyone!

Can someone provide me a little bit of insight / teaching on the flow between the items (pro-mini, esp8266, firebase)?

I guess I am getting stuck on how I actually send the data via the ESP8266. For example, I am comfortable writing AT commands via pro-mini to the the ESP to establish a connection. My struggle is how I send data to firebase with the pro-mini while using the ESP. Maybe the library sets the ESP up so that I do not have to do this and it just recognizes it? Struggling with this a little bit. Any help is greatly appreciated!

ups, there is no avr library for Firebase?

There is a library in firebase and some code samples, but they look to use the ESP8266 as the main device.

Does the WifiESP library have blocking functions? That would rule it out for me.

Does the WifiESP library have blocking functions? That would rule it out for me.

Yes, it does. In many cases, it send an AT command, and waits, with a timeout, for the response, parsing what comes back on-the-fly, looking for recognized tokens, like OK, ERROR, etc. When doing things like connecting to a network, it will block for several seconds - not good.
Ray L.

@RayLivingston how fast connects your computer or phone to a WiFi network?

@RayLivingston how fast connects your computer or phone to a WiFi network?

Typically 1-3 seconds.
Ray L.

I am not saying that WiFiEsp is ideal. But it at least implements a standard Arduino networking API (classes Client and Server).

I use WiFiLink. It is a better concept. The esp part - the 'firmware' is an Arduino sketch. The library implements standard Arduino networking API. But WiFiLink is not completely finished and has many small bugs.