Pages: [1]   Go Down
Author Topic: Sending AT commands and reading response  (Read 919 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

#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)
  {;    //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.

Offline Offline
Sr. Member
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged all my Arduino/electronic projects!!!

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

Offline Offline
Full Member
Karma: 4
Posts: 174
The red wire is ground, right ???
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

shouldn't you be using println instead of print?

Seattle, WA USA
Online Online
Brattain Member
Karma: 652
Posts: 50863
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Pages: [1]   Go Up
Jump to: