ESP8266 Raspberry Pi GPIO Wifi


There are many cases where I really wanted a way to have WIFI over the GPIO pins on the Raspberry Pi instead of having to use a USB dongle. This is a method to use a cheap and common ESP8266 module to get full GPIO wifi for ALL versions of the Raspberry Pi.

A little history. The ESP8266 IC (if you haven’t heard of it) is an extremely popular Wifi microcontroller with many cheap modules on the market. It was originally used as a UART serial interface for microcontrollers, but has since been ported over to work as a standalone microcontroller using LUA or Arduino. It is a very fast microcontroller that runs at 80mhz. This is one of my favorite microcontrollers to use for projects because it is fast, cheap, and has wifi.

A few versions of the module have come out including the ESP-12E and ESP-12F (both around $2-$3) that break out the SDIO interface. This was largely pointless, because the SDIO interface is used for the flash memory.

However, it turns out that the ESP8266 is actually a ESP8089 IC just rebranded. The ESP8089 is a SDIO wifi chip for small tablets. If you do not pull down GPIO 15 on boot, as you would when running it as a microcontroller, it runs in SDIO mode and is basically an ESP8089 IC at that point.

This project is based on RPi WiFi project. I have made some modifications to work with the new linux kernel in the new Raspbian and I have written a script to completely automate the process. To use this, you need an ESP-12E or ESP-12F module. The ESP-12F is recommended.

First, wire up the ESP-12F like this.


The 33 ohm resistors are necessary to achieve the SDIO speeds required, so please to not leave them out. It is also better to pull from the 5v rail and have a separate LDO for the ESP8266 module, but pulling directly from a 3.3v rail on the Raspberry pi should work fine.

SSH into your Raspberry Pi and enter the following commands. You might want to expand the filesystem first using raspi-config.

This is going to take a while. So just sit and wait, or go grab a coffee.

When that is done, reboot your Pi.

After reboot, the ESP8266 module should activate. You can do a quick scan to make sure it is working.

It should scan for wireless networks and show you what is available.

Now it will work just like any other WIFI module. Cheers.


About Author

I love to tinker, code, and create electronics. I primarily focus on Raspberry Pi (and other linux SBCs) and Arduino (and other microcontrollers that run on the Arduino platform).

  • Markus

    does the driver for the esp also supports AP mode?
    best regards

  • Alan Penner

    This is a great guide, looks pretty simple. If only I could do any surface mount soldering…

    My ESP-12Fs are on the way, hope I can make it work.

    • The surface mount on the ESP-12 is really easy. Just get yourself a good flux.

  • Mikael Lundgren

    No need for pullup on esp gpio15 mtdo for sdio mode on esp? Or pullup on ch_en? Also reset no pullup? Very nice project, just cant get it to work. MikaelL

    • The gpio15 has an internal pullup, which makes it default into SDIO mode. CH_EN/CH_PD is controlled via the pi to turn the ESP8266 on and off when WIFI is enabled. My driver drives this pin high on boot. I think there may be some issue with the new kernel. I have not used it in a while. You can check out the original project and see if it works better.

  • Worm

    Can advise why 33 ohm resistors? Is it not too low value? Can we increase it to higher value resistor either 1k-5k ohm so we can limit to less current for safety?

    • The 33 ohm resistors are termination resistors. They are for impedance matching. You might be able to get by without them if you design your pcb traces right, but you will most likely deal with signal problems. Since SDIO is high speed, you will often get a “ring” on the trace line due to a mismatch of impedance of the input and output lines. The low value resistor of 33 ohm, is designed to be enough resistance to make the input and output impedances match, without being too high to soften your signal edges. You may be fine with anywhere from 22 – 66 ohm, but I think you will run into signal issues if you go much higher. A lot of that would depend on the signal lines/pcb traces.

      • Worm

        Thanks for the tips on signal issues. How much is the ampere for these signals? I cannot find any documents on these. What I can find is most micro-controllers signals are less than 1mA. If they are 1mA, then is 1k to 3.3k ohm resistor safer? Have you try this? If you do, please let me know if the result good.

  • Kasi Viswanadh Sripada

    i’m using RPI 1 MODEL B ,im unable to find gpio26/sd_dat2 please help me.

  • Armin Oonk

    I am trying to compile the driver again but I am getting some errors. Which seem to prevent the driver from building. I have build and used this driver before on a earlier rasbian.

    Makefile:19: *** No .config found in /lib/modules/4.4.38+/build, please set KBUILD to configured kernel. Stop.

    Full Output:

    Is this a known issue? (Hopefully with a way to get it to work 😀 )

  • Andre van calster

    Excellent work! I have made a small print with a ESP12F module and it works great with my RPi2. However if I put the same SD-card + ESP12F print in my Pi0 it does not work. I looked at journalctl to overview the boot sequence and no ESP… lines seen. I believe the ESP does not start. Please some help would be most welcome. Thanks

    • tinp

      how did you recompile the driver? I cant get this to work on the rpi0 either

  • SlowBro

    I see 12E and 12F chips are recommended. Could it work with an ESP-07S, which has an external antenna and FCC approval? The datasheet lists SDIO as an option, and all of these use the same 8266 chip.

  • nosrev

    Can’t get it work 🙁 Don’t see a new interface after reboot.
    Double checked wiring.
    1) What do you mean by GPIO0, i am using the second 3.3V?
    2) Since i don’t have 33Ohms i used each 3*100Ohms in parallel, might this be a problem?
    3) Do i need to restore default AT-Command firmware? (Currently flashed: NodeMCU)
    4) Is the blue LED supposed to flash? (Only single flashes on power on)
    5) Any other ideas?
    Tested on Pi Zero with ESP-202(ESP-12F).