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.
// Set ESP8266 baud rate
Blynk.begin(auth, wifi, ssid, pass, "192.168.11.235", 8080); // Raspberry Pi3
// setup emon
emon1.voltage(6, 102.8, 1.7);
cntr = 0, hb = 0;