4

I am attempting to connect and use an ESP8266 board with my Arduino nano v3.0 and I am not have much luck.

I have read a bunch of tutorials and articles, the most recent is http://elektro-blogger.blogspot.co.nz/2015/07/arduino-and-esp82666.html

Any help would be greatly appreciated.

I have connected it like below and am using some simple code to try and get it working.

enter image description here

Code:

#include <SoftwareSerial.h>

SoftwareSerial esp8266(10, 11);

void setup()
{
  Serial.begin(9600);
  esp8266.begin(9600);

  Serial.flush();

  esp8266.print("AT+RST\r\n"); // reset for esp8266
  delay(500);
  esp8266.flush();//clear serial1
  // Check AT
  esp8266.print("AT"); // reset for esp8266
  esp8266.print("AT+CIFSR\r\n");// learn the ip which token for esp8266
  delay(500);
  if (esp8266.find("ready"))
  {
    esp8266.flush();
    esp8266.print("AT+CIFSR\r\n");
    delay(500);
    Serial.println("CIHAZ IP ADRESI:" + esp8266.readString()); // print esp8266 ip

  }
  else
  {
    Serial.println("there is no internet connection");
  }
  esp8266.print("AT+CIPMUX=1\r\n");//ser mux 1 so we want to connect as multiple users
  delay(500);
  if (esp8266.find("OK"))
  {
    Serial.println("Mux ok");
  }
  else
  {
    Serial.println("MUX failed");
  }
  esp8266.print("AT+CIPSERVER=1,23\r\n");// set esp8266 as server
  delay(500);
  if (esp8266.find("OK"))
  {
    Serial.println("SERVER started");
  }
  else
  {
    Serial.println("SERVER failed");
  }

}
void loop()
{

  if (esp8266.available())
  {
    Serial.print(esp8266.readString()); // get message which comes from clients.
  }
}
7
  • 2
    At a glance, your picture shows that you've connected RX to RX and TX to TX. They need to be swapped, so that each module receives what the other transmits.
    – Rennex
    Nov 8, 2015 at 6:55
  • To expand on that, I'm not sure if the logic lines of the ESP can handle 5V of the arduino. (5V exceeds the 3.3V, that could cause some problems)
    – Paul
    Nov 8, 2015 at 16:48
  • @FuaZe are you suggesting separate 3.3v power ?
    – Yonkee
    Nov 8, 2015 at 17:41
  • @Rennex Thanks for that. I will test it out tonight.
    – Yonkee
    Nov 8, 2015 at 19:30
  • @Yonkee I'm suggesting a TTL logic converter or a resistor-divider on the logic lines. As the logic (Rx/Tx) may not be 5V tolerant.
    – Paul
    Nov 9, 2015 at 14:36

3 Answers 3

3

The Esp8266 module has different firmware, the old one was running at 9600 and the new one is running at 115200.

Try to upload this code on your arduino Nano and send AT commands over the Serial monitor of the Arduino.

If you send AT it should returns "OK", if not, try to swap RX to TX and try to play around with the baudrate 9600, 57600, 115200.

It might be that your Wifi module doesnt have any firmware loaded which might need to be done.

#include <SoftwareSerial.h>

SoftwareSerial wifi(10,11); // RX, TX

void setup()
{
Serial.begin(9600); // FTDI
wifi.begin(9600); // GPS; 9600 first time, 38400 second time
}

void loop()
{
if (Serial.available())
wifi.write(Serial.read());
if (wifi.available())
Serial.write(wifi.read());


}
3
  • Thanks for the answer. I will test this out when I get home. I will reflash my ESP board to make sure the firmware is up to date.
    – Yonkee
    Nov 8, 2015 at 19:29
  • I have the same problem. I had no results in running your code. Do you know how to load a new firmware on to the ESP board? Jan 13, 2016 at 16:58
  • If I am not wrong, you need to short a pin then you power it, the device boots up in a special mode where you can upload a different firmware. Further info you might want to see some youtube videos.
    – max246
    May 18, 2016 at 22:08
3

Do not Connect your ESP8266 Module Directly to an Arduino Board, Always try your best to use Divider resistors for better communication. you need to use Arduino IDE serial Monitor Window for ESP8266 setup instead of writing At Commands in Source Code. I successfully Setup My ESP8266 Module by using just Arduino Nano and Arduino IDE Serial Monitor.

Download Simple Source Code and List of Necessary AT Commands

USE D2 and D3 for TX and Rx

2

Remember that ESP8266 Uses 3.3v logic and arduino 5v. So use a voltage divider to get 3.3v at esp8266 rx pin. Also esp8266 must be connected rx->rx tx->tx to communicate with pc and rx->tx tx->rx to communicate with arduino.

1
  • I would suggest against using nano provided 3.3V. Instead use regulator separately to power it up and connect grounds. ref bbs.espressif.com/viewtopic.php?t=133
    – Osaid
    May 30, 2017 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.