Arduino reading garbage from SIM900

Hey Guys and Gals :grinning: ,

I wrote this sketch to send the command “AT” to the SIM900

So things I would like to eliminate:

1.The RX and TX pins are in the right place.
2.The Sim 900 Board works, I have tested it with other sketches.
3.I have tried other commands like AT+CSQ.

See below my sketch:

#include <SoftwareSerial.h>

SoftwareSerial SIM900(2, 3);

void setup() {
  Serial.begin(9600);
  SIM900.begin(19200);
  Serial.println("Comm's initiated");
  
  SIM900power();
  Serial.println("SIM 900 Power Cycle Completed");
  
  SIM900.write("AT");
  Serial.println("Sent AT Command");
  
  while (SIM900.available() > 0)  {
    char ch = SIM900.read();
    Serial.println(ch);
  }
}

void SIM900power()  {
  digitalWrite(8, HIGH);
  delay(5000);
  digitalWrite(8, LOW);
  delay(10000);
}

void loop() {

}

So when I upload the sketch and open the serial monitor I should see this(or atleast this is what I think I should be seeing :wink: ):

Comm’s initiated
SIM 900 Power Cycle Completed
Sent AT Command
OK <<< THIS BEING THE SIM900 AFTER EXECUTING THE AT COMMAND

But this is what I am seeing

SEE ATTACHED IMAGE OF SERIAL MONITOR

So I’m note sure if I’ve left something out of if I’ve done something wrong. Does anyone out there know why I’m receiving this?

Thanks Cal

Are ypu sure the baud is 19200 bps?
I think the default baud for SIM900 is 115200 bps
Give it a try

  SIM900.write("AT");
  Serial.println("Sent AT Command");
  
  while (SIM900.available() > 0)  {
    char ch = SIM900.read();

I think you should move this while to your loop function since serial comunication are slow and you could hit that while more fast than the incoming bytes are arriving to serial buffer

Thanks for the replay... you know what the problem was... drum roll... the baud rate was supposed to be 4600 so you wernt of on the problem :wink:

My new issue is to take the data from the SIM 900 and try and manipulate it lol

Thank you again! :grinning: :grinning: :grinning:

the baud rate was supposed to be 4600

The SIM900? Which board are you using?

Its a board I made myself,

Well done.Your board makes me remember old days when I also make boards by hand.
Good job :slight_smile: