1

I have my ESP8266 connected via serial to USB like the image shows: enter image description here

It worked just fine, however, when I tried flashing Blynk code

#define BLYNK_PRINT Serial    
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char auth[] = "YourAuthToken";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, "ssid", "pass");
}

void loop()
{
  Blynk.run();
}

It started outputting loads of garbage in the serial monitor, while Blynk app said ESP is not connected to network. I've tried since then flashing empty sketches or some other stuff, whatever I do, serial monitor shows loads of junk. I've tried changing modes, I've tried changing baud rates (57600 was default, and AT worked just fine).

Junk example:

  …ÕZªP‚,JHVYº—¡VÕ]­J*ÉW¥¡Õ¥Õ-”ªUŠQd®”¡âJ%H
!HiZÊIIRPÖuUPÒ‚BñZT¥ *EUeZB\)*EVjU!\©Š_¥¢”ÅVªqYiUµP”¬ÕPQT°*uH)HZKB*ÕXªuH!HBHBH…µEIâHBH!H©ªqY+hZVB\BH!HÊ*Òµe�qHBHBHŠ*i±…Z¦-hUµPÔ¬ÔPQT°*uH)H-KB*ÕXªuH!HBHBH…µE­B\!H!HBVªqY+iZVB\BH!HeVÒZ¢qHBHBHŠ*iQ…Z¦-hUµPÔ¬ÔPQTaYRB\    jHiBHªaYRB\BH!HBVªaYRB\BH!HBVªqY+iZVB\BH!HÊVÒZ¢qHBHBHŠ*i±Õ\V
iUµPÔ¬ÕPQT°*uH)H-JBVªaYRB\BH!H!VªaYR!\BHBH!Vªq©+hZW!\BHBHJ*iµE�âHBH!HŠ*i±…Z¦-hUµPÕ¬ÔPQTaYR!\    %Hi!HÕXªuH!HBHBH…µEIqHBHBH
  • @NickGAmmon this is not a duplicate of the question you link. That question concerns the ESP8266 connected to an Arduino and yielding very nearly correct data, this concerns an ESP8266 functioning as an Arduino connected to an FTDI type interface and yielding entirely wrong results. They are quite distinct problems with different causes. – Chris Stratton Mar 5 '16 at 5:10
  • 1
    @ChrisStratton - well if you think so. I've reopened it. Do you have an answer to the question? – Nick Gammon Mar 5 '16 at 5:37
2

I think the default baud rate of ESP8266 is 115200.

  • I did try all of them in the serial monitor, I wrote in 57600 and 9600 only. Should I write in 115200? – Predrag Beocanin Mar 3 '16 at 6:47
  • yes try with that. because as far as i know the baud rate is 115200 by default of esp module – Muhammad Hassaan Bashir Mar 3 '16 at 6:54
  • I've tried the 115200 and I'm getting exactly the same result – Predrag Beocanin Mar 4 '16 at 16:40
1

Try stabilizing the power source.

I parallel connected two AA batteries with the Arduino's 3.3V output and the garbage disappeared and my ESP8266-01 got much more stable.

1

In this case, it looks like your Serial Monitor just isn't set to the right baud rate with Both NL & CR. Even if your monitor is set to the default 115200 baud rate, you'll still see some garbage characters which leads into the next issue.

Using 115200 has too many instructions for the Arduino Uno to reliably decode characters and that's where the garbage is coming from.

The ESP8266 default baud is 115200, so you need to connect at the default rate and issue an AT command to reduce the baud rate to 9600.

Each time you reset, the ESP8266 goes back to the default baud rate.

Here's an example script that connects at the default baud rate and then reduces it to 9600. You'll connect the Serial Monitor at 9600. At the lower baud rate, I'm not getting any garbage characters.

#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3); // RX | TX

void setup() 
{
  Serial.begin(9600);
  ESPserial.begin(115200);
  ESPserial.println("AT+IPR=9600");
  delay(1000);
  ESPserial.end();
  // Start the software serial for communication with the ESP8266
  ESPserial.begin(9600);

  Serial.println("Ready");
  ESPserial.println("AT+GMR");
}

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() );  }
}

An odd thing that happened to me is that I tried to use a baud rate of 4800 and I bricked one ESP8266 module. I don't know if that was a glitch or just a coincidence.

0

Have you also pulled up the ESP8266's reset pin? I don't know what effect not doing so might have, but the recommended connections I have read and followed include that. The RST and CH_PD pins are adjacent; they're easy to jumper together.

0

I had a similar problem with a NodeMCU ESP-12E (Amica v2) board... after pressing and releasing the RST button with Serial Monitor open & set to 115200 baud, it would display the boot message (starting with " ets Jan 8 2013, rst cause:2, boot mode(3,6)", and ending with "~ld"), then display gibberish when the program itself attempted to use Serial.print() or Serial.println().

It appears to be a strange bug related to NodeMCU itself, but the following work-around got Serial.print working for me:

  1. Before using Serial.print() or Serial.println() for the first time in the program (setup() is probably a good place), do Serial.begin(74880);

  2. Step 1 notwithstanding, set the baud rate in Serial Monitor to 115200.

My guess is that somewhere between the Arduino library and CP2102, a register value is being miscalculated (or mangled), and calling Serial.begin(74880) results in setting a register to the value that calling Serial.begin(115200) should have set it to.

Here's the page where I read about the bug: https://github.com/esp8266/Arduino/issues/4005

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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