Connect an ESP8266 to Your RaspberryPi




ESP8266 boards are pretty neat, but if you just bought one (And why wouldn't you for only $5?) and have realized that you don't have any obvious means (3.3V TTL USB serial device) to communicate with it, you can talk to it directly with a Raspberry Pi. Both use 3.3V signaling, so no level converting is required.

You will need:

Raspberry Pi desktop setup (just about any Pi should do, but with power, keyboard, screen, etc. network access is a plus)

ESP8266-01 (or equivalent)

Some jumper wire and nipper/strippers

Solderless Breadboard (or You can solder this instead)

2x Pull-up/down resistors

(optional) push-button switch

The process is roughly two steps,

1) Wire them together

2) Configure Raspbian

3) Start talking to your ESP8266

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wire Them Together

With the power off, connect the 3.3V and ground pins to one another. Similarly connect the RX to TX and vice versa. You will also want some pull down resistors and optionally a reset button. I've included a Fritzing diagram (above).

Step 2: Configure Raspbian Linux

Boot up the Pi and with super user privs make some edits (e.g. “sudo nano”).

Disable the Kernel serial console

Edit /boot/cmdline.txt to remove the underlined text:

dwc_otg.lpm_enable=0 rpitestmode=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait

Disable serial logins

Edit /etc/inittab and remove the (usually) last line:

2:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100


sudo shutdown -r now

Step 3: Start Talking to Your ESP8266

Connect to the serial port
You should now be able to interact with the ESP8266 via a terminal emulator program. I suggest GNU Screen for this (“sudo apt-get install screen”). Screen passes through your keystrokes unless you start with “CTRL-A” in which case you can then make screen do things. For example “CTRL-A” then “k” will close (kill) the session. screen /dev/ttyAMA0 115200 (the speed may vary depending on your ESP8266 board) (you may need to sudo this too, depending permissions) You can now send your ESP8266 “AT” commands. You’ll still need “return” and “CTRL-J” after each one, though.


The Pi does not seem to recover well if you try to use the reset button. Best to shutdown the pi, then remove power, then power/boot back up rather than try the reset button.

Don’t mess with the wires while power is on. Shutdown the Pi ("sudo shutdown -h now") and wait for any blinking LEDs to stop and disconnect power before trying to connect/disconnect wires.

This linking won’t by itself give your Pi internet access via the ESP8266. But it does at least let you try out, configure, maybe even reprogram it.

Screen won’t relinquish the serial port if you just close a window or disconnect. This is on purpose, but can take some getting used to. If you think you disconnected from Screen but it is still running try “screen -ddR” to reconnect, and then you can to the kill as above. [Or reboot.]

The Pi and the ESP8266 can use a lot of power. This setup relies on the Pi’s 3.3V supply alone, which may not be up to the task if both devices are going to be going full blast. A more reliable/permanent solution would be to rig up separate power for the ESP8266.

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    10 Discussions


    2 years ago

    This gets you connected to it, but then what? i.e. can you/how-can-you used the wifi on it?


    2 years ago

    couln't find the line to edit in "/boot/cmdline.txt" and "/etc/inittab".

    pls help if anyone else had same issues.


    1 reply

    3 years ago

    After Disable the Kernel serial console and Disable serial logins i reboot and installed screen. And then i don't understand what i am supposed to do. I need to flash ESP8266 and then upload the code to it. Is this not possible with this tutorial ?

    3 replies

    Reply 3 years ago

    The rx/tx is how you communicate with it.

    rx pi -> tx esp ; tx pi -> rx esp

    Sometimes they need reversal, sometimes not. Like anything from China, sometimes things get reversed.

    I don't remember needing to flash new firmware on the ESP when I used an Arduino, just had to flash my Arduino.

    Assuming similar thing with pi.


    Reply 3 years ago

    AT Commands are what the Esp is flashed with.


    3 years ago

    Just out of curiosity how do yo determine what resistors to use? I see that you have red, red, red, gold. Are these the type of resistors needed? Thanks for putting this together.

    1 reply

    Reply 3 years ago

    Resistors are selected as per the current (and sometimes power) requirements. Here he uses them as pull-up/pull-downs which is just to "hold" the pins at a particular voltage, so high value of resistance is preferred. Most common is 10k, but you can make it work with 1k and higher. Red, Red, Red, Gold is 2.2k, so yes they will work too! Here is a calculator you can use:

    More on pull up resistors: