0

I have an ESP8266 12E module and I'm trying to connect it to arduino, without any shields or whatsoever. I've looked everywhere but all I can find is about ESP-01 or with a NodeMCU. I'd like to do the bridge manually, but I don't know which pins I should ground and which pins I should power.

This is my current setup: enter image description here

And the following sketch:

#include <SoftwareSerial.h>

//RX pin 2, TX pin 3
SoftwareSerial esp8266(2, 3);

#define DEBUG true

void setup() {
  Serial.begin(9600);
  esp8266.begin(115200);
  sendData("AT\r\n", 2000, DEBUG);
  delay(1000);
  Serial.println("Firmware version:");
  delay(3000);
  sendData("AT+GMR\r\n", 2000, DEBUG);
  Serial.println("** End **");
}

void loop() {}

String sendData(String command, const int timeout, boolean debug) {
  String response = "";
  esp8266.print(command);
  long int time = millis();
  while ( (time + timeout) > millis())
  {
    while (esp8266.available())
    {
      // The esp has data so display its output to the serial window
      char c = esp8266.read(); // read the next character.
      response += c;
    }
  }
  if (debug)
  {
    Serial.print(response);
  }
  return response;
}

When run, I get the following output:

Firmware version:
** End **

On the module, the led flashes when I power it up, but after that it remains off. I've already tested the voltage regulator with ReadAnalogVoltage, and the output was 3.33v, so it is working.

2
  • For future reference, here's a link of my final (working) pinout
    – Gus
    Aug 1, 2016 at 10:52
  • And just a heads up: if using Arduino Mega, not all pins can be used as Software Serial, see this post for more details. Currently I'm using pins 10 and 11 and it's working fine.
    – Gus
    Jun 2, 2017 at 4:07

3 Answers 3

2

Make sure to specify as SoftwareSerial's Rx pin, the pin# connected to the ESP's Tx pin. They have to be crossed. (I just fumbled that myself, a couple of hours ago ):

It is the ESP's Rx pin that needs the voltage divider.

Also pullup the ESP's reset pin.

Update:

ESP-01 and ESP-12 modules use the same ESP8266 chip. The differences are in the number of pins brought out from the chip and made available on the board. Other differences include the firmware interpreters installed on them before shipment: "NodeMCU" is one. ESP-01 is usually shipped with the AT+ command interpreter unless it specified otherwise; I would expect the same for the others. Bottom line is they are connected pretty much alike. Interacting with them serially from an Arduino (or other device) then depends on the installed firmware, including whether you've installed your own. So far, I've used all of mine as WiFi modules using the AT+ interpreter they came with.

How can I pullup the reset pin? Also do I need to pullup it just for initial setup (changing baud rate and such) or should it be pulled up at all times?

I use a 10K-Ohm resistor to +3.3v as a pullup. You need it pulled up anytime you are not trying to force a hardware reset; grounding it resets the chip. I have never used a reset button on my ESPs. I just leave them pulled up. If you want one, it should short the reset pin to ground.

Update 2 (wiring):

You've powered the ESP with 3v but your pullups are taken to the Arduino's 3.3v supply. Most chips have a slim tolerance for signal levels above their supply voltage. I'd suggest driving the entire ESP from your 3v battery - power & both pullups.

I don't know the ESP-12E's pinouts to check them; I'm sure you have, and you might want to label the diagram so someone else can look over it too.

Then there's whatever "chicken dance" is needed on the reset and the GPIO line that needs to get toggled to start an upload. I don't know that sequence, but I think you need a grounding buttons on on each one to be able to sequence them.

3
  • I think I fumbled that too initially. How can I pullup the reset pin? Also do I need to pullup it just for initial setup (changing baud rate and such) or should it be pulled up at all times?
    – Gus
    Jul 26, 2016 at 12:04
  • I've edited my question with my current setup based on what you and Len said, yet it still doesn't work.
    – Gus
    Jul 27, 2016 at 11:19
  • Your comment pointed me in the right direction. After connecting all the pullups to the power supply, I had to ground/pulldown GPIO15 pin, and now it works! I'll attach a picture of my wiring as soon as I can. Thanks!
    – Gus
    Jul 30, 2016 at 21:06
1

Oh boy, lot of things can be the problem here.

First of all: a voltage divider using 10k-10k has an output of 2.5V when the source is 5V. The ESPs run on 3.3V, so this effectively could mean the commands are completely scrambled when they arrive at the ESP.

The other way around and you're putting 3.3V comms into a 5V device. This isn't a problem per say, but it could definitely lead to problems. I suggest you use a bi-directional logic level converter which will transform a 5V command to the 3.3V ESP level, and back.

Your wiring between the Arduino and the ESP seems al right, but make sure TX~RX and RX~TX are connected, not TX~TX and RX~RX, but as I said above: use a bi-directional logic level converter.

1

From your code, I understand that you're setting the baud rate of the software serial pins as 115200. Software serial doesn't support speeds this high. You could set the baud rate of ESP8266 down to 9600 by using a USB to TTL converter and the AT command interface. Then you should try repeating this process using a baud rate of 9600 for the software serial. Or if you happen to have an Arduino Mega which comes with 4 serial ports, you can use the hardware serial pins which supports high speeds.

Your Answer

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

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