Boosting My IoT Network: ESP32 into a Wi-Fi Repeater

As a DIY enthusiast, I'm always on the lookout for ways to improve the connectivity of my IoT devices around the house. I have several gadgets like smart lights, sensors, and a few home automation devices, but sometimes they struggle to maintain a strong connection in certain parts of my home. That's when I thought, "Why not use an ESP32-S3 as a Wi-Fi repeater?".


The ESP32-S3 is a powerful microcontroller with enhanced Wi-Fi capabilities compared to its predecessor, and it seemed like the perfect solution to extend the reach of my home network without investing in an expensive mesh router. Here’s how I managed to turn my ESP32-S3 into a Wi-Fi repeater, and I’ll walk you through each step, from setting up the hardware to configuring the software.


Why I Chose the ESP32-S3 for This Project


Before diving into the setup, let me explain why I picked the ESP32-S3. The ESP32-S3 is an upgraded version of the standard ESP32, featuring more processing power, additional GPIO pins, and better support for AI and machine learning applications. These features make it ideal for Wi-Fi-related projects and ensure stable performance, especially when dealing with multiple connected devices. And since it comes with both Wi-Fi and Bluetooth, it’s great for any IoT project that requires flexible communication capabilities.


What I Needed for the Project


To get started, I gathered the following items:


- ESP32-S3 Development Board (I used the ESP32-S3 DevKitC)

- Micro-USB Cable (to power and program the ESP32-S3)

- Computer (running the Arduino IDE, which I’ll explain how to set up)

- Wi-Fi Network (the one I wanted to extend)


I also made sure I had a decent power source because I wanted my repeater to run reliably without interruptions. I planned to power the ESP32-S3 using a USB adapter, but even a simple USB port on a computer could work for testing.


Step 1: Setting Up the Arduino IDE for ESP32-S3


The first step was setting up the Arduino IDE to support the ESP32-S3. If you're new to this, don't worry—it's pretty straightforward:


1. I opened the Arduino IDE on my computer.

2. Went to File > Preferences.

3. In the Additional Boards Manager URLs field, I pasted the following URL:

https://dl.espressif.com/dl/package_esp32_index.json
4. Then, I went to Tools > Board > Boards Manager, searched for "ESP32," and installed the ESP32 package. This gave me access to a wide range of ESP32 boards, including the ESP32-S3.

5. After installation, I selected ESP32S3 Dev Module from the Tools > Board menu, making sure the right board was selected.


This setup allowed my Arduino IDE to recognize the ESP32-S3 and made it ready for programming.


Step 2: Installing the Necessary Libraries


Since I was planning to use the ESP32-S3 as a Wi-Fi repeater, I needed a library to manage its dual-mode Wi-Fi capability—acting both as a client to connect to my main Wi-Fi and as an Access Point (AP) for other devices.


I found a very useful library for this purpose on GitHub, the ESP32 Wi-Fi Repeater by Martin Ger. I downloaded the library from the repository:


- The library is available at:  

https://github.com/martin-ger/esp_wifi_repeater


I extracted the contents into the Arduino libraries folder on my computer. With this library in place, I could easily configure the ESP32-S3 to function as a repeater.


Step 3: Connecting the ESP32-S3 to My Computer


I connected the ESP32-S3 to my computer using a micro-USB cable. It's important to ensure that the right **COM port** is selected under **Tools > Port** in the Arduino IDE. This way, the IDE can properly communicate with the ESP32-S3 for uploading code.


Step 4: Configuring the Wi-Fi Repeater Code


Now came the fun part—writing the code to turn the ESP32-S3 into a Wi-Fi repeater. I created a new sketch in the Arduino IDE and wrote the following code:


#include <WiFi.h>

#include <WiFiAP.h>

#include <WiFiSTA.h>


// Configuration settings

const char* ssid = "YOUR_SSID";         // Replace with your Wi-Fi network SSID

const char* password = "YOUR_PASSWORD"; // Replace with your Wi-Fi network password


void setup() {

  Serial.begin(115200);


  // Start the Wi-Fi connection

  WiFi.mode(WIFI_AP_STA);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }


  Serial.println("");

  Serial.println("Wi-Fi connected!");

  Serial.print("IP address: ");

  Serial.println(WiFi.localIP());


  // Set up the Access Point (AP)

  WiFi.softAP("ESP32_S3_Repeater", "12345678"); // AP SSID and password

  Serial.println("Access Point configured.");

  Serial.print("AP IP address: ");

  Serial.println(WiFi.softAPIP());

}


void loop() {

  // Keep the repeater running

  delay(1000);

}


In this code:

- I replaced `YOUR_SSID` and `YOUR_PASSWORD` with the credentials of my home Wi-Fi network.

- I configured the ESP32-S3 to act as both a client to connect to my existing Wi-Fi and as an access point called ESP32_S3_Repeater with a password of 12345678.


Step 5: Uploading the Code and Testing


With the code ready, I clicked the Upload button in the Arduino IDE. After a few moments, the ESP32-S3 began to run the program. I opened the Serial Monitor (set to 115200 baud) to see the status of the connection.


The output showed that the ESP32-S3 successfully connected to my Wi-Fi network, and the access point was up and running. Here’s what I did to test it:


1. I checked the ESP32_S3_Repeater network on my phone and connected to it using the password 12345678.

2. Once connected, I browsed the internet and tested a few IoT devices like a smart light and a temperature sensor that were out of range before. They connected to the ESP32-S3 repeater without a hitch, and the signal strength was noticeably better.


Step 6: Optimizing the Wi-Fi Repeater for Better Performance


After getting the basic setup working, I wanted to optimize my ESP32-S3 repeater for the best performance:


- Positioning: I placed the ESP32-S3 in a spot where it had a strong signal from my main router. This way, it could effectively extend the coverage without losing too much speed.

- Channel Adjustment: I modified the channel in the code to avoid interference with nearby Wi-Fi networks. Choosing a less crowded channel made a noticeable difference in stability.

- Power Supply: I used a 5V/2A USB adapter to ensure that the ESP32-S3 received enough power, especially since it was running continuously.


Troubleshooting Along the Way


As with any DIY project, I hit a few bumps in the road. Here are some common issues I encountered and how I fixed them:


- ESP32-S3 Not Connecting to Wi-Fi: At first, I couldn’t get the ESP32-S3 to connect to my Wi-Fi. It turned out that my router was set to WPA3 encryption, which isn’t always supported by the ESP32-S3. Switching the router to WPA2 solved this.

- Low Signal Strength: I found that placing the ESP32-S3 closer to the router significantly improved signal quality. Walls and metal objects can interfere, so positioning is key.

- Device Fails to Connect to Repeater: If my devices didn’t connect to the repeater, a quick restart of the ESP32-S3 usually did the trick. It’s important to ensure the repeater is running smoothly.


The Results: A Stable and Extended IoT Network


After setting up and tweaking my ESP32-S3 Wi-Fi repeater, I was impressed by how much better my IoT devices performed. The ESP32-S3 effectively extended the range of my home network, ensuring that my smart devices stayed connected even in areas with weaker signals.


This project was a fun and practical way to use the ESP32-S3’s capabilities, and it saved me from having to invest in additional networking equipment. Plus, it gave me the flexibility to adjust the setup as my needs change.


Conclusion: Empowering My IoT Projects with DIY Solutions


Turning an ESP32-S3 into a Wi-Fi repeater is a great way to improve connectivity for your IoT devices without breaking the bank. Whether you're a fellow tinkerer like me or just looking for a simple solution to extend your Wi-Fi range, this project is a rewarding way to make the most of your ESP32-S3.


I hope this guide helps you boost your own IoT network and sparks your next DIY project. Happy building!