ESP32-Gateway module

Since the ESP32-Gateway module is both wired ethernet and WiFi, is it, or could it be possible for it to act as a bridge and effectively a WiFi extender?

Although I’m fairly sure my EVSE will be within range of the nearest WiFi base station, I like the idea of running ethernet cable to it, not only for its own perfect connection, but then providing good WiFi for anything else in that location. I’m really thinking of the car itself. Seems to me that the EVSE able to act as a WiFi base station (particularly for the car) would be a very worthwhile facility.

Also thinking that if 2 EVSEs are in the same location, but WiFi signal is poor, a single ethernet cable to one of them which acts as a base station and the other just hops onto the WiFi of the first. So only a single ethernet cable is required and no need to run a separate WiFi base station there, or ethernet switch and gateway in each EVSE.

I’m betting the gateway hardware is capable and I think this would be extremely useful.

Maybe it’s already possible???

No, I’m afraid it can’t work as a WiFi extender.

Why? Surely just a software issue?

Sure, it’s just not possible with our current FW. Feel free to make changes, however I doubt the ESP32 would be a very good WiFi extender since it’s quite a slow low power device. I would love to be proven wrong, that would be a cool feature!

Ok, just software, so not impossible then. :slightly_smiling_face:

I seem to recall that simply shuffling packets between 2 interfaces is not CPU intensive. There’s no packet inspection required, no routing. Just copy from one interface to the other.

Maybe someone has already written the code to do this on the ESP32 and it could be incorporated into the OpenEVSE FW?

1 Like

Did you get anywhere with this? Thanks.

I’ve already set up a wifi gateway using esp32.
It works but is extremely slow. Sufficient for low bandwidth transmission anyway .
Using WiFi.softAP() is what you are looking for
This example bridge wifi to wifi:

#include <WiFi.h>

const char* ssid = “myAP”;
const char* password = “super_strong_password”;

IPAddress local_ip(192,168,0,1);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);

void setup()
{
Serial.begin(115200);
Serial.println(“\n[*] Creating AP”);

WiFi.mode(WIFI_AP);
WiFi.softAPConfig(local_ip, gateway, subnet);
WiFi.softAP(ssid, password);

Serial.print("[+] AP Created with IP Gateway ");
Serial.println(WiFi.softAPIP());
}

void loop(){}

That is what the OpenEVSE already does in AP mode. I assume that it sets up the NAT and IP forwarding? Wouldn’t be a huge change to add a mode for this. That being said, that is not strictly what you would want from an access point, you want to share the same IP network as of the wired side over the WiFi side (bridge mode)

Funny to see ChatGPT view of this

Sure, here’s an example code that demonstrates how to use the ESP32 as a WiFi to Ethernet bridge, where devices connected to the Ethernet port will be able to communicate with devices connected to the WiFi network and share the same IP address range:

#include <WiFi.h>
#include <ETH.h>

// Replace with your network credentials
const char* ssid = “MY_SSID”;
const char* password = “MY_PASSWORD”;

// Create a WiFi client object
WiFiClient wifi_client;

// Create an Ethernet client object
EthernetClient eth_client;

void setup() {
Serial.begin(115200);

// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.println(“Connecting to WiFi…”);
delay(1000);
}
Serial.println(“Connected to WiFi”);

// Start Ethernet
ETH.begin();

// Wait for Ethernet to be connected
while (ETH.linkStatus() == 0) {
Serial.println(“Ethernet not connected”);
delay(1000);
}
Serial.println(“Connected to Ethernet”);
}

void loop() {
// Check for data from WiFi client
if (wifi_client.available()) {
// Read data from WiFi client and write to Ethernet client
eth_client.write(wifi_client.read());
}

// Check for data from Ethernet client
if (eth_client.available()) {
// Read data from Ethernet client and write to WiFi client
wifi_client.write(eth_client.read());
}
}

Interesting, I think that is the other way round… Where the main network is connected via WiFi… Maybe that is bridge mode… I would imagine setting up an AP is similar, start up the AP (but without DHCP) and then do the wired/WiFi forwarding