Post topics, source code that relate to the Arduino Platform

User avatar
By MrGadget
#94998 I have been using this part on and off for many years. Presently it is on, and I have a collection of these things where they no longer respond to AT commands. Over the years I have spent too many hours googling and trying to figure out what I am doing wrong with no luck.

This time, I am using the Arduino Nano to talk serially to the ESP8266-01 and it works for awhile then stops working (no response to AT commands). Today, I took my last new one out which worked and then I made changes to my program because I suspect it is somehow causing the problem. This time it stopped working in five minutes, the shortest time yet. Now I have about 10 of these stupid things (don't get me going about re-flashing the firmware as I have spent countless hours trying to figure out how to set up the flasher, again with no success).

The default baud is 115200 which is too fast for a software uart on the Nano so want to run it at 9600. I have tried the AT commands to permanently make the change and it does not do it permanently (This was done many years ago and I forget details). So my Nano program below starts at 115200 and then changes down to 9600 and it works well.... until it doesn't whether that is an hour, a day or a month later... And I think the failure happens while I am playing with the program as I un-plug and plug it in but I really have no clue and neither does the Internet based on my searching skills.

I realize that restarting the program without a reset means the ESP is still at 9600 while I send the first command at 115200. Probably not a good thing but I don't know how else to do it since I am not able to switch the default to 9600.

My setup code (which I believe is the culprit) is below. Does anyone know what I am doing wrong? Or can I revive these 10 devices or do I just throw them out. I know all of them will boot with serial information at that funny baud rate so they have something in them.

Thank you.

Code: Select allvoid setup()
{
  Serial.begin(9600);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(10);
  Serial.println(EspSerial.println("AT+IPR=9600"));
  delay(100);
  EspSerial.begin(9600);
  delay(100);
  Blynk.begin(auth, wifi, ssid, pass, "192.168.11.235", 8080); // Raspberry Pi3
  timer.setInterval(2000L, myTimerEvent);
  // setup emon
  emon1.voltage(6, 102.8, 1.7);
  emon1.current(5, 8.981);
  cntr = 0, hb = 0;
}
User avatar
By QuickFix
#95009 How did you connect the Arduino Nano to the ESP? Did you add level shifters or did you use a 3.3V clone of the Nano (I believe those exist)?

Whatever you've read on the internet: the ESP is not 5V tolerant.
I know that some top dog manager of Espressif made this statement once (~2014), but soon retracted it because he was wrong, but for some reason this false info still floats around the internet as being a fact.

For the short term and in emergencies you can get away with 5V on some pins (at your own risk), but you should really only feed the ESP (on any pin) with no more than 3.3V±10% or it will eventually be damaged beyond repair. :idea:
User avatar
By MrGadget
#95010 Hello, Thank you for your response. I am using a resistor divider to ensure the ESP never sees over 3.3V.

I do have an update and it is different behaviour than my original post so I have no idea what is going on.

Anyway, the new behaviour, I was able to get it to work by flashing the ESP-01 with version v0.9.5.2_ AT_Firmware.bin which works but with one serious problem. If I power cycle the boards then it no longer works? I have to reflash it again with v0.9.5.2_ AT_Firmware.bin and it will work until the next power cycle. But if I reset the boards without a power cycle it will restart correctly.

I do not believe this to be related to the Nano or my code because I have an adapter board for the ESP-01 which allows me to talk AT commands using Termite and I get the same behaviour by sending only the AT and waiting for the OK response. After a power cycle I no longer get the OK.

Googling has not found an answer and I am at a loss why this happens.

I have tried newer firmware versions (for example ESP8266-IDF-AT_V2.2.1.0.bin) but none of them respond to an AT command so I am at a loss here too. I have about 7 ESP-01 and of them and all behave the same way. Oh, and all have 8Mb flash and the bin files I try are all less than 500KB so they should fit. At least the flasher programs to 100%.

I have ordered 4 more ESP-01 and they will likely behave the same way as my first post. That is they will work until they decide not to.

I really would like to get this figured out because I have another project idea requiring the same serial connection to an ESP-01.

Thank you.
User avatar
By JurajA
#95011 so maybe the AT+IPR fails and sets 960 baud or 96000 baud.
did you try to reflash the AT firmware?
(btw the AT command to set baud rate is different in current AT firmware versions)
Last edited by JurajA on Wed Aug 03, 2022 12:19 am, edited 1 time in total.