• 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

Need help with STA vs AP

Q&A Forum › Category: ESP32 › Need help with STA vs AP
0 Vote Up Vote Down
howard lewis asked 6 years ago

I am making a monitor for my shop air compresser to shut the compressor down if the discharge goes higher than 235F. This is the factory setting so I will stick with it. Here is the issue: Most times it can not connect to the WiFi due to distance from router. For the watching of the temp this is not an issue. What I have done is set a timeout such that if it doesn’t connect on startup, it just moves on and watches the probe.

What I want it to do is go to access point mode (maybe?) so that I could at least connect to it with my phone to have a look at the settings. I am not sure how to do this.

So to recap: best choice connect to network, if that is lost or fails switch to AP mode (unless there is a better mode?), from AP mode be able to scan for networks and show choices to connect to.
I am not new to embedded programming, but am super newbie to WiFi, HTML,CSS,all the web things. I understand them when I read them, just not quite up to churning out new code yet.

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi Howard.
I’m sorry for the delay…

If you set it as an access point, you can connect to it with your phone to monitor. We have a tutorial on how to set up your web server as an access point:

  • https://randomnerdtutorials.com/esp32-access-point-ap-web-server/

In that tutorial, we explain the main lines of code you should add to turn your ESP32 into an access point.
To check if the ESP32 is able to connect to Wi-Fi, you can use the following expression.

while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    //add some sort of timer, or counter
  }

But instead of just printing dots, you can create a variable or counter that counts how many times it tries to connect. After a determined number of fails, run another part of the code that sets the access point.

I hope this helps.
Then, let me know if you need further help.
Regards,
Sara

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.