DEV Community

Thilak Kumar
Thilak Kumar

Posted on

How I Initialized Wi-Fi in IRUTESAM V1.0

When developing IRUTESAM V1.0, Wi-Fi functionality was one of the first features I implemented. Since the ESP32 comes with built-in Wi-Fi support, I wanted to use it as the foundation for network scanning and wireless analysis.

Why Wi-Fi Initialization Matters

Before scanning nearby networks, the ESP32 must be configured properly. Incorrect initialization can lead to unstable scans, connection issues, or unnecessary memory usage.

For IRUTESAM V1.0, the device operates in Station Mode, allowing it to detect nearby Wi-Fi networks without creating its own access point.

The Initialization Code

The Wi-Fi module is initialized using a simple function:

cpp id="e2z2k0"
void wifiModuleInit() {
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("[WiFi] Module ready");
}
Enter fullscreen mode Exit fullscreen mode

What Each Line Does

cpp id="gzhhzi"
WiFi.mode(WIFI_STA);
Enter fullscreen mode Exit fullscreen mode

Sets the ESP32 to Station Mode.

cpp id="4yj5h6"
WiFi.disconnect();
Enter fullscreen mode Exit fullscreen mode

Ensures the device is not connected to any previous network.

cpp id="fzlcwa"
delay(100);
Enter fullscreen mode Exit fullscreen mode

Provides a short stabilization delay before further operations.

Benefits in IRUTESAM V1.0

  • Faster Wi-Fi scanning
  • Stable network discovery
  • Reduced resource usage
  • Better reliability during wireless analysis

After initialization, the device is ready to scan and display nearby networks through the touchscreen interface.

Conclusion

A proper Wi-Fi initialization routine may look simple, but it is essential for reliable wireless operations. In IRUTESAM V1.0, this setup provides a stable starting point for all Wi-Fi analysis features implemented on the ESP32.

Top comments (0)