ESP-Hosted Turns ESP32 Into Linux WiFi/BT Adapter

Showing a Raspberry Pi 4 board connected to an ESP32 devboard using jumper wires for the purposes of this project

While we are used to USB WiFi adapters, embedded devices typically use SDIO WiFi cards, and for good reasons – they’re way more low-power, don’t take up a USB port, don’t require a power-sipping USB hub, and the SDIO interface is widely available. However, SDIO cards and modules tend to be obscure and proprietary beyond reason. Enter ESP-Hosted – Espressif’s firmware and driver combination for ESP32 (press release)(GitHub), making your ESP32 into a WiFi module for either your Linux computer (ESP-Hosted-NG) or MCU (ESP-Hosted-FG). In particular, ESP-Hosted-NG his turns your SPI- or SDIO-connected ESP32 (including -S2/S3/C2/C3/C6 into a WiFi card, quite speedy and natively supported by the Linux network stack, as opposed to something like an AT command mode.

We’ve seen this done with ESP8266 before – repurposing an ESP8089 driver from sources found online, making an ESP8266 into a $2 WiFi adapter for something like a Pi. The ESP-Hosted project is Espressif-supported, and it works on the entire ESP32 lineup, through an SDIO or even SPI interface! It supports 802.11b/g/n and even Bluetooth, up to BLE5, either over an extra UART channel or the same SDIO/SPI channel; you can even get BT audio over I2S. If you have an SPI/SDIO port free and an ESP32 module handy, this might just be the perfect WiFi card for your Linux project!

There are some limitations – for instance, you can’t do AP mode in the NG (Linux-compatible) version. Also, part of the firmware has blobs in it, but a lot of the firmware and all of the driver are modifiable in case you need your ESP32 to do even more than Espressif has coded in – this is not fully open-source firmware, but it’s definitely way more than the Broadcom’s proprietary onboard Raspberry Pi WiFi chip. There’s plenty of documentation, and even some fun features like raw transport layer access. Also, of note is that this project supports ESP32-C6, which means you can equip your project with a RISC-V-based WiFi adapter.

Title image from [zhichunlee].

25 thoughts on “ESP-Hosted Turns ESP32 Into Linux WiFi/BT Adapter

  1. In fairness, the ESP8089 driver was Espressif-supported too.

    I found the original driver in a damp corner of GitHub as part of a Rockchip tablet sdk (damn, has it already been 8 years?!). But at the time it wasn’t advertised or distributed officially by Espressif. Sprite_tm graciously convinced their legal to GPLv2 the host driver code and Apache license the device blob. Even though it never made it into the kernel, a few hacker projects were able to be commercialized because of the permissive license.

    There really aren’t any other hacker-accessible wifi network adapters like this without resorting to USB, so I’m glad to see them continue the trend even if the binary blobs make us cringe a bit.

  2. Have we come full circle? The esp8266 was meant for adding wifi to other systems. This whole “you can run code on it” has just been an enjoyable diversion it seems. We’re back to using them as wifi chipsets. Lovely!

    1. Came here to say exactly this! Espressif got discovered by the community, people started running code on the processor, and it turned into an embedded platform. Adding WiFi to something else was literally what the things were originally for though!

  3. For a “microcontroller” use, what do you go for? Esp as a wifi module in conjonction with another microcontroller or as a standalone?

    I’m having a bit of trouble deciding how much energy I have to put into the espressif ecosystem.
    I grew out of the Arduino ecosystem and really hitting the ceilling of what the basic chips can offer in terms of space and more generally performance. I especially got accustomed to their libraries and the ease of use, but got bitten back by assumption made by some of these libraries (defining some interrupt for example) and the way the Arduino framework was written (blocking..).
    So I’m in the process of pulling myself out of this framework and go a step further with a more “serious” or at least capable and up to date plateform.

    Stm32 family seems to be a very serious contender, bonus point being ARM based. Esp32 very interesting for the whole Bluetooth/wifi.
    I feel like there is no point, you choose the platform most suited to the task and write some abstraction for your microcontroller so that if it has to be changed, it easily could.

    I still would find interesting how many times do you use an Esp8266 or esp32 (any from the family) as a co processor and in which configuration?

      1. Oh, and on the “how many times” question… the first time I used an ESP as a coprocessor was pretty much the last, as it was obvious from the start that the ESP was a much better choice for most (but not quite all) things than my micro of choice up until that time.

    1. STM32 is a good choice but if you want to stick with ESP32 if you need WiFi or Bluetooth, you can just use it with their own IDE or VS Code extension which is much better than the Arduino support for it, it allows much better control of what it is doing and is built on FreeRTOS which is worth knowing anyway.

  4. Not too sure about the multi-link documentation line, Arya. Those of us with poorer vision and some colour blindness (me!) might consider it a little bit too “entertaining” to find all of the links in that sentence (hover-and-click mode). :-) Good article though, thanks!

  5. “Also, of note is that this project supports ESP32-C6, which means you can equip your project with a RISC-V-based WiFi adapter.”

    Is there any reason to care that my wifi adapter runs on a RISC V processor? Someone please sell this to me as if it matters.

    1. Your wallet may care. ESP32-C3 sells in qty 1 for $1 on Digikey, while the original ESP32-D0WD sells for $1.50. Part of that extra $0.50 goes to Cadence for royalties on two Tensilica cores.

        1. Nope, all of the C-series is RISC-V, as are the P and H series. The only remaining Tensilica arch products are the ESP8266, original ESP32, and ESP32-S series, and even the ESP32-S3 has a RISC-V core for power management. If that wasn’t the case, it would be a miracle that the fleet of ESP32-C3 boards I have is running ESPHome I built with PlatformIO target toolchain-riscv32-esp.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.