- The code.
#include <NewSoftSerial.h> //Include the NewSoftSerial this creates a fake serial port on a normal digital input/output pin
char incoming_char=0; //Initiate a variable that will hold the incoming character from the Serial Port.
NewSoftSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
void setup() //This functions runs once when the arduino starts up.
{
Serial.begin(9600); //Initialize serial ports for communication.
cell.begin(9600); //Initialize 'fake' serial ports for communication.
Serial.println("Starting SM5100B Communication..."); //Print to the serial monitor so you know what's going on.
delay(3000);
//cell.print("AT+IPR=9600");
}
void loop() //This function runs continually... you might say it 'loops'... get it?
{
if(cell.available() >0) //If a character comes in from the cellular module...
{
incoming_char=cell.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
if(Serial.available() >0) //If a character is coming from the terminal to the Arduino...
{
incoming_char=Serial.read(); //Get the character coming from the terminal
cell.print(incoming_char); //Send the character to the cellular module.
}
}
- if you get the wrong display after Starting SM5100B Communication… in the serial port monitor.
not like this:
Starting SM5100B Communication...
+SIND: 1
+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1
+SIND: 11
+SIND: 3
+SIND: 4
you need change the baud rate of your sm5100b to 9600, as newsoftserial cannot work with 115200. see viewtopic.php?f=14&t=22883. thanks Whoismaha.
You may need a FTDI cable,
(Suppose the code NewSoftSerial cell(2,3); used)
FTDI ------------- SM5100B
GND ------------- Digital GND
RX(Yellow) ------------- Digital #2
TX(Orange) ------------- Digital #3
- if you get +SIND 8, then you may need change the band setting.
+SIND: 1
+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1
+SIND: 3
+SIND: 8
+SIND: 4
AT+SBAND=X
check with your service provider to see which frequency is the right one.
Refer the SM5100B-D AT Command Page 127 AT+SBAND for detail
Reference value:0-10
value description
0 GSM900
1 DCS1800
2 PCS1900
3 GSM850
4 GSM900&DCS1800
5 GSM850&GSM900
6 GSM850&DCS1800
7 GSM850&PCS1900
8 GSM900&PCS1900
9 GSM850&GSM900&DCS1800
You should be good to go.
:roll: