logo elektroda
logo elektroda
X
logo elektroda

ESP32 does not connect to WiFi - USB power, interference, faulty board?

Przybyłek 3150 12
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17998325
    Przybyłek
    Level 14  
    Posts: 208
    Help: 1
    Rate: 43
    I have an interesting case, the circuit is soldered so it is difficult to swap ESP.


    It sees the network and does not want to connect to it, ESP not on the board works without a problem. Is it something interference from outside(other chips)? - I supply power from USB
    Is it a faulty board?
    Or any other idea?
    Scanning the wifi networks it shows me both but doesn't connect. Sometimes after a day of idling it will connect 3-8 times and then it won't connect anymore. The program only connects to the wifi with a static IP.
  • ADVERTISEMENT
  • #2 17998359
    piterek-23
    Level 33  
    Posts: 3321
    Help: 162
    Rate: 426
    It would be best if you showed a diagram of your board.
  • ADVERTISEMENT
  • #3 17998613
    Anonymous
    Level 1  
  • #4 17998656
    Przybyłek
    Level 14  
    Posts: 208
    Help: 1
    Rate: 43
    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #5 17998673
    Anonymous
    Level 1  
  • #6 17998731
    Przybyłek
    Level 14  
    Posts: 208
    Help: 1
    Rate: 43
    I don't even initiate anymore, I just upload an example i.e. download after DHCP. I think I have 2 damaged ESP modules, I mean the processor. The one as written connects once in 10 times. Always the first one when it is cold. The other one does not program itself, it sees it but does not respond :/ The other two work. These are modules, some kind of WEMOS clones. Only that I have to change them to see if it is the influence of some periphery.
    As a curiosity, the device will control the greenhouse (watering, irrigation, lighting, ventilation) and the watering of the vegetable garden.
  • #7 17998747
    Anonymous
    Level 1  
  • #8 17998944
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 229
    Problems with WIFI operation are usually power supply related, sometimes replacing the cable with a shorter one, adding a capacitor at the power pin helps. The boards are made some better, some worse, sometimes you have to run a soldering iron over the pins. Admittedly I associate Wemos mainly with ESP8266, but I actually found something similar on Aliexpress with ESP32, only the capacitors on this module look very poor compared to e.g. DOIT Devkit V1.
    Helpful post? Buy me a coffee.
  • #9 17998956
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #12 18002847
    Anonymous
    Level 1  
  • #13 18003054
    Anonymous
    Level 1  

Topic summary

✨ The discussion revolves around an ESP32 module that intermittently fails to connect to WiFi despite detecting the network. The user suspects potential issues such as interference from other components, power supply instability from USB, or a faulty board. Responses suggest checking the board's wiring and power source, using a more stable 5V supply, and examining the antenna's performance. The user mentions using WEMOS clones of the ESP32, which may have quality variations. Suggestions include implementing a retry mechanism in the code for WiFi connection attempts and considering the differences between various ESP32 modules. The conversation highlights the importance of proper initialization and configuration in resolving connectivity issues.
Generated by the language model.

FAQ

TL;DR: ESP32 Wi‑Fi needs >=500 mA headroom; "Provide at least 500 mA." Most "won’t connect" cases trace to power, antenna, or blocking code. Use a stable 5 V source, short cable, decoupling, and retry logic. For makers whose ESP32 sees SSIDs but won’t associate. [“ESP32 Hardware Design Guidelines”]

Why it matters: You’ll fix flaky ESP32 Wi‑Fi fast and avoid chasing phantom firmware bugs.

Quick Facts

Why does my ESP32 see Wi‑Fi but never connect on USB power?

Brownouts and noise from weak USB ports cause handshake failures. Use a stable 5 V supply, a short cable, and add a capacitor at the power pin. Reflow suspect solder joints on clone boards. “WiFi problems are usually power‑supply related.” [Elektroda, kaczakat, post #17998944]

How can I test if the antenna or module is the problem?

Put the ESP32 in AP mode and measure signal strength from a phone. Move a few meters away and compare RSSI with a known‑good board. If RSSI is far lower, suspect antenna layout or damage.
  1. Flash AP example.
  2. Scan with a phone and note RSSI.
  3. Compare vs another ESP32 at the same spot. [Elektroda, khoam, post #17998747]

Will moving Wi‑Fi connect code from setup() to loop() fix it?

Not by itself. setup() and loop() run in the same FreeRTOS task on core 1. The Wi‑Fi stack executes on core 0. Add timeouts and retries rather than an infinite wait. “Arduino HAL in ESP32 is based entirely on RTOS‑SDK.” [Elektroda, khoam, post #18003054]

How should I set a static IP on ESP32 (Arduino) so it actually connects?

Set network parameters before connecting. Call WiFi.config(localIP, gateway, subnet, dns) before WiFi.begin(ssid, password). Ensure gateway and DNS match your router’s subnet. Mismatched settings silently prevent association. [“ESP32 Arduino: WiFi Library”]

Does USB cable length really affect ESP32 Wi‑Fi reliability?

Yes. Long or thin cables drop voltage during Wi‑Fi bursts, causing resets and failed association. Use a short, thick cable and add a local bulk capacitor on 5 V or 3.3 V near the module. [Elektroda, kaczakat, post #17998944]

Could my board be a bad clone or faulty ESP32 module?

Yes. Many WEMOS‑style ESP32 boards are non‑Espressif clones with weaker power design. Compare against an official ESP‑WROOM‑32 reference board. If the clone misbehaves while a reference board works, suspect the module. [Elektroda, khoam, post #18002606]

What’s a safe retry pattern for Wi‑Fi without freezing my sketch?

Avoid blocking while loops. Periodically check connection status in loop(), and call WiFi.begin() only when disconnected. Add backoff between attempts and log status codes. This mirrors the forum fix of moving logic into loop with retries. [Elektroda, Anonymous, post #18002847]

It connects only once when cold, then fails—what does that indicate?

That pattern was observed: “Always the first one when it is cold.” It suggests marginal hardware or power sensitivity. Swap modules, test with a stable 5 V supply, and recheck antenna as AP. These isolate board versus environment. [Elektroda, Przybyłek, post #17998731]

How do I power the board correctly for Wi‑Fi tests?

Feed a regulated 5 V source into the board’s 5 V pin instead of a random USB port. Keep grounds solid and decouple near the module. Then retest association and DHCP to rule out power issues. [Elektroda, khoam, post #17998673]

Do core assignments in FreeRTOS affect Wi‑Fi stability?

Your Arduino loop runs on core 1, while the Wi‑Fi driver runs on core 0. Heavy work pinned to core 0 can hurt Wi‑Fi timing. Keep RF‑critical code non‑blocking. “WiFi stack execute on core 0.” [Elektroda, khoam, post #18003054]

How do I quickly check RF interference on my custom board?

Run the ESP32 as an AP and log RSSI on a phone while moving cables or turning peripherals on. Large RSSI dips near specific parts point to interference or poor antenna clearance. [Elektroda, khoam, post #17998747]

My code blocks on while(WiFi.status()!=WL_CONNECTED)—is that wrong?

Yes. Blocking prevents other tasks from running and masks timeouts. Add a connection timeout, then retry in loop() with delays or backoff. This simple change resolved repeated failures for a forum user. [Elektroda, Anonymous, post #18002847]

What differences between ESP‑WROOM‑32 and ESP‑32S matter for connectivity?

Original ESP‑WROOM‑32 modules follow Espressif’s RF and power guidelines and carry certifications. ESP‑32S and clones can vary in antenna and power components. Prefer documented originals for RF‑critical builds. [Elektroda, khoam, post #18002606]

How much current headroom and decoupling does ESP32 Wi‑Fi need?

Design for >=500 mA available on the 3.3 V rail to handle Wi‑Fi current transients. Place 10 µF bulk and 0.1 µF ceramic decouplers close to the ESP32 power pins with a low‑impedance ground. This prevents association brownouts. [“ESP32 Hardware Design Guidelines”]
Generated by the language model.
ADVERTISEMENT