Arduino Pro Mini Serial Monitor garbage

Hi all,

This is my first post. I hope that I am posting in the right section of the forum. Otherwise, could an admin move this topic to the appropriate section please?

Board : Arduino Pro Mini 3.3V 8MHz
Arduino IDE : 1.6.12
Arduino is powered by a FTDI Board and USB Mini-B cable from the computer USB port in the following order :
Arduino FTDI
BLK GND
GND CTS
VCC VCC
RXi TX
TXo RX
DTR DTR

Also, I have connected a HC-06 bluetooth module in the following order :

Arduino HC-06
GND GND
VCC VCC
D10 RXD
D11 TXD

The Serial Monitor is open on COM4, Newline, 9600 baud.

The code that I’m trying to run is :

#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11); 
void setup()  
{
  pinMode(13, OUTPUT);
  BT.begin(9600);
  // Send test message to other device
  BT.println("Hello from BTSerial");

  Serial.begin(9600);
  Serial.println("Hello from Serial");
}

char a; // stores incoming character from other device
void loop() 
{
  
  if (BT.available())
  // if text arrived in from BT serial...
  {
    a=(BT.read());
    if (a=='1')
    {
      digitalWrite(13, HIGH);
      BT.println("LED on");
    }
    if (a=='2')
    {
      digitalWrite(13, LOW);
      BT.println("LED off");
    }
    if (a=='?')
    {
      BT.println("Send '1' to turn LED on");
      BT.println("Send '2' to turn LED on");
    }
    Serial.println(a);
  }
}

I am trying to communicate with the HC-06 from an Android phone.
I am posting in this section of the forum because when I send a message from the phone to Arduino the following is printed in the Serial Monitor :

à„…€ƒ¦¤„„‡…§¤¦„‡Å„EóAãbBãbHãb

When I am trying to send a message from Arduino to the phone, nothing is received on the phone.

Could someone please explain why I get garbage output on the Serial Monitor even though the baud rate is the same in the code as it is in Serial Monitor window?
Is there a problem with the Arduino IDE?

Basically, what I'm trying to do is to send a message from the phone and print it in the Serial Monitor and to send a message from the Serial Monitor and print it on the phone

Also, to pair the HC-06 with the phone and exchange messages I am using Bluetooth Terminal application from the Play Store.

Testing with an Arduino UNO connected through USB cable from computer:

Arduino HC-06
GND GND
3.3V VCC
D11 RXD
D10 TXD

Serial Monitor COM3, 9600 baud, same code, everything seems to work fine.

Could it be that with the Arduino Pro Mini 3.3V, the bluetooth module does not get enough power?
Does anyone have any idea what the problem might be?

I will try other scenarios and keep everyone reading updated...maybe someone will have an idea somewhere along the road :slight_smile:

Thank you for everything,
Andrei

Do you see the "Hello from Serial" printed correctly in the Serial Monitor on startup?

Cross-posted at http://arduino.stackexchange.com/questions/31083. Please don't do that. It wastes people's time due to duplicate effort trying to help you. You could at least have posted links to the other posts. The problem has already been solved on Stack Exchange but how would people here know that they don't need to spend time helping you with a question that has already been answered.

I'm really sorry about that. As you can see, the answers came in pretty quickly and for some reasons I did not get any e-mails so I did not know that people already answered.
Next time I'll know better and I'll post links to the stackoverflow question as well.
I will test their solutions and I'll let everyone know if everything works fine.
Thanks,
Andrei

Unfortunately, those answers did not help me at all :slight_smile:
I configured the HC-06 but I still do not get anything printed on the Android phone application.
So..back to square one.
To answer your question, this is what I get when I open the Serial Monitor in the Arduino IDE with this code :
Newline, Baud rate 9600

‚Ƈ¥Ç$¤†Fó

If I change the Serial Monitor properties to Newline, Baud rate 19200 this is what I receive :

Hello from Serial

On the Android phone application I do not get anything printed.

It appears that in fact your board is not running at 8MHz, but instead 16MHz. Please select the correct setting for your board:
Tools > Processor > ATmega328(5V, 16MHz)
Or if it has the ATmega168:
Tools > Processor > ATmega168(5V, 16MHz)

Thank you Thread, I have an Arduino Pro Mini 328 - 3.3V/8 MHz and was receiving Garbage in my serial monitor.

I fixed it by setting the Processor selection to the correct 8MHz option vs the incorrect 16MHz option I had selected.

Half your given baud rate.

If,
Serial.begin(19200);

Then,
Serial monitor baud rate is 9600.

I solved the issue. Work on Atmega328p,16MHz,5V.

1 Like

Hi, I also have same problem writing to SD card for software serial get garbage, here is my code

#include <SPI.h>
#include <SD.h>
#include <SoftwareSerial.h>
SoftwareSerial simSerial(7, 6);
File myFile;

void setup() {
Serial.begin(9600);
while (!Serial) {
;
}

simSerial.begin(9600);
Serial.print("\nInitializing SD card...");

if (!SD.begin(10)) {
Serial.println("\nInitialization failed!");
while (1);
}
Serial.println("\nInitialization done.");
delay(8000); //For booting SIM7100
if (SD.exists("1.TXT")) SD.remove("1.TXT");

myFile = SD.open("1.txt", FILE_WRITE);
if (myFile) {
simSerial.println("AT+CFTRANTX=\"c:/data.txt\"");
while (simSerial.available() > 0) {
byte voc = simSerial.read();
myFile.write(voc);
}
myFile.close();
// Serial.println("\nClose done.");
} else {
// Serial.println("Error opening 1.txt");
}

// re-open the file for reading:
myFile = SD.open("1.txt");
if (myFile) {
Serial.println("1.txt:");
while (myFile.available()) {
Serial.print(myFile.read());
}
myFile.close();
Serial.println("\nReading SD Card done.");
} else {
Serial.println("Error opening 1.txt");
}

}

void loop() {

}

data.txt is A1A2A3…F9F0 and get on SD 000000000062480198616224 .

Any help would be appreciated.

amorawej:
Hi, I also have same problem writing to SD card for software serial get garbage, here is my code

#include <SPI.h>

#include <SD.h>
#include <SoftwareSerial.h>
SoftwareSerial simSerial(7, 6);
File myFile;

void setup() {
 Serial.begin(9600);
 while (!Serial) {
   ;
 }

simSerial.begin(9600);
 Serial.print("\nInitializing SD card…");

if (!SD.begin(10)) {
   Serial.println("\nInitialization failed!");
   while (1);
 }
 Serial.println("\nInitialization done.");
 delay(8000); //For booting SIM7100
 if (SD.exists(“1.TXT”)) SD.remove(“1.TXT”);

myFile = SD.open(“1.txt”, FILE_WRITE);
 if (myFile) {
   simSerial.println(“AT+CFTRANTX=“c:/data.txt””);
   while (simSerial.available() > 0) {
     byte voc = simSerial.read();
     myFile.write(voc);
   }
   myFile.close();
   // Serial.println("\nClose done.");
 } else {
   // Serial.println(“Error opening 1.txt”);
 }

// re-open the file for reading:
 myFile = SD.open(“1.txt”);
 if (myFile) {
   Serial.println(“1.txt:”);
   while (myFile.available()) {
     Serial.print(myFile.read());
   }
   myFile.close();
   Serial.println("\nReading SD Card done.");
 } else {
   Serial.println(“Error opening 1.txt”);
 }

}

void loop() {

}




data.txt is A1A2A3...F9F0 and get on SD 000000000062480198616224 .


Any help would be appreciated.