Esp32 4 relay board picking and dropping relay 3 in softap mode

I have sketch (about 500 lines) that works fine
when I let my router assign its IP but when I try to run it in softAP mode relay 3 chatters. In both modes an ip is set and in ap i can also log into it with my phone and everything seems to work except relay 3 on IO pin 25 continuously picks and drops. I eliminated all of the code and created 2 sketches below where one connection chatters and the other is normal. I'm not at all sure what connection there could be between the wifi set up and relay 3.

The firt sketch uses my router to asign the ip and the second it asigns it itself and chatters. Guess I'd like to know can anyone else duplicate this with the same board.
The chatter sketch

    #include <WiFi.h>
    #include <WiFiAP.h>

    const char* ssid = "Camp";
    const char* password = ""; //123456789

    IPAddress gateway(192,168,1,1);
    IPAddress subnet(255,255,255,0); 
    void setup() {
    Serial.begin(115200);
      WiFi.mode(WIFI_AP);
      //WiFi.softAPConfig(local_IP, gateway, subnet);
      WiFi.softAP(ssid, password);
      IPAddress myIP = WiFi.softAPIP();
      Serial.print("AP IP address: ");
      Serial.println(myIP);
    }
    void loop(){
    delay(2000);
    }

The resulting console out put:
14:30:39.277 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
14:30:39.277 -> configsip: 0, SPIWP:0xee
14:30:39.277 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
14:30:39.277 -> mode:DIO, clock div:1
14:30:39.277 -> load:0x3fff0030,len:4916
14:30:39.277 -> load:0x40078000,len:16492
14:30:39.277 -> load:0x40080400,len:4
14:30:39.277 -> load:0x40080404,len:3524
14:30:39.277 -> entry 0x400805b8
14:30:39.626 -> AP IP address: 192.168.4.1

Now for the other sketch and no relay chatter

 #include <WiFi.h>
    #include <WiFiAP.h>

    const char* ssid = "MY SSID";
      const char* password = "MY Password";

    void setup() {
        Serial.begin(115200);
        Serial.print("Connecting to WiFi");
        WiFi.begin(ssid, password);    
        int attempts = 0;
        while (WiFi.status() != WL_CONNECTED && attempts < 20) {
            delay(500);
            Serial.print(".");
            attempts++;
        }
        if (WiFi.status() == WL_CONNECTED) {
            Serial.println("\nWiFi Connected!");
            Serial.println("IP Address: " + WiFi.localIP().toString());
        } else {
            Serial.println("\nFailed to connect to WiFi. Restarting...");
            delay(5000);
            ESP.restart();
        }
    }
    void loop(){
    delay(2000);
    }

the console output:
12:16:08.715 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
12:16:08.715 -> configsip: 0, SPIWP:0xee
12:16:08.715 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:16:08.715 -> mode:DIO, clock div:1
12:16:08.715 -> load:0x3fff0030,len:4916
12:16:08.715 -> load:0x40078000,len:16492
12:16:08.715 -> load:0x40080400,len:4
12:16:08.715 -> load:0x40080404,len:3524
12:16:08.715 -> entry 0x400805b8
12:16:08.995 -> Connecting to WiFi......
12:16:12.113 -> WiFi Connected!
12:16:12.113 -> IP Address: 192.168.0.170

So in both cases an IP was assigned but for the AP mode the relay chatters.
This is the board I'm using and I also got a new board out and it does the same thing. AC/DC powered ESP32 Relay Board x4 | devices.esphome.io

Try a different IP address, that sounds lilke it could be two units using the same address. Be sure its MAC and IP are unique on your system. Hopefully the IP falls in the following ranges:
There are three different IP ranges defined in RFC 1918. They are:

10.0.0.0/8 ( Range: 10.0.0.0 – 10.255.255.255 ) – Available IPs: 16,777,214

172.16.0.0/12 ( Range: 172.16.0.0 – 172.31.255.255 ) – Available IPs: 1,048,574

192.168.0.0/16 ( Range: 192.168.0.0 – 192.168.255.255 ) – Available IPs: 65,534

The first sketch is the complete sketch and it uses the default IP for AP mode and there is nothing else defined or used. The board also has nothing connected to it. Just seems wierd to me that the two different wifi modes cause the a relay to chatter

Post an annotated schematic showing all connections, power, ground, power sources and any other hardware connected to the processor.

Yes, interesting...
But in "real life" your Gpio25 would be configured as output. How it behaves then?
Generally, I wouldn't leave connected pin floating.

Well in my real sketch it is defined as an output. It is hardwired on the board to relay 3 and an led both of which chatter away. It should only turn on when an input is detected. I'm using tasks so maybe thats why it acts as it does. In the little sketch above if I do declare it and assign it as an output as in my main sketch it behaves correctly but that still leaves me with the same problem. GPIO25 and 26 are the pins to relays 3 and 4 respectively and if I switch the output to pin 26 it comes on and off as it should but 25 still chatters away set either way. I have 2 little videos that I can show if you can upload them. Not sure how.

There are only 2 connections to the board besides the upload wires which once uploaded makes no difference connected or not. I have ground to the ground input and +12v from a variable supply to the 7-30v input. Everything works letting my router do the ip but fails when I try AP mode.

I did try different ranges and it made no difference.

I'm not sure if I follow you..
So you set 25 as output and write it high or low.
And with this chattering you mean that the relay is switching on-off by itself while softAp is used?

Yes. When using tasks the other 3 relays work as expected but relay 3 io pin 25 just randomly chatters away. Think it must have something to do with operating system running on core 0.

So you hear the relay clicking?
Nothing comes to my mind that could make a difference in behavior between 25 and 26.
image

yes the relay clicks and the led flashes as well. If I put an Led on the relay output it chatters too.

Wow.
Did you try it with esphome?

I've only ever used arduino IDE. Can I just take my sketch and run it in it or do I have to totally rewrite? This particular sketch has 10 tasks and almost 500 lines of code.

Latter one. Makes no sense.
I just asked because of your link.

OK problem solved. The idiot was using the wrong board definition. Should be ESP32 DEV Module

And what you had?

The chip on the board was a wroom so that was what i had selected. I'd given up on that board and went to another which required esp32 dev module and everything worked there but when I got my input sensor I tried once more to use the 4 relay board but forgot to specify the wroom and evrything worked. My bad. Always seem to have confusion on what esp32 board to select.