Serial Terminal not working with AT commands

I recently bought a module sim 808 evb-v3.2 and I wanted to do a basic test.

From the following code I want to write AT commands in the serial terminal and get an answer from the module

#include <SoftwareSerial.h>
SoftwareSerial SIM808(7, 8); //Seleccionamos los pines 7 como Rx y 8 como Tx

void setup()
{
 SIM808.begin(9600);
 Serial.begin(9600);
 delay(100);
}

void loop()
{
 //Envíamos y recibimos datos
 if (Serial.available() > 0)
 SIM808.write(Serial.read());
 if (SIM808.available() > 0)
 Serial.write(SIM808.read());
}

I was following a tutorial from this page: https://www.prometec.net/sim808/#:~:text=Para%20encender%20el%20módulo%20utilizaremos,parpadear%20una%20vez%20por%20segundo.

and they got the following output:

When I try the same I'm getting the following symbol:

Do you guys know why I'am getting this symbol instead the normal text??

Any sugestion would be aprecciate it

First guess, is the device actually configured for 9600 baud? Second guess, is your Serial Monitor window configured for 9600 baud? The latter is what I expect is wrong.

Looks like it is...
image

So, most likely the device is configured something other than 9600.

unfortunately I don't have the datasheet of my exact model but I have seen videos on youtube and almost everyone configure the Serial in 9600 baud.

And yes my Serial monitor is configured in 9600, you can see that in the top right corner of the attached picture

Try this sketch to try and find a baud rate that works...

#include <SoftwareSerial.h>

SoftwareSerial softSerial(7, 8);  // Rx, Tx


uint32_t baud[] = {   
                       300,
                       600,
                      1200,
                      2400,
                      4800,
                      9600,
                     19200,
                     38400,
                     57600,
                     74880,
                    115200
                  };

void setup()
{

  Serial.begin(9600);
  
  for (uint8_t i = 0; i < sizeof(baud) / sizeof(baud[0]); i++)
  {
    softSerial.begin (baud[i]);
    
    Serial.print("Trying @ ");
    Serial.println(baud[i]);
    
    softSerial.println("AT"); 

    unsigned long start = millis();
      
    while (millis() - start < 500)
    {
      while (softSerial.available() > 0)
      {
        Serial.write(softSerial.read());
      }
    }
       
  }
}


void loop()
{}

Do you have any clue how hard that is to spot on a phone screen?
Anyway, yea, I'd dig into the device and see if you can set the baud rate.

I tried with the code you sent me and I'm getting the following:


Trying @ 300
Trying @ 600
Trying @ 1200
Trying @ 2400
Trying @ 4800
Trying @ 9600
Trying @ 19200
Trying @ 38400
Trying @ 57600
Trying @ 74880
Trying @ 115200

From what I can see, it is not printing the "AT" from the SoftSerial

I don't know if I have something that is not well connected


or maybe the alkaline 9v battery is not enough to have the module working properly :confused:

Most likely.

Looks like you have connected RX to RX and TX to TX. They should be RX to TX..

Oh for the clarity of a simple schematic, even one drawn with pen on an envelope.
Without that,
Is it RX-TX, TX-RX, or RX-RX, TX-TX? The latter is wrong.
Is there a common ground between the two boards? Might be that white wire?
Stick with 9600 or 19200 for software serial.

yeah I noticed that and I already changed it and now at least I am getting something from softSerial but I am getting some weird simbols, not the "AT"

image
(the terminal is in 9600 bd)

From the datasheet I found this:


So it should work with 9600 BD

To rule out that the problem is the alkaline battery, I am now powering my module with 9V 2A

Now my connections are like this:

  • pin 7(RX) -> TX
  • pin 8(TX) -> RX
  • Ground -> Ground (Black wire)

Physical Connections:

I really don't know what I am doing wrong here, It looks that the module is fine due the sim led is blinking every 3 seconds and now is getting the proper power (9V 2A)

Again any suggestion would be very helpful

Looks like a baud rate issue.

Instead of sending just an "AT" command try to set the baud rate with...

AT+IPR=9600

1 Like

You were right!
I added that line of code in the first program:

#include <SoftwareSerial.h>
SoftwareSerial SIM808(7, 8); //Seleccionamos los pines 7 como Rx y 8 como Tx

void setup()
{
 SIM808.begin(9600);
 Serial.begin(9600);

 SIM808.println("AT+IPR=9600");

 delay(100);
}

void loop()
{
 //Envíamos y recibimos datos
 if (Serial.available() > 0)
 SIM808.write(Serial.read());
 if (SIM808.available() > 0)
 Serial.write(SIM808.read());
}

and now I can see the answer from the module

image

I even tried with calling my phone number with the ATD comand and it's working!!

image

But well I really want to understand what happened here.
Do I need to always set the module baud rate?? It is not getting a default bauld rate to work with? Because in any basic tutorial there isn't a step to set the bauld rate, like it just runs and works with default settings or maybe I'm not understanding things right.

Somehow the default baud rate must have got changed I guess.

No. But the AT+IPR command only sets it temporarily... if you power down then it will be lost. To set it permanently use...

AT+IPREX=9600

1 Like

I tried to use that command but I am getting this error
image

Also not only with that specific command, if I try to get the gps info I'm also getting that same error
image

Okey I figured out what I was doing wrong.

First of all, I was able to set the baud rate permanently by using the comand "AT&W"
After this for some reason the module is now working wonderfull!

Then about the Error mesage on the gps command was because I was using the command wrong, AT+GPSSTATUS

Yes... was thinking of another device when I mentioned the AT+IPREX command. AT&W will save permanently after you set with AT+IPR.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.