I am trying to up an esp8266 esp-01. While monitoring the serial monitor it's printing garbage values. I am using arduino-mega to write the code to the esp8266. The sample code i'm trying to write is

#include <ESP8266WiFi.h>
const char* ssid     = "SSID";
const char* password = "PASSWORD";  

void setup() {
  Serial.begin(9600);// tried other rates as well

  WiFi.begin(ssid, password);            
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { 
    Serial.print(++i); Serial.print(' ');

  Serial.println("Connection established!");  
  Serial.print("IP address:\t");

void loop() { }

Before this I tried to test the esp with a blink program, and it seems working. The connections between esp and arduino are as below

Arduino | ESP
3.3V    | VCC(through a button)
3.3V    |CH_PD
TX      | TX
RX      | RX (connected through a voltage divider to arduino)
GPIO 0  | GND (through a push button to GND)
GPIO 2  | 3.3V (through a 1K resistor to 3.3V)

Arduino's the RESET and GND are shorted. What I'm trying to achieve to make the wifi module to act as message que, sending and receiving data to and from a device which is connected to it via internet.

  • I suspect it's boot-looping due to lack of power and you're seeing the ESP8266 boot messages.
    – Majenko
    Jan 2, 2019 at 13:10

1 Answer 1


The "garbage values" are most likely messages from the bootloader, output at 74880bps. Try watching its serial out at that speed. You'll probably see messages that look something like:

ets Jan  8 2013,rst cause:2, boot mode:(3,7)
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d

The rst cause number will give you an indication of why the chip rebooted.

The most common reset causes are

  1. power on
  2. hardware watchdog timer
  3. fatal exception (most likely error in your code or power issue)
  4. software watchdog timer
  5. software reset
  6. deep sleep
  7. hardware reset

If it's a "fatal exception", you should see another line that looks like this:

Fatal   exception   (28):
epc1=0x4025bfa6,    epc2=0x00000000,    epc3=0x00000000,    excvaddr=0x0000000f,    

Look up the exception number; if it's not obvious what it means, google it to learn about the causes.

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.