-->
Page 1 of 4

Arduino Nano not working with ESP

PostPosted: Wed Mar 04, 2015 2:13 pm
by nate4495
Hello ESP world. I am looking to use the ESP to send / receive greenhouse information using an online web server.. ESP seemed like a great cheap option. I ordered an ESP8266-01 (baud 115200) and connected to arduino nano to the ESP as follows, 3v3-3v3, GND-GND, RX-RX, TX-TX. I tried out testing basic ESP input and looked to get a response on the serial monitor. here is my arduino code:

Code: Select all#include <SoftwareSerial.h>
SoftwareSerial esp8266(1,0);

void setup()
{
  String response = "";
  Serial.begin(9600);
  esp8266.begin(115200);
 
  Serial.println("hello world");
   
   esp8266.print("AT+RST\r\n");
   
   while(esp8266.available())     {
        char c = esp8266.read();
        response+=c;
        Serial.print(c);
      } 
      Serial.println(response);
     
         esp8266.print("AT+CWMODE=2\r\n");
   
   while(esp8266.available()     {
        char c = esp8266.read();
        response+=c;
        Serial.print(c);
      } 
      Serial.println(response);

  esp8266.print("AT+CIFSR\r\n");
   
   while(esp8266.available()     {
        char c = esp8266.read();
        response+=c;
        Serial.print(c);
      } 
      Serial.println(response);



and here is the serial output on 9600 baud- it seems to want to say something but it's gibberish.
Code: Select allhello world
ðð (then a bunch of boxes)
ðø€ððø€
àððø€à


Also a note, whenever I connect the CH_PD pin on the ESP8266 to 3v3 in addition to just 3v3 on the ESP, I am unable to upload sketches, the IDE tells me that the serial port is already in use.. in case that might be related. Any help is appreciated! :D

Nate

Re: Arduino Nano not working with ESP

PostPosted: Thu Mar 05, 2015 1:28 am
by ohra
The Nano has only one hardware serial interface which operates either through the usb or the RX (0) and TX (1) pins. In your sketch the software serial is also assigned to pins O and 1. That's probably why the output is garbled since both the debug and communication with the ESP are using the same serial which is not really possible. The software serial should use some other pins.

But, in my experience, the ESP will not work with software serial. You can get some simpler commands like AT+RST go through but stuff like AT+CWLAP will have their responses garbled. This happened even if I used 9600 baud. Some people have successfully used software serial, though, so this might be my personal problem.

Your best bet would be to get a USB to serial converter and use that to communicate over software serial with the arduino and leave the hardware serial to the ESP.

The CH_PD pin must be enabled for the chip to do anything. Your upload sometimes fails since your ESP is also using the hardware serial. Even if you thought it was on software serial.

Re: Arduino Nano not working with ESP

PostPosted: Thu Mar 05, 2015 11:27 am
by raz123

Re: Arduino Nano not working with ESP

PostPosted: Thu Mar 05, 2015 3:43 pm
by nate4495
Thank you for the help. I changed my RX,TX to pins 11,12 and got output- but whenever I plug the nano 3v3 into CH_PD within 10 seconds the RX and TX LED on nano start flashing and my computer cannot find the arduino anymore... I'm going to test using an external 3V3 supply as soon as possible, any other suggestions welcome :?: