<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[esp32-g - Earth Data Labs]]></title><description><![CDATA[Sensing our World in real-time]]></description><link>https://eadalabs.com/</link><image><url>https://eadalabs.com/favicon.png</url><title>esp32-g - Earth Data Labs</title><link>https://eadalabs.com/</link></image><generator>Ghost 3.41</generator><lastBuildDate>Thu, 26 Mar 2026 01:03:01 GMT</lastBuildDate><atom:link href="https://eadalabs.com/tag/esp32-g/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[ESP32G Smart Ethernet Gateway]]></title><description><![CDATA[<p>I recently stumbled on the AI Thinker's "ESP32-G"  WiFi+BLE+Ethernet smart gateway because of its cost and form factor.</p><p>The gateway is available at 98CNY (~15 USD) on <a href="https://item.taobao.com/item.htm?id=633468623184">Tabao</a>, which makes it even more attractive than the low-cost TpLink <a href="https://openwrt.org/toh/tp-link/tl-wr703n">WRT54GL</a> routers, considering the vibrant Espressif  eco-system.</p><figure class="kg-card kg-image-card"><img src="https://eadalabs.com/content/images/2022/01/image.png" class="kg-image" alt="ESP32-G Smart Wifi, Ethernet, Bluetooth Gateway" srcset="https://eadalabs.com/content/images/size/w600/2022/01/image.png 600w, https://eadalabs.com/content/images/size/w1000/2022/01/image.png 1000w, https://eadalabs.com/content/images/size/w1600/2022/01/image.png 1600w, https://eadalabs.com/content/images/2022/01/image.png 1988w" sizes="(min-width: 720px) 720px"></figure><p> The primary objective</p>]]></description><link>https://eadalabs.com/esp32g-smart-ethernet-gateway/</link><guid isPermaLink="false">61d8fe2b7aebff6a8aa944eb</guid><category><![CDATA[esp32]]></category><category><![CDATA[ethernet]]></category><category><![CDATA[esp32-g]]></category><category><![CDATA[bridge]]></category><category><![CDATA[gateway]]></category><category><![CDATA[esp-idf]]></category><dc:creator><![CDATA[Ron J]]></dc:creator><pubDate>Sat, 08 Jan 2022 03:45:38 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1627660080110-20045fd3875d?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxMTc3M3wwfDF8c2VhcmNofDEwNXx8Ymx1ZXByaW50fGVufDB8fHx8MTY0MTYzMDA3Nw&amp;ixlib=rb-1.2.1&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1627660080110-20045fd3875d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDEwNXx8Ymx1ZXByaW50fGVufDB8fHx8MTY0MTYzMDA3Nw&ixlib=rb-1.2.1&q=80&w=2000" alt="ESP32G Smart Ethernet Gateway"><p>I recently stumbled on the AI Thinker's "ESP32-G"  WiFi+BLE+Ethernet smart gateway because of its cost and form factor.</p><p>The gateway is available at 98CNY (~15 USD) on <a href="https://item.taobao.com/item.htm?id=633468623184">Tabao</a>, which makes it even more attractive than the low-cost TpLink <a href="https://openwrt.org/toh/tp-link/tl-wr703n">WRT54GL</a> routers, considering the vibrant Espressif  eco-system.</p><figure class="kg-card kg-image-card"><img src="https://eadalabs.com/content/images/2022/01/image.png" class="kg-image" alt="ESP32G Smart Ethernet Gateway" srcset="https://eadalabs.com/content/images/size/w600/2022/01/image.png 600w, https://eadalabs.com/content/images/size/w1000/2022/01/image.png 1000w, https://eadalabs.com/content/images/size/w1600/2022/01/image.png 1600w, https://eadalabs.com/content/images/2022/01/image.png 1988w" sizes="(min-width: 720px) 720px"></figure><p> The primary objective of this gateway is to allow external Bluetooth or Wifi-mesh devices to connect to the LAN. The  Software  running on the gateway even comes with an MQTT client used to forward the message from the IOT devices connected to the gateway (see the <a href="https://docs.ai-thinker.com/_media/esp32-g_gateway_user_manual.pdf">doc</a> for more info).</p><p>Anyways, regardless of how nice the preloaded SW is, the real question is can one flash the gateway with a custom software... and the answer is of course yes! But, first, let's have a look inside the box:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://eadalabs.com/content/images/2022/01/image-1.png" class="kg-image" alt="ESP32G Smart Ethernet Gateway" srcset="https://eadalabs.com/content/images/size/w600/2022/01/image-1.png 600w, https://eadalabs.com/content/images/2022/01/image-1.png 970w" sizes="(min-width: 720px) 720px"><figcaption>Inside the ESP32-G</figcaption></figure><p>It's actually quite simple, which is not a surprise considering the price. The Ethernet controller is an LAN8720, the same as the one used in the WT32-ETH01. There is also a fully wired CH340 Serial TTL converter which allows to flash the gateway only using the USB port. And the gateway also exposes 6 GPIOs which can be used to add extra sensor or modules. Cool! </p><p>In the previous post, I have been using the WT32-ETH01 configuration to drive the Ethernet LAN. Let's see how the configuration changes:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://eadalabs.com/content/images/2022/01/image-2.png" class="kg-image" alt="ESP32G Smart Ethernet Gateway" srcset="https://eadalabs.com/content/images/size/w600/2022/01/image-2.png 600w, https://eadalabs.com/content/images/size/w1000/2022/01/image-2.png 1000w, https://eadalabs.com/content/images/size/w1600/2022/01/image-2.png 1600w, https://eadalabs.com/content/images/2022/01/image-2.png 1860w" sizes="(min-width: 720px) 720px"><figcaption>ESP32-G pinout and LAN8720 wiring</figcaption></figure><p>The main difference with the WT32-ETH01 is that there is no external oscillator  to drive the LAN8720, so the clock needs to be provided by the ESP32, which it does via the GPIO 17. The other difference is the Reset (aka Power) PIN, which is using GPIO5 on the ESP32-G, while it was GPIO16 on the WT32-ETH01:</p><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th>Configuration</th>
<th>ESP32-G</th>
<th>WT32-ETH01</th>
</tr>
</thead>
<tbody>
<tr>
<td>Power (Reset)</td>
<td>5</td>
<td>16</td>
</tr>
<tr>
<td>Phy Address</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>MDIO</td>
<td>18</td>
<td>18</td>
</tr>
<tr>
<td>MDC</td>
<td>23</td>
<td>23</td>
</tr>
<tr>
<td>Clock Mode</td>
<td>OUT</td>
<td>IN</td>
</tr>
<tr>
<td>Clock GPIO</td>
<td>17</td>
<td>0</td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><p>The following initialisation code does work fine:</p><pre><code class="language-C">#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_POWER_PIN 5
#define ETH_MDC_PIN 23
#define ETH_MDIO_PIN 18
#define ETH_ADDR 1

void initialize_ethernet(void)
{
    eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
    eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
    phy_config.phy_addr = ETH_ADDR;
    phy_config.reset_gpio_num = ETH_POWER_PIN;

    mac_config.smi_mdc_gpio_num = ETH_MDC_PIN;
    mac_config.smi_mdio_gpio_num = ETH_MDIO_PIN;

    mac_config.clock_config.rmii.clock_mode = EMAC_CLK_OUT;
    mac_config.clock_config.rmii.clock_gpio = EMAC_CLK_OUT_180_GPIO;

    esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&amp;mac_config);
    esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&amp;phy_config);

    esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
    ESP_ERROR_CHECK(esp_eth_driver_install(&amp;config, &amp;s_eth_handle));
}</code></pre><p>Et voila, that's all what is needed to start using this cool ESP32-Gateway. In my case, I have already added an extra $3 GPS module. </p><figure class="kg-card kg-image-card"><img src="https://eadalabs.com/content/images/2022/01/image-4.png" class="kg-image" alt="ESP32G Smart Ethernet Gateway" srcset="https://eadalabs.com/content/images/size/w600/2022/01/image-4.png 600w, https://eadalabs.com/content/images/size/w1000/2022/01/image-4.png 1000w, https://eadalabs.com/content/images/size/w1600/2022/01/image-4.png 1600w, https://eadalabs.com/content/images/2022/01/image-4.png 1776w" sizes="(min-width: 720px) 720px"></figure><p>In the next post, I'll be looking at enabling the WIFI mesh capability.</p>]]></content:encoded></item></channel></rss>