Go Down

Topic: Sending AT commands and reading response (Read 2976 times) previous topic - next topic


Hello, I have a SM5100b that I have successfully connected to a host manually via the Arduino Serial window and passthrough sketch.

I'm brand new to Arduino coding, but I do have limited coding experience in Matlab primarily. I'd like to write a function that connects the module and reads each of the responses that the Module outputs. Here is what I have, but it's not working:

Code: [Select]
#include <string.h>         //Used for string manipulations
char incoming_char=0;      //Will hold the incoming character from the Serial Port.

void setup()
 //Initialize serial ports for communication.
 Serial.begin(9600); // for terminal communication
 Serial1.begin(115200); //  for GSM module communication
 Serial.println("Starting SM5100B Communication...");

void loop() {
 //If a character comes in from the cellular module...
 if(Serial1.available() >0)
   incoming_char=Serial1.read();    //Get the character from the cellular serial port.
   Serial.print(incoming_char);  //Print the incoming character to the terminal.


Pretty basic I know but it doesn't return any of the loading data (+SIND: 11 etc) nor the module response after it sends the AT commands. Any help is greatly appreciated.


try :  Serial.print("AT+CGATT=1");  //GPRS attach
Serial.print("AT+CGATT=0");  //GPRS detach

read the AT command set data sheet, lots of info to go through, but it will make sense eventually
http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:


shouldn't you be using println instead of print?


How many times per second are you jamming data at the device? How long are you waiting for a reply? The poor module can't get a word in edgewise.
The art of getting good answers lies in asking good questions.

Go Up