Arduino Due and ESP8266-01 - can't get it to work

I have a brandnew ESP8266-01 connected to the Arduino Due like this:
Arduino Due-------ESP8266-01
3.3volt out-------->VCC and CH_PD

Then I have some simple code to send bytes to the ESP8266-01 and receive bytes back:

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
  // check if a character is available from ESP8266 to read and if yes, read it and write out to computer
  if(Serial1.available()) {
    byte in =;
// check if a character is available from computer to read and if yes, read it and write out to ESP8266
  if(Serial.available()) {
    byte out =;

Trouble is that this just seems to echo the characters which I send through the Arduino IDE serial monitor back: when I enter AT+GMR, that is what I read back from the ESP8266, but nothing else. I.e. I get no response from the ESP8266. Although, when I do a reset of the ESP8266 by pulling RST to GND and then relieve the reset, the ESP8266 seems to send a couple of lines of nonsense to the Arduino. By the way, when I set the serial monitor to "both CR & LF" the AT+GMR command comes back as ?+?M? (and the ? are actually mirrored vertically - which I can't type here)?

May-be the trivial question first: This is a brandnew ESP8266-01, I did not put any code in it myself. Can I expect that the module comes with code in it already which can interpret AT commands, or do I have to put that code in myself first? I don't think so, do I? So any help would be nice?

Is there any issue here with the max. current which the ESP8266-01 pulls from the Arduino Due board? Have others here got this to work? I measured the voltage on the ESP8266-01 board pins and it is 3.289 volts....

I think esp-01 comes with the standard AT firmware installed and the default baud rate is 115,200. The lines of garbage characters after reset are normal, the esp is sending some status messages at a strange baud rate.

I'm not sure how much this will help, but I would put 10K pull-up to 3.3V on the esp reset pin, otherwise it might float. Also try the same with GPIO0 and GPIO2, or the esp might not boot into the right mode.

Other than that, not sure what to suggest. I never used esp chips this way, always programmed them myself!

Set up a monitor Serial like this circuit and use a separate 200mA supply for the ESP-01
and use Serial1 for the debug output.

  // on ESP8266 GPIO2 is TX for Serail1.  No RX pin
  for (int i = 10; i > 0; i--) {
    Serial1.print(' '); Serial.print(i);

Since the DUE is also 3V3 you can replace the diode with a 1K resistor Edit - No leave the diode in or remove it all together

Here is a project covering programming the ESP-01

Dear drmpf,
Why do you have a 330ohm resistor in the ESP.TX-to-DUE.RX line? I understand the other pull-ups.

As noted in my previous post there should be a resistor in place of the diode as well. Edit no leave the diode or remove it all together

These resistors protect against miss-wiring the TX to TX line which can see oneside trying to supply 3v3 while the other TX is trying to ground the line. Without the resistor this would be short circuit on the driving TX output.
Actually 1K is the resistor Arduino Uno uses for this, which would limit the short circuit current to 3.3mA. The 330Ohm limits to 10mA

Also looking at the Due specs, they say the 3v3 is good for 800mA, so should be able to power the ESP8266 as well, but have not tested that.

Maybe I have missed something in this post, BUT either side needs a software to receive and send.

Whithout any code in the Esp8266, there is no chance that you will receive any answer......

  • There should be AT-firmware pre-loaded on the ESP-01.
  • The pullup resistors on GPIO 0 & GPIO 2 are not required (they are fine free floating as well)
  • Since the DUE is a 3.3v device you should not need any voltage divider, but a resistor inline is a decent plan to prevent over-current when accidentally connecting 2 pins that are in output mode.
  • I also put a pullup resistor to the RST pin, so i can easily connect a button to ground it out to reset the unit. Some ESP-01's have a pullup there, but not all.

Doing a simple Serial-pass through as you have should work just fine, but do always a newline & carriage return at the end of every command. Start out with just 'AT' which should result in 'OK'

Here is a circuit for a Mega2560 to ESP-01 which should also work for the DUE

Here are a two example sketches for either end
HardwareSerial1CSVToESP8266.ino (2.0 KB)
ESP8266_01_CSV.ino (2.2 KB)

Thanks to all the answers here, drmpf, Deva_Rishi, ard_newbie. When I follow the schematic of the Mega2560 and have a LM317T 3.3v power supply it all works. On the Arduino Due I also connect the GPIO2 of the ESP8266 directly to the RX2 (with a 1Kohm series resistor) and I get the error messages then via Serial2.