I have had so many problems with this board. I have a detailed list of everything I've tried at the link below, but for simplicity I will just summarize where I am now:
https://forum.arduino.cc/index.php?topic=673618.new
What I am trying to do
I want to connect my Arduino Nano to the internet using an ESP8266 ESP-01. Links to board references below:
Arduino Nano: https://128217-368301-raikfcquaxqncofqfm.stackpathdns.com/wp-content/uploads/2017/06/NSE-1004-2_7.jpg
My Arduino is a clone. Here is the exact model: https://www.amazon.com/Longruner-ATmega328P-Controller-Module-Arduino/dp/B01MSYWE6B/ref=sr_1_7?dchild=1&keywords=arduinonano&qid=1585358071&sr=8-7
I have a server running on my network that will take two types of requests from these Arduinos. One Arduino/ESP pair will send data from sensors to the server, another pair will take that data from the server. These are dedicated processes. The sender will never receive and the receiver will never send.
Circuit
Three devices are at play: Arduino Nano (AN), ESP, and External Power Supply (EXPWS)
ESP: VCC -> 3.3v EXPWS
GND -> GND EXPWS
CH_PD -> 3.3v EXPWS
RX -> RX AN*
TX -> TX AN*
GPIO0 -> 3.3v EXPWS*
RESET -> 3.3v EXPWS*
Arduino
GND -> GND EXPWS
GND -> Reset AN*
- I have tested various configurations of these. GPIO0 to ground, Reset of ESP to nothing, inverting RX and TX depending on what I am doing, etc. GND to Reset on the Arduino is when I try to upload to the ESP using the Arduino as a USB TTL converter. More on that later.
Where I am
I have been able to communicate with the ESP using the Arduino IDE via AT commands in the Serial monitor. I have connected the ESP to my WiFi network, can ping it from my Mac, and have set the default baud rate to 9600.
Things I cannot do
I cannot access AT commands when this sketch is uploaded to the Arduino:
void setup() {
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
}
But I can access AT commands with the following two:
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
and
void setup() {
int i = 0;
}
void loop() {
// put your main code here, to run repeatedly:
}
This tells me that trying to use Serial commands is causing a problem. I considered trying to work the ESP by sending AT commands via Serial communications, but, as per my description above, I received no responses from the ESP.
I also cannot use libraries intended for the ESP, namely WiFiEsp. I receive the error:
[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Cannot initialize ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] No tag found
WiFi shield not present
When I run any example sketches provided by the library (even when I change parameters such as baud rate and adding delay statements to the library code). Here is a link to that library, you can find the examples there: https://github.com/bportaluri/WiFiEsp/blob/master/examples/WebClientRepeating/WebClientRepeating.ino
I also cannot upload sketches directly to the ESP using the Arduino as a USB TTL converter. I have tried grounding the Arduino reset pin while uploading, grounding it during compiling then pulling that connection when it starts to upload, and doing nothing to the Arduino reset pin. I have tried different combinations with the GPIO0 pin (ground, vcc, nothing), as well as the other pins.
Conclusion
I am really open to some suggestions here. The root of the problem seems to be Serial communications - it is the common thread between basic sketches on the Arduino and uploading to the ESP itself. I have four of these modules and all of them behave the same way. If I can't get a solution here, I'm going to have to give them back to Satan.
SoftwareSerial
. Secondly, I've been through what you (and many of others) experienced before and have triedWiFiESP
, it doesn't work for me and the developer seems stop maintaining the library long ago. I use a library that I fork and fixed some minor bug and modified it that you can find in my github. It is very stable and use only 11-bytes SRAM.