Connecting ESP8266 ($4 Wifi adapter) to Arduino

Previously….

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.

FinalConnectionDiagram

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:
 Serial.begin(9600);
 mySerial.begin(9600);
 }
void loop() // run over and over
 {
 while (mySerial.available()>0 )
 Serial.write(mySerial.read());
 while (Serial.available()>0 ){
mySerial.write(Serial.read());
delay(100);
}
 }

 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….

ArduinoSerialWindowCapture

Success!!!

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…

DataFlow

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s