Power supply for 3.3 & 5V & ESP8266 Module WiFi issue

So I had an ESP8266 ESP01 module programmed to post to the web and it did so for the longest time without issues all while being powered from the 3.3V pin on an UNO (and the dht22 was powered from the 5V pin.)

Alas, after some power fluctuations which are quite common in my country, something must have happened and the esp01 started hanging and missing posts. So I took the module and plopped it onto a programmer usb to my laptop and it worked just fine (I mean I could see the response in the serial monitor as if it was posting, but it was sending garbage data as posted below since the dht22 wasnt connected to the esp01 anymore).

I decided it might be a power issue (from a damaged UNO powering the module) and i built a small 3.3V power supply with a LM1117. I just moved the esp01 module over to that power supply and realized i was still powering my dht22 from the uno's 5v pin. So I was wondering about the best way to make a power supply for both voltages since I also have 7805 lying around. But no sooner did I start writing this post and I just noticed that my google home and laptop just got kicked off my wifi. It seems whenever I have the esp01 connect to my wifi, it messes with something. It actually makes it so my laptop no longer sees the wifi and kicks it off the wifi. This is very reproducible behavior. 30 seconds after i power up the esp01 module I see the Google Home & laptop get knocked off. I unplug the esp and I can see my google home and laptop connecting to my ssid.

Any ideas what the issue could be?

Here is the code on my esp:

#include <ESP8266WiFi.h>
#include <dht.h>
#define DHT22_PIN 2//#define DHTPIN 2     // what pin we're connected to
dht DHT;

const char* ssid     = "ssid";
const char* password = "mykey";
const char* host = "myserver.com";
unsigned long previousMillis = 0;        // will store last time was updated
const long interval = 180000; 
char tempString[20];
char humString[20];

void setup() {
  Serial.begin(115200);
  delay(100);
 
  // We start by connecting to a WiFi network
 
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
 
  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}
 
int value = 0;

void start_test () {
  int chk = DHT.read22(DHT22_PIN);
  float h = DHT.humidity;//dht.readHumidity();
  float t = DHT.temperature;//readTemperature();
  dtostrf(t, 4, 2, tempString);  //convert flat to char  
  dtostrf(h, 4, 2, humString);  //convert flat to char
}

void loop() {
  ///////////INSERTED millis-sample code
    unsigned long currentMillis = millis();
  if (currentMillis - previousMillis <= interval) { //when time elapsed is LESS than interval of 30 mins    
  } else { //if deltaTimeElapsed is GREATER than target interval, sample and post...
    previousMillis = currentMillis; //sets previous-0 to current-3600
    start_test(); //sample

    //now post
    delay(5000);
  ++value;
 
  Serial.print("connecting to ");
  Serial.println(host);
  
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  
  String url = String("/emoncms/input/post.json?apikey=mykey&node=fortnite&json={\"t\":") + tempString + ",\"h\":" + humString + "}";
  Serial.print("Requesting URL: ");
  Serial.println(url);
  
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  delay(500);
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  
  Serial.println();
  Serial.println("closing connection");
  }
  
}

USB Programmer Response in SM

connecting to santiapps.com

Requesting URL: /emoncms/input/post.json?apikey=mykey&node=fortnite&json={"t":-999.00,"h":-999.00}

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 27 Sep 2019 00:58:43 GMT
Content-Type: text
Transfer-Encoding: chunked
Connection: close
X-Powered-By: PHP/5.4.16

2
ok
0

closing connection

Here is the router system log:

There doesn't seem to be anything there.

Ok I have news on this situation with my ESP module. I thought it was a power issue but its not. Ive ruled it out because even running on its own power supply, at some point in hangs and stops posting and drops off the router's dhcp client list.

I believe it definitely is a router related issue. I managed to make it fail by having 2 devices connect to the router after powering up. The last thing I did was gave the ESP01 module an address reservation because I believe it was having issues with the appletv and a raspberry pi running hassio.

Anyway, the thing is that I will be testing if with the address reservation there are no further issues of the esp01 getting kicked off the router when either appletv or hassio come online. But as I test this out in the next few days, I wanted to ask about my code, because even if it gets kicked off, if it reboots to connect again to the router, the router should eventually give it a free IP address. But today as I made it fail time after time, the esp01 failed to get back online on the router unless I power cycled it.

So I know the esp has its own wdts. So I need to disable the software one, which is obviously not working too well and this leaves behind the hardware one. So in setup() I should do:

ESP.wdtDisable();

so now the software (which feeds the hardware one) is off which means any infinite loop caused by my wifi connectivity issue, would result in an mcu reset. From what I've read this is about 6 seconds. This means the mcu will reset every 6 seconds unless I do ESP.wdtFeed(); which I could add somewhere in my code.

Now my question is this, if software wdt is enabled by default, and Im not feeding it, shouldnt it be resetting my MCU? Or is it possible the software mcu is not that good and fails, which is why my mcu is not being reset?

Thanks

One other thing Ive been thinking about is that since my router seems to be an issue, I looked at its dhcp settings:

what called my attention here is that the lease time is 2 hrs. Am I right to think that its riskier to have a short lease time since it means leases expire more often and when renewed can cause interference. Whereas if I make the lease 2 days, the ip the esp01 gets today will last longer, which means no matter how many devices get new leases during the next 2 days, they wont have the chance of conflicting with the esp01's address.

Unfortunately the DHCP option, although enables, is greyed out. Upon reading the bottom right corner it mentions something about a certain option in Network -> LAN which greys out this DHCP settings section. So I went to that section but can only find something called IGMP which can be enabled or disabled. Im not sure its the same thing though. Any ideas:

Are you getting WDT error messages in the Arduino IDE? Could you post those error messages?

If you have not enabled Debug for the ESP32 you might need to set Tools|Core Debug Level|Debug and re-upload your code. Leave Serial Monitor open to catch is the total of the error message.

As a note, the ESP32 WDT is wigging out because an actual error is occurring. An error that should be fixable.

I always power the ESP32 with 5V so that the on-board regulator can make a nice 3.3V.

It's not an Esp32, it's an esp01. I can't plug it into the serial monitor- usb because it's an esp01.