ESP Node Name in SoftAP Mode

DougK2
Posts: 2
Joined: Thu Feb 08, 2018 6:30 pm

ESP Node Name in SoftAP Mode

Postby DougK2 » Thu Feb 08, 2018 6:37 pm

I'm trying to set up an ESP32 in SoftAP mode so I can send simple ASCII commands to it without needing a separate WiFi router. I have been able to get that working but I cannot get the ESP name to show up correctly on my laptop. It is always ESP_234B01. I'm using the Wemos Lolin32 with the OLED. The simplified version of the code I'm using is below. The OLED works and shows 192.168.4.1 as the IP, but my laptop always shows ESP_234B01 as the node name. I'll be using this in an environment with multiple ESP32s, so I need to give each one a unique name that means something.

Any help would be greatly appreciated!

#include <WiFi.h>
#include <Arduino.h>
#include "SSD1306.h" // Header file for OLED

// Declare the OLED Display object
SSD1306 display( 0x3c, 5, 4 );

/* Set these to your desired AP credentials. */
const char *APssid = "APtest";
const char *APpassword = "APpass";

void setup() {
WiFi.softAP(APssid, APpassword);
WiFi.softAPsetHostname( APssid );
//WiFi.softAP("XYZ", "XYZ");
//WiFi.mode(WIFI_AP);
IPAddress myIP = WiFi.softAPIP();

display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_16);
display.drawString( 0, 0, myIP.toString() );
display.display();

}

void loop() {
// put your main code here, to run repeatedly:

}

DougK2
Posts: 2
Joined: Thu Feb 08, 2018 6:30 pm

Re: ESP Node Name in SoftAP Mode

Postby DougK2 » Fri Feb 09, 2018 4:31 am

After much searching and experimenting I found the setup sequence that works:

WiFi.mode( WIFI_AP );
IPAddress ip( 1, 2, 3, 4 );
IPAddress gateway( 1, 2, 3, 1 );
IPAddress subnet( 255, 255, 255, 0 );
WiFi.softAPConfig( ip, gateway, subnet );
WiFi.softAP( "MyNodeName" );

Now I can see MyNodeName among the wireless devices I can connect to and I can talk to the EPS32 via Telnet from an app on my laptop.

JeromHa
Posts: 1
Joined: Tue Feb 20, 2018 8:27 am

Re: ESP Node Name in SoftAP Mode

Postby JeromHa » Tue Feb 20, 2018 8:50 am

I have the same issue here.

Solution proposed by DougK2 works, ... but does not take into account the password if you set one :

WiFi.softAP( "MyNodeName", "mypassword" );

Considering the numerous examples on the Web, I guess some people got it to work ... can anyone confirm ?

N.B. I'm using ESP32 TTGO with Lora & OLED

rosimildo
Posts: 13
Joined: Fri Nov 11, 2016 7:20 pm

Re: ESP Node Name in SoftAP Mode

Postby rosimildo » Sun Apr 08, 2018 11:03 pm

The call with password does not work, probably because your password does not met the criteria of being 8 digits or more.
I had this error at one point.

R

Who is online

Users browsing this forum: No registered users and 2 guests