Weird characters or wrong letters when working with SIM7600

Hi,

I'm using the SIM7600CE shield designed by dfrobot, this is the link to it

I need it for a very simple HTTP get to retrieve data from a database with the aid of PHP script pre-uploaded to the server

so to start with it, i used this code:

#include <SoftwareSerial.h>
SoftwareSerial myserial(7, 8); //Define virtual serial port name as myseria,Rx is port 7, Tx is port 8
void setup()
{
  myserial.begin(115200); //Initialize virtual serial port
  Serial.begin(115200); //Initialize Arduino default serial port
}

void loop()
{
  while(1){
  while (myserial.available()) {
    Serial.write(myserial.read());//if Serial received data, output it via mySerial.
  }
  while(Serial.available()) {
    myserial.write(Serial.read());//if myserial received data, output it via Serial.
  }
}
}

So I'm doing okay with the HTTP execution and everything. However, often i get weird characters or even wrong letters in names for example it prints the letter Q instead of S, this "weirdness" happens so randomly and in different places everytime i repeat the whole thing

Example of these weird characters:
image
You see the second line here, it is supposed to be +HTTPREAD:
The word following Name, it is supposed to be Second, I have no idea how did this S get replaced with Q
And guys before you say this could be a problem from my server, this issue can sometimes happen in another line while this line being perfect, it's just that there is no consistency in the location of the error

So do you have any thoughts on this? how can fix this?

Also FYI:
1-I did try restarting everything
2- my HTTP request is okay, i tried it in the browser and it works nicely

I have the same SIM7600 module.

I doubt you will be able to communicate with it reliably at 115200 baud over Software Serial... in fact almost impossible. If you are using something with extra serial ports then use those instead. If not, then read on...

If you slow the baud rate down then I have found the communication reliable. 19200 works fine... you can probably get faster but unless you need it I wouldn't bother.

To be able to do this however you need to change the baud rate on the SIM7600. To do that you can use this basic sketch (pretty much the same as your sketch) to send commands.


#include <SoftwareSerial.h>

SoftwareSerial Serial2(7,8);

void setup()
{
  Serial.begin(115200);
  Serial2.begin(115200);

  delay (500);
}

void loop()
{
  while(Serial.available()) 
  {
    Serial2.write(Serial.read());
  }

  while (Serial2.available()) 
  {
    Serial.write(Serial2.read());  
  }
}

Remember to set the baud rate in the Serial monitor to match (115200)
Once the device starts up fully (can take over 30 seconds)... issue this command to change the baud rate of the SIM7600.

AT+IPREX=19200

Once issued change the sketch & serial monitor to 19200 and issue some AT commands to confirm the new value has been set.

After that you are good to go... change your original sketch and see how it goes.

Good luck!

1 Like

Thanks a lot!!, this helped in removing the strange characters AND IT EVEN SHOWED MORE DATA.

Happy to help. :slight_smile:

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