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

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.

<p>couln't find the line to edit in &quot;/boot/cmdline.txt&quot; and &quot;/etc/inittab&quot;.</p><p>pls help if anyone else had same issues.</p><p>thanks</p>
<p>i am using a rpi3 fyi</p>
<p>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 ?</p>
<p>The rx/tx is how you communicate with it.</p><p>rx pi -&gt; tx esp ; tx pi -&gt; rx esp </p><p>Sometimes they need reversal, sometimes not. Like anything from China, sometimes things get reversed.</p><p>I don't remember needing to flash new firmware on the ESP when I used an Arduino, just had to flash my Arduino.</p><p>Assuming similar thing with pi.</p>
<p>http://www.espressif.com/sites/default/files/4a-esp8266_at_instruction_set_en_v1.5.4_0.pdf</p><p>AT Commands are what the Esp is flashed with.</p>
<p>Arduino branch, but useful with info and hookup. </p><p><a href="https://github.com/esp8266/Arduino/blob/master/doc/boards.md#improved-stability" rel="nofollow">https://github.com/esp8266/Arduino/blob/master/doc...</a></p>
<p>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.</p>
<p>Resistors are selected as per the current (and sometimes power) requirements. Here he uses them as pull-up/pull-downs which is just to &quot;hold&quot; 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: <a href="http://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-resistor-color-code-4-band.">http://www.digikey.com/en/resources/conversion-cal...</a></p><p>More on pull up resistors: https://learn.sparkfun.com/tutorials/pull-up-resistors</p>
<p>Nice tutorial. Thank for sharing. </p>

About This Instructable




More by osmmspex:Northern Peppermint Green Julep Connect an ESP8266 to your RaspberryPi 
Add instructable to: