Diagnose ESP32 Wi-Fi Before Blaming the Sensor

By

A remote sensor can stop updating even while its ESP32 is connected to an access point. A useful diagnostic log separates radio discovery, association, IP assignment and delivery to the application. Test each stage on a network you control before adding the sensor’s other features.

Start with signal and power

The original ESP32 family uses 2.4 GHz Wi-Fi. Check that the access point actually advertises a compatible network and that its security mode matches your software setup. Place the board near the access point for the first trial and run a station-mode scan. Record the target network’s name, channel and signal reading. Repeat from the intended enclosure or installation position. If the enclosure or placement makes the connection unreliable, solve that issue while the setup is still easy to reach.

Watch the reset log when the radio starts. A reboot or brownout points toward a different problem from an association failure. Try a known good USB cable and a supply suitable for your board. If a USB-powered board connects at the bench but restarts with a peripheral attached, check its power supply and rail voltage during the connection attempt.

Print one milestone at a time

  1. Report whether a scan sees the expected network. Keep private details such as Wi-Fi passwords out of your logs.
  2. Record the station connect or disconnect event and its reason when available. Check the network name and security settings if authentication repeatedly fails.
  3. Wait for the IP assignment event before attempting to send an application request. Use a deadline so the program can recover.
  4. After acquiring an address, test a single request to a known destination. A working Wi-Fi connection can still encounter DNS, server or application errors.

Make recovery visible

Add a retry interval with a maximum delay and log changes in state. If the project collects readings while offline, use a bounded queue or retain the most recent reading according to your application’s needs. Keep network callbacks small and hand off longer work to the main program or an appropriate task.

Test by disconnecting the access point briefly and bringing it back. Record how long the board takes to reconnect and whether the first new reading reaches the intended destination. That test gives you a repeatable check to run after changes to the code, enclosure or power source.

Sources and image credit