-->
Page 1 of 1

ESP-12F + Arduino nano does not work

PostPosted: Sun Oct 27, 2019 12:51 pm
by x0r
Hey there,

I wanted to get into that ESP stuff after some experience with the arduino itself as well as some sensors and i2c connections etc.
So I grabbed some ESP-12F modules from ebay and checked the tutorials. Most of them were referring to the ESP-01 but some of them mentioned the 12F in the diagrams.

So I wired all up the following (using SoftSerial):

Nano D2 -> 220Ohm -> ESP TX -> 470Ohm -> GND
Nano D3 -> ESP RX
Nano VCC -> From USB
Nano GND -> From USB

ESP VCC -> 3.3v from external line
ESP GND -> from external line (also connected to GND from Arduino to have a common GND)
ESP EN -> 10kOhm -> VCC 3.3v

That was what I was getting from various online resources. However, when uploading my code to the Arduino and checking the serial monitor, I only get garbled text (higher baud = more chars). The one LED on the ESP was flashing once when powering it up.
No matter what I tried (all baud rates from 300 - 115200) or even connecting RX from Arduino directly to ESP TX (without the voltage divider) I got no connection.

I tested three different modules without any luck. I then found an old ESP-01 in my box and tried with this one, and lo and behold it worked (not with the voltage divider, but with direct connection).
A few chars where garbled, but that may be because of the over voltage. I didn't try too long, because I was afraid of killing the ESP TX pin.

Can anyone give me an idea why my ESP-12F modules don't work? Is there anything missing? I'm open for all suggestions at this point.

Code is the one which is all over the internet:

Code: Select all// Basic serial communication with ESP8266
// Uses serial monitor for communication with ESP8266
//
//  Pins
//  Arduino pin 2 (RX) to ESP8266 TX
//  Arduino pin 3 to voltage divider then to ESP8266 RX
//  Connect GND from the Arduiono to GND on the ESP8266
//  Pull ESP8266 CH_PD HIGH
//
// When a command is entered in to the serial monitor on the computer
// the Arduino will relay it to the ESP8266
//
 
#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3); // RX | TX
 
void setup()
{
    Serial.begin(9600);     // communication with the host computer
    //while (!Serial)   { ; }
 
    // Start the software serial for communication with the ESP8266
    ESPserial.begin(9600); 
 
    Serial.println("");
    Serial.println("Remember to to set Both NL & CR in the serial monitor.");
    Serial.println("Ready");
    Serial.println("");   
}
 
void loop()
{
    // listen for communication from the ESP8266 and then write it to the serial monitor
    if ( ESPserial.available() )   {  Serial.write( ESPserial.read() );  }
 
    // listen for user input and send it to the ESP8266
    if ( Serial.available() )       {  ESPserial.write( Serial.read() );  }
}

Re: ESP-12F + Arduino nano does not work

PostPosted: Mon Oct 28, 2019 3:40 am
by btidey
The ESP8266 uses 3 pins to determine what to do at start up. For it to run normal code then GPIO00 and GPIO02 must be high and GPIO15 must be low when the chip starts up. Internal pull ups for GPIO00 and GPIO02 which means they will be high. On the ESP-12 modules there are no external pull up or down resistors which means that GPIO15 will not be low.

Connect GPIO15 to GND via a resistor like 4K7 to make it low during start up.

Note that during start up the baud rate is actually 74880 until the internal boot code switches it to 115200.

Re: ESP-12F + Arduino nano does not work

PostPosted: Mon Oct 28, 2019 5:16 pm
by x0r
Thank you. While my post was pending approval, I found the (same) solution in another entry:

https://www.instructables.com/id/Get-Yo ... -Commands/

After I added the 10k resistors, I had a connection, but with some chars shown as "?" (most likely due to the limitations of SoftwareSerial).
I then flashed the AI-Thinker firmware, and set by baudrate to 9600 using:

Code: Select allAT+UART_DEF=9600,8,1,0,0


Now, everything works as expected.