• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 connection to Wifi. Please see my dialog which says answered but has not been.

Q&A Forum › ESP32 connection to Wifi. Please see my dialog which says answered but has not been.
0 Vote Up Vote Down
Robert Gillespie asked 4 years ago
18 Answers
0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

 have moved the router to about 6 feet away with no success.  I thought that maybe I had the password wrong so I deleted the wifi account from my iPad and put it in again and it was successful.  I don’t have a clue what is going wrong.  I’m using AT&T fiber and running a lot in the house and wonder if that could be the problem?  Any more thoughts on what I might try?  I have a laptop and I might try using it.  I have the wifi set on Private.  I’ve taken down the firewall for this effort.  The computer I’m using is connected via wifi to the network.  Hope this helps a bit.  It is a WPS system.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

WPS really doesn’t make a difference. What do you mean by Private? All boards only work on 2.4GHz. Is that turned on in your router? I have seen problems when there are spaces in the SSID. Also special characters like @ and $ in the password. If you use special characters then try using ! Or ^. Is DHCP turned on? Is there enough IP addresses still available.?
 
I gues you could have a faulty board. Try a different one. Have you tried a WiFi test sketch?

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Using the settings, network and internet, wifi, network profile I can declare public or private.  I declare private and makes the network discoverable I think.  Router feeds two PCs, 2 iPads, 2 phones so I believe the 2.4GHz must be on in the router.  Don’t know about the number of IP addresses available.  I’ve tried to see if I can find out what is connected but I’ve had no luck.  Steve, I appreciate you trying to work with a mind past its prime.  Don’t know how to turn DHCP on.
Best,
Bob

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

All of this stuff is in your router config. Can you login to your router? What kind is it? Is there a manual online for it?
 
All of those devices could be on 5GHz. Can you check their network settings? I can’t recall whether that will actually tell you or not.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

Another way to test this out is to connect the pc via Ethernet cable to the router then setup a wireless access point on the pc (There are lots of tutorials on the net for this. Then try connecting the ESP32 to the soft AP.

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Steve, will try but can’t today.  Stay safe.
Here is my router config info. SSID: ATTSTzKhCI
Protocol: Wi-Fi 4 (802.11n)
Security type: WPA2-Personal
Network band: 2.4 GHz
Network channel: 1
IPv6 address: 2600:1700:58b2:8220::46
2600:1700:58b2:8220:18cb:eb5a:28c0:35f1
Link-local IPv6 address: fe80::18cb:eb5a:28c0:35f1%5
IPv6 DNS servers: 2600:1700:58b2:8220::1
IPv4 address: 192.168.1.67
IPv4 DNS servers: 192.168.1.254
DNS suffix search list: attlocal.net
Manufacturer: Ralink Technology, Corp.
Description: 802.11n Wireless LAN Card
Driver version: 5.0.57.1
Physical address (MAC): 74-DE-2B-D4-1B-AA

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

That all looks right. Except it’s missing any DHCP info.

0 Vote Up Vote Down
William Lucid answered 4 years ago

There could be an “Advance Security Feature” on your Internet providers “Gateway/Modem/Router.”  I experienced this awhile back; I could not connect, what was happening is the number of attempts to connect was “seen” as a network attack and the “Advance Security” feature was denying the connection.  I found this by checking  the ISP’s router logs.  I turned off the “Advance Security” feature; after installing third-party “Antivirus” software.  My ISP provider is Comcast; however, AT&T Fiber may have similar feature. This is likely; if they have done away with their “Antivirus” software, it is now “built-in” to the “Gateway/Modem/Router.”

ISPs are “pushing” firmware updates to their devices; if your ESP device suddenly stops connecting, I would suspect a “firmware update and/or security patches.”  “Pushing” software and security updates is quite common in businesses today.

William

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

I tried yesterday using my phone as a hotspot and still could not connect.

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

I now am trying with a Wemos D1 R1 that I bought as a Uno Rev2 with wifi. Turns out it was the Wemos ESP8266. In any case I loaded the Webserver sketch from RNT on the board. Tried to run it to get the ip address but I get a bunch (maybe 50) strange characters followed by “Connecting to xxxxxxx” and then just …… I get the Wemos board close to the phone hotspot. The Wemos is connected to a USB 2.0 on my laptop. I can’t get this to work.

0 Vote Up Vote Down
William Lucid answered 4 years ago

Might try this to see if you will connect using a static ip:
Test_WiFi_using_static_ip.ino

Need to change the #include <wifi.h> to #include <ESP8266WiFi.h> for your Wemos D1 R2.

Edit:  Senior moment ; syntax error  change Serial.print(115200); to Serial.begin(115200);  –no wonder all the strange characters!

 

Very close to what I use in my projects; only ip, gateway and dns have been changed.  Sketch will keep trying to connect after 20 seconds; usually see three connection attemps.  Might recond MAC address for future use.

Another sketch to try; is to scan available WiFi networks:  WiFiScan.ino

William

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

William, I received the following error message when I tried the first sketch.
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “WeMos D1 R1, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

C:\Users\Robert Gillespie\Documents\Arduino\WiFiStaticip\WiFiStaticip.ino: In function ‘void wifi_Start()’:

WiFiStaticip:21:8: error: ‘class WiFiClass’ has no member named ‘mode’

WiFi.mode(WIFI_STA);

^

WiFiStaticip:21:13: error: ‘WIFI_STA’ was not declared in this scope

WiFi.mode(WIFI_STA);

^

WiFiStaticip:27:34: error: no matching function for call to ‘WiFiClass::macAddress()’

Serial.println(WiFi.macAddress());

^

C:\Users\Robert Gillespie\Documents\Arduino\WiFiStaticip\WiFiStaticip.ino:27:34: note: candidate is:

In file included from C:\Users\Robert Gillespie\Documents\Arduino\WiFiStaticip\WiFiStaticip.ino:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi\src/WiFi.h:137:14: note: uint8_t* WiFiClass::macAddress(uint8_t*)

uint8_t* macAddress(uint8_t* mac);

^

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi\src/WiFi.h:137:14: note: candidate expects 1 argument, 0 provided

WiFiStaticip:33:28: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

WiFi.begin(ssid, password);

^

In file included from C:\Users\Robert Gillespie\Documents\Arduino\WiFiStaticip\WiFiStaticip.ino:1:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi\src/WiFi.h:79:9: error: initializing argument 1 of ‘int WiFiClass::begin(char*, const char*)’ [-fpermissive]

int begin(char* ssid, const char *passphrase);

^

WiFiStaticip:50:8: error: ‘class WiFiClass’ has no member named ‘waitForConnectResult’

WiFi.waitForConnectResult();

^

WiFiStaticip:52:49: error: ‘class WiFiClass’ has no member named ‘waitForConnectResult’

Serial.printf(“Connection result: %d\n”, WiFi.waitForConnectResult());

^

Multiple libraries were found for “WiFi.h”

Used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi

Not used: C:\Users\Robert Gillespie\Documents\Arduino\libraries\WiFiNINA-1.8.2

Not used: C:\Users\Robert Gillespie\Documents\Arduino\libraries\WiFiEspAT

exit status 1

‘class WiFiClass’ has no member named ‘mode’

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

0 Vote Up Vote Down
William Lucid answered 4 years ago

Did you change the “#include” to “#include <ESP8266WiFi.h>” ?   I was late editing my post; sorry.
Which version of the ESP8266 core do you have installed?

Type “ESP8266” in the “Board Manager” search text box; next section thaat opens after pressing enter, will show what version is installed.  I am using ESP8266 Core version 2.7.4

Checking for correct syntax for  StA mode.

WiFi.mode(WIFI_STA);  is correct for ESP8266

William

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Used your 2nd program to scan. It gave me the networks that are connected. I had been using an incorrect letter on my network name. I thought it was an l and your program showed me it was an I. I have it working. Thank you so much.

0 Vote Up Vote Down
William Lucid answered 4 years ago

Robert, Glad you were able to get Wifi workiing.

WiFiScan.ino is from Arduino IDE “Example” for lolin(Wemos) D1 R2 board, ESP8266Wifi, Wifiscan.

See my edit for the first program; I linked … had a senior moment!

William

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Thanks William. Your post fixed it for me.
Bob

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
Is everything working as expected now?

0 Vote Up Vote Down
Robert Gillespie answered 4 years ago

Yes ma’am.  Thanks for follow-up.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.