Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SIM900 TIPS AND TRICKS

TUTORIAL

Attach to GPRS Service

-> AT+CGATT = 1
<- OK

Define PDP Context (cid, PDP type, APN)

-> AT+CGDCONT=1,"IP","zap.vivo.com.br"
-> AT+CGDCONT=1,"IP","tim.br"
<- OK

*Configure primary and secondary Domain Name Servers (não funciona) *

-> AT+CDNSCFG="8.8.8.8","8.8.4.4" 
<- OK

*Start Task & set APN, User ID, and password * AT+CSTT="","",""

-> AT+CSTT="zap.vivo.com.br","vivo","vivo"
-> AT+CSTT="tim.br","tim","tim"
<- OK

Bring up wireless connection with GPRS - THIS MAY TAKE A WHILE

-> AT+CIICR
<- OK

Get Local IP address

-> AT+CIFSR
<- xxx.xxx.xxx.xxx *returns IP address assigned to your module*
<- OK

Get Connection Status

-> AT+CIPSTATUS
<- OK
<- STATE: IP STATUS *returns status of connection, needs to be 'IP STATUS' before you can connect to a server*

Tells module to add an 'IP Header' to receive data

-> AT+CIPHEAD=1
<- OK

Indicates whether connection request will be IP address (0), or domain name (1)

-> AT+CDNSORIP=1 
<- OK # ERROR

Indicates you've connected to the server - this command may take time to give this response

-> AT+CIPSTART="TCP","www.google.com","80" # Start up TCP connection (mode, IP address/name, port)
<- OK
<- CONNECT OK

Issue Send Command

-> AT+CIPSEND
<- > # wait for module to return '>' prompt to indicate it's ready to receive data
-> GET / HTTP/1.1 (CNTL + M and CNTL + J) # Send data - this example is an HTTP request for the google
-> Host: http://www.google.com (CNTL + M and CNTL + J)
-> Connection: Keep-Alive (CNTL + M and CNTL + J )
-> Accept: */* (CNTL + M and CNTL + J )
-> Accept-Language: en-us (CNTL + M and CNTL + J)
-> (CNTL + M and CNTL + J and CTRL + Z)
<- # data from server returned - Server will return data he

EXEMPLO

AT+CIPSTART="TCP","www.google.com","80"
OK

CONNECT OK
AT+CIPSEND
> GET / HTTP/1.1
Host: http://www.google.com
Connection: Keep-Alive
Accept: */*
Accept-Language: en-us


SEND OK

+IPD,215:HTTP/1.1 400 Bad Request
Content-Length: 54
Content-Type: text/html; charset=UTF-8
Date: Mon, 29 Jun 2015 05:38:41 GMT
Server: GFE/2.0
Connection: close

<html><title>Error 400 (Bad Request)!!1</title></html>
CLOSED
--- EXEMPlO ---

1 - CLIENT

AT+CGATT?
AT+CSNS=4
AT+CSTT="zap.vivo.com.br","vivo","vivo"
ou
AT+CSTT="tim.br","tim","tim"  
AT+CIICR
AT+CIFSR
AT+CIPSTART="TCP","uproc.com.br","80"
AT+CIPSEND
> POST /callback HTTP/1.1
Host: http://www.uproc.com.br
Connection: Keep-Alive
Accept: */*
Accept-Language: en-us

{"param1": "value", "param2": "value2"}

AT+CIPCLOSE
AT+CIPSHUT

2 - HTTP REQUEST (FUNCIONA)

AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","zap.vivo.com.br"
ou
AT+SAPBR=3,1,"APN","tim.br"
AT+SAPBR=3,1,"USER","vivo"
AT+SAPBR=3,1,"PWD","vivo"
AT+SAPBR=1,1
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","www.uproc.com.br/page.php?dat=788868856775757467484648464874"
AT+HTTPACTION=0 
AT+HTTPTERM
AT+SAPBR=0,1 # disconnect gprs
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","www.uproc.com.br"
AT+HTTPDATA=100,10000 # precisa digitar todos os 100 caracteres antes do timeout 10.000ms
> # put the data to send here
AT+HTTPACTION=1
AT+HTTPTERM
AT+SAPBR=0,1 # disconnect gprs

SERVER

AT+CGATT = 1
AT+CSNS=4
AT+CSTT="zap.vivo.com.br","vivo","vivo" 
ou
AT+CSTT="tim.br","tim","tim" 
AT+CIICR
AT+CIFSR
AT+CLPORT="TCP","8080"
AT+CIPSERVER
AT+CIPSEND 
AT+CIPCLOSE 
AT+CIPSHUT

MAKE A CALL # OK

AT+CMGF=0
ATD91166650;
ATH0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment