Professional Documents
Culture Documents
Arduino
Jump to: navigation, search
Contents
[show]
Introduction
This LinkSprite ATWIN Quad-band GPRS/GSM shield has PCB etched antenna, so no need for
external antenna.
ATWIN Quad-band GPRS/GSM shield is an ultra compact and high quality wireless module
base on infineon UCL2 platform with industy-standard interface.
This is a SMT package with small dimension, low power consumption, quad-band (AT139) and
dual-band (AT139D) GSM/GPRS module.
It can provide with voice, SMS, Fax, data applicationgs for customers.
Video Introduction
Features
Features
Description
Network
GSM/GPRS
Frequency AT139:GSM850/GSM900/DCS1800/PCS1900M AT139D:GSM900/DCS1800M
Bands
Hz
Hz
RF Output
AT139:GSM850/GSM900: 33dBm,
AT139D:GSM900:33dBm,
Power
DCS1800/PCS1900:30dBm
DCS1800:30dBm
RF Receive
<-108dBm
Sensitivity
Speech codec
FR,EFR,HR,AMR
modes
SMS
TEXT/PDU
GPRS
GPRS Class 10
Connectivity
Coding SchemeCS1,CS2,CS3,CS4
Physical
Characteristic
s
Package
Dimensions
Weight
Performance
Power Supply
Antenna
MCP
Audio
SIM Card
Application
Pin Amounts
Firmware
Operating
System
SMT
24(0.1)*24(0.1)*3(0.1)mm
4g
3.3V~4.5V
External Antenna
64Mb NOR + 32Mb PSRAM
Two input/output Audio channels
Support SIM Card:1.8V/3.0V
38 PINs
OSE
Application Ideas
Cautions
The warnings and wrong operations possible cause dangerous.
Schematic
Specification
May include key specification and other specifications.
RX jump to MRX, TX jump to MTX, and remove the atmega328P from arduino. By
doing this, we can directly monitor serial port output using the USB port.The default
baud rate is 115200.
Second Tutorial
Now we are going to use atmega328P's UART to talk to USB, and soft serial of
atmega328P to talk to ATWIN.
Before we do that, we have to change ATWIN's data rate to 9600 as soft serial can't go to
119200.In first tutorial setup, do: AT+IPR=9600 to set the baud rate to 9600
Now set the jumper RX to D3, and TX to D2. SO that atmega328P's UART to talk to
USB and soft serial of atmega328P to talk to ATWIN.
Programming
#include
//Include the NewSoftSerial library to send serial commands to the
cellular module.
#include
//Used for string manipulations
char incoming_char=0;
//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()
{
//Initialize serial ports for communication.
Serial.begin(9600);
cell.begin(9600);
Serial.println("Starting ATWIN Communication...");
}
void loop()
{
//If a character comes in from the cellular module...
if(cell.available() >0)
{
incoming_char=cell.read();
//Get the character from the cellular serial
port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
//If a character is coming from the terminal to the Arduino...
if(Serial.available() >0)
{
incoming_char=Serial.read(); //Get the character coming from the terminal
cell.print(incoming_char);
//Send the character to the cellular module.
}
}
Under the 'Script Mode' tab, multiple AT commands can be sent at a time. Users can add
descriptive comments and save the script on their local machine.
Data Call
To make a data call with the modem, you need to connect to the APN of the carrier network. The
carrier APN and other required information are stored in the SIM card and are referred as PDP
contexts. Typically multiple PDP contexts are stored in the SIM for different call types. With the
AT Command Tester you can edit/add/delete PDP contexts in a easy to use user interface.
OK
Checking registration status...
AT+CREG?
+CREG: 0,1
OK
The device is registered in home network.
Checking if device is already connected...
AT+CGACT?
+CGACT: 1,0
+CGACT: 2,0
+CGACT: 3,0
OK
AT+CMEE=1
OK
Attaching to network...
AT+CGATT=1
OK
Connecting...
AT+CGACT=1, 1
OK
Connect Sucessful
SMS
The SMS tab of the 'AT Command Tester' tool provides the interfaces to send SMS messages.
You can also list/view/delete SMS messages stored on the SIM.
OK
The device is registered in home network.
AT+CMGS="858XXXXXXX"
> Test Message with AT Command Tester
+CMGS: 19
OK
SMS Send successful
Network Selection - This tab allows the user to manually select available networks. Modems are
typically set for automatic network selection. 'Find Networks' button will command the modem
to scan for available networks.
+COPS: (2,"T-Mobile","T-Mobile","310260"),(1,"AT&T","AT&T","310410"),,(0,1,4),(0,1,2)
OK
Networks found
Phonebook
With the 'Phone Book' tab, you can add/delete/read phone book entries stored on the SIM,
+CPBR: 3,"8878878878",129,"Test"
OK
Example Project
Send SMS
For this project, the following is the jumper setting:
TX-> MRX
RX->MTX
char str1[]={'A','T','+','C','S','C','S','=','"','G','S','M','"'};
char
str2[]={'A','T','+','C','M','G','S','=','"','1','5','9','7','2','1','6','9','
1','8','9','"'};
int i;
char inByte = 0;
//unsigned char receive_ACK[6];
char hex1[]={0x1A};
void setup()
{
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);
//while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
// }
delay(8000);
Serial.println();
for(i=10;i>0;i--)
{delay(500);
Serial.println("AT");}
delay(1000);
Serial.println("AT");
delay(1000);
for(i=0;i<13;i++)
Serial.print(str1[i]);
Serial.println();
delay(1000);
Serial.println("AT+CMGF=1");
delay(1000);
for(i=0;i<21;i++)
Serial.print(str2[i]);//AT+CMGS="15972169189"
Serial.println();
delay(1000);
Serial.print("HELLO Sir,Thank you very much fit my test!");
delay(1000);
Serial.print(hex1);
delay(1000);
}
void loop()
{ /*
Serial.println("AT");
delay(500);
if (Serial.available() > 0) {
// get incoming byte:
inByte = Serial.read();
Serial.println(inByte);
}
*/
}
Detect an event and send SMS to a cell phone number stored in SD card, and
display alarm in 8X8 LED matrix
#include <SD.h>
char str1[]={'A','T','+','C','S','C','S','=','"','G','S','M','"'};
//char
str2[]={'A','T','+','C','M','G','S','=','"','1','5','9','7','2','1','6','9','
1','8','9','"'};
char hex[]={0x1A};
char WORD;
char
File
char
char
char
char
char
char
char
inByte = 0;
myFile;
RxBuffer[100];//ZHONGZHUAN
From[100];//1
To[100];//2
RxCounter = 0;
Enter=0;
From_len=0;
To_len=0;
void Message(void)
{
delay(1000);
Serial.println();
for(i=2;i>0;i--)
{delay(500);
Serial.println("AT");}
delay(1000);
Serial.println("AT");
delay(1000);
for(i=0;i<13;i++)
Serial.print(str1[i]);
Serial.println();
delay(1000);
Serial.println("AT+CMGF=1");
delay(1000);
for(char i=0;i<From_len;i++)
Serial.print(From[i]);//AT+CMGS="15972169189"
Serial.println();
delay(1000);
for(char i=0;i<To_len;i++)
Serial.print(To[i]);
delay(1000);
Serial.print(hex);
delay(1000);
}
void SDHC(void)
{
Serial.println("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(10, OUTPUT);
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
char i;
RxBuffer[RxCounter++] = myFile.read();
if(RxBuffer[RxCounter-2]==0x0d&&RxBuffer[RxCounter-1]==0x0a)//0x0d
huiche \ ,0x0a huanhang \n
{
Enter++;
switch(Enter)
{
case 1:
for(i=0; i< RxCounter-2; i++) From[i]= RxBuffer[i];
From_len=RxCounter-2;
;break;
case 2:
for(i=0; i< RxCounter-2; i++) To[i]= RxBuffer[i];
To_len=RxCounter-2;
;break;
default:;break;
}
RxCounter=0;
}
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
for(char i=0;i<From_len;i++)
Serial.write( To[i]);
Serial.println();
for(char i=0;i<To_len;i++)
Serial.write( From[i]);
Serial.println();
void setup()
{
Serial.begin(9600);
pinMode(Max7219_pinCLK,OUTPUT);
pinMode(Max7219_pinCS,OUTPUT);
pinMode(Max7219_pinDIN,OUTPUT);
delay(50);
Init_MAX7219();
SDHC();
void loop()
{
// if(count<50)
//{
// count++;
//Normal();
sensorValue = analogRead(analogInPin);
outputValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(500);
if(outputValue>=60)
{
// count=0;
//Alert();
if(count1<3)
Message();
count1++;
}
// }
// else if(count=10)
// {
//Message();
//}
}
FAQ
Please list your question here:
Support
If you have questions or other better design ideas, you can go to our forum to discuss or creat a
ticket for your issue at linksprite support.
Resources
AT137/139_TCPIP_APPNOTE in PDF
How to buy
Here to buy ATWIN Quad-band GPRS/GSM Shield for Arduino on store
See Also
Other related products and resources.
Licensing
This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0
Source code and libraries are licensed under GPL/LGPL, see source code files for details.