ESP8266 + Arduino Reboot issue

I had everything between the ESP8266 and the Arduino working in last post, but when I powered off the system and then restarted, nothing was working.

After a lot of head scratching, I found it was due to some ESP8266 boot up issue when the UART pins are tied to the Arduino.  If I disconnect the UART pins between the Arduino and the ESP8266 and power cycle the ESP8266, everything works great.  I suspect that the Arduino is holding the pins high while the ESP8266 is power up and it doesn’t like it.  I will have to find a way to hold those pins low while powering up the ESP8266 somehow…. for another post.


After adding a level shifter to between the ESP8266 and Arduino, the ESP8266 doesn’t have problems booting any more.


Connecting ESP8266 ($4 Wifi adapter) to Arduino


I posted…

  • test of SW UART on Arduino pin 6,7 to a 3.3V FTDI cable
  • bring up of the the ESP8266

This post is to combine these 2 and talk to the ESP8266 through the Arduino.   “Sounds simple enough” … famous last words.

Hardware Connection Diagram

If you have read my previous posts, the next diagram is taking pieces from each post and mashing them together.  Here is what I am attempting to get working.


Signal Speed Issue

When I tried sending single characters one at a time, everything worked.  If I tried to send a full command at one time (ie:AT+GMR), mostly only get the first character.  I tried many ideas then added a 100 msec delay between each of the characters being sent.  Here is the code that finally worked….

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 6); // RX, TX
void setup()
 // Open serial communications and wait for port to open:
void loop() // run over and over
 while (mySerial.available()>0 )
 while (Serial.available()>0 ){

 Carriage Return and Line Feed issue again!

Now I was able to see the ESP8266 echo all my typing, but it would not respond to any commands.  Got caught by the need for CR and LF for each command that tripped me up in one of my earlier posts after updating the ESP8266 firmware.  The serial monitor window of the Arduino tool defaults to “no line ending”.  I changed it to “Both NL &CR” and things starting working.  Here is a screen shot with the setting circled….



Yahooo!!!!!!  I am able have my Arduino talk to my ESP8266.

Next Step

For tomorrow, I am hoping to get the next diagram up and running…


Simple Communication through ESP8266 Wifi module


My previous post shows how I got life from my ESP8266 here:

Once I got life and updated to latest firmware, I changed my baud rate to 9600 by giving “AT+CIOBAUD=9600”.

Connecting to my Wifi AP

  1. Set my mode to “AT+CWMODE=3” to allow for both client and server mode (at least that is what I think it is).
  2. Scan for access points with AT+CWLAP command.
  3. Join the AP by sending AT+CWJAP=”[YourNetwork]”,”[YourPassword]”
    1. I used an AP with WEP encryption and it worked for me.
    2. I used an AP with WPA encryption and it doesn’t work for me.  Need to debug later.
  4. Check that you get IP assignment from the router with AT+CIFSR
    1. I got to IP’s, and
    2. The first one ( is the IP of the AP that the ESP8266 when operating as an AP (remember I set to CWMODE=3 in step one).  Not sure how to use it yet.
    3. The second one ( is the one my Dlink AP assigned to the ESP8266.  This is the one I know how to use for now.

Here is a log capture of my TeraTerm window.


+CWLAP:(3,”Home Network”,-86,”74:44:01:93:84:78″,10)





Setting up the ESP8266 as a server on Wifi network.

Now that I have the ESP8266 connected to my Dlink Wifi router, I want to communicate through it.  I found that I can use a simple Telnet client to talk to the ESP8266 after setting up the ESP8266 as a server.

Need for CIPMUX first

I spent a long time trying to determine why I couldn’t initiate the server on the ESP8966.  Googl’ing and stumbled on that the CIPMUX mode needed to be set first.  I used AT+CIPMUX=1 for multiple connections.  (I had problems later with with sending out data with mode 0 which is single connections.)

Starting and connecting to the Server

To start the server at port 8888….  AT+CIPSERVER=1,8888.  (Remember the IP address is found above when I gave the AT+CIFSR command.)

Once the server is started, I opened a Telnet window from TeraTerm like this….


Whala… I get “Link” out of the ESP8266 serial port.

Sending strings back and forth

Typing in the telnet window and hitting carriage return will send the string through Wifi -> ESP8266 -> Serial pins on 8266 -> FTDI cable -> TeraTerm on serial port at 9600 baud.  You should get something like this….


The 0 in the above string that shows up in the serial port is the channel.  If you have multiple clients hook up to it, this is how you tell who is “talking”.  This is also how you send back strings using the AT+CIPSEND command.  For example, if you want to send back “what was that?” to the client that send the jumble above…

In your serail port window, send AT+CIPSEND=0,16

This will bring up a “>” prompt.  The ESP8266 is waiting to send 16 characters.  Now type in “what was that?” and it should magically -> FTDI cable -> ESP8266 -> Wifi ->Telenet window.

Here is a screen shot of the full exchange (click on image so you can read the text)…


I installed a simple Telnet App on my Android tablet and could do exchanges to my ESP8266 from across the house.  Yupiieeee!!!!

ESP8266 ($4 Wifi Module) Bring Up

Purchasing ESP8266 on the cheap

Found the ESP8266 module while browsing Arduino parts at  They sell for $3.48 for 1 and gets cheaper as you buy in quantity.

I didn’t want to wait the 3-4 week shipping from China so ordered my first one at Amazon with Amazon Prime here for a whopping $7.99:


One drawback of this module is that there is no documentation that comes with the module.  I was prepared for this and was ready to do a lot of Googling and forum hunting to get it working.

Getting first life – finally

I hooked up the ESP8266 to a FTDI TTL-232R-3V3 cable (just a USB to UART cable that has all the UART pins broken out on the end) based on a basic diagram I found here which showed only VDD, GND, TX and RX…. nothing worked.

Found another diagram with more pins and comment about needing to pull up CH_PD pin  here: … Basic AT commands started to work after connecting at 10K ohm pull to the CH_PD.  Here is the diagram…


Note 1: I am using my Arduino UNO R3 just for the 3.3V supply output at this point.  Eventually the ESP8266 will connect to the Arduino UNO R3 board.

Note 2: The Arduino 3.3V supply output current is not rated high enough to support the ESP8266.  I am taking my chances with it right now hoping that since my Wifi router is only about 5 feet away, it won’t take too much current.

I gave the AT+GMR command (command list I found here:  and received a response so have life.

Firmware version

The ESP8266 firmware version that came with my board doesn’t allow for change of baud rate.  Eventually I am going to use an Arduino SW UART so need to be able to set the baud to something like 9600.

I found a tool and instruction to update firmware here:

Ahhhh …. I bricked my ESP8266…. I thought…

After upgrading, I wouldn’t get any AT command responses.  I did notice that the ESP8266 would echo everything I typed, so I knew there had to be life.  After some Googl’ing, I stumbled on a forum post someplace that the new firmware requires a carriage return (CR) AND line feed (LF).  Previous versions only need the CR.  I went into menus in TeraTerm and found the setting in the menus under Setup -> Terminal….


… things started to work again.  Here is a screen capture of a boot.TeminalScreenGMRLifeCapture

Note: Not sure why, but getting junk characters at the start.  Maybe the module is sending out serial data before the oscillators are at the correct speeds?

Arduino SW UART example

The Arduino Uno R3 only has 1 HW UART that is connected to the on board USB – UART chip.  I need a second one to interface with my recently purchased ESP8266 ($4 Wifi module).

  • Challenge 1: Voltage Difference
    • ESP8266 is 3.3V only IO
    • Arduino Uno R3 is 5V IO
  • Solution: Use simple R divider
    • This only is good for slow speed signals.  I plan on using only 9600 baud so this should work for now.
    • To keep is simple, I am using just 2x 10K ohm R’s on the Arduino SW UART TX pin.  The Arduino RX pin shouldn’t need anything.  Hoping that 3.3V coming from the ESP8266 is high enough for the switching level of the Arduino.
    • Here is the simple diagram of my plan…
    • FinalConnectionDiagram

Instead of jumping straight in, I am going to use an FTDI TTL-232R-3V3 cable to test the Arduino SW UART concept.  This is easier to debug since I can use TeraTerm on the PC to connect to the FTDI cable and send / receive any characters at any time to test the connects and the Arduino SW sketch.

  1. Here is the connection diagram I used…
    1.  SWUART_TestingWithFTDICable
    2. FTDI cable diagram
    3. PinoutDiagram
  2. Simple Arduino sketch for testing
    1. Concept is to pass all data from the FTDI cable connected to Arduino pins6,7 (which are NOT HW UARTs) to the Arduino HW UART.
    2. Here is my simple sketch
      1. /*
        Software serial testReceives from the hardware serial, sends to software serial.
        Receives from software serial, sends to hardware serial.*/
        #include <SoftwareSerial.h>

        SoftwareSerial mySerial(7, 6); // RX, TX

        void setup()
        // Open serial communications and wait for port to open:

        mySerial.println(“Hello, world?”);

        void loop() // run over and over
        if (mySerial.available())
        if (Serial.available())

      2. It is based off of
    3. Screen Capture of TeraTerm and Arduino
      1. TerminalScreenCapture

YAHOOO!!!!!  It worked.  Now to connect it up to the ESP8266 and see if it work.