Husarnet over Ethernet with ESP32

Hi,

I’m using Husarnet with an ESP32 (and the Husarnet Arduino core) to enable remote OTA updates and it’s working fantastically with built-in WiFi. However, I now wish to add Ethernet connectivity for my project. My hardware is supported by the Arduino Ethernet library, but I’m unsure how to integrate the Husarnet server and client libraries with Ethernet. Does anyone know of a solution to this?

Cheers

Hi, to be honest I haven’t tested ESP32 with Ethernet and Husarnet so far, so it’s hard to say whether will it work out of the box, or does it need any extra tweaking.

While reviewing part responsible for ESP32, it looks like only WiFi option is available, but you never know until you try - https://github.com/husarnet/husarnet/tree/master/esp32 (Husarnet Client recently was open sourced).

I prefer using Husarnet with AsyncTCP library and there is a topic: https://github.com/me-no-dev/AsyncTCP/issues/10 , so maybe it will work with Husarnet out-of-the box :thinking:

This infographics shows nicely how to convert AsyncTCP based project working in LAN, to the project working over internet with Husarnet VPN https://husarnet.com/iot#fb-easy-to-integrate

Unfortunately I don’t have esp32 with ethernet to check how that configuration works :frowning: .

Thanks for the response Dominik. I will have to look into this further.

Hello,

i run over ethernet without problems.

Simply add in you working code with wifi:

#include <ETH.h>
#define ETH_ADDR 0
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_POWER 5
#define ETH_MDC 23
#define ETH_MDIO 18
#define ETH_CLK ETH_CLOCK_GPIO17_OUT

and in to setup:
ETH.begin(ETH_ADDR, ETH_POWER, ETH_MDC, ETH_MDIO, ETH_TYPE, ETH_CLK);

///ETH config maybe different on your board(i dont know details)
LINK to schematic of my hardware - for reference

///wait 10secs

///print IP adress:

Serial.print("ETH MAC: “);
Serial.print(ETH.macAddress());
Serial.print(”, IPv4: ");
Serial.println(ETH.localIP());

That’s great! Good to know that ESP32 & Husarnet works curently not only with Wi-Fi but also with Ethernet! Thanks for sharing!