Thank you for sharing your code.
Here are AT commands needed to send data to Thiengspeak with GSM module SIM900.
AT commands were tested with terminal.
[quote:6fa7e6b41a]RDY
+CFUN: 1
+CPIN: READY
Call Ready ' IF BAUD RATE IS FIXED GSM AUTOMATIC ANSWER WITH +CFUN: 1, +CPIN: READY (OR ERROR, THEN YOU MUST PUT PIN CODE), AND +CALL: READY
AT+CSQ ' GET SIGNAL LEVEL
+CSQ: 19,0
OK
AT+SAPBR=3,1,"CONTYPE","GPRS" 'CONNECT TO GPRS
OK
AT+SAPBR=3,1,"APN","internet" ' (FOR USER NAME & PSW USE DATA OF YOUR PROVIDER)
OK
AT+SAPBR=1,1
OK
AT+HTTPINIT
OK
at+sapbr=2,1 'Get GSM local IP
+SAPBR: 1,1,"XXX.XXX.XXX.XXX" 'gsm IP ADDRES GPRS OK. IF ANSWER IS +SAPBR: 1,3,"0.0.0.0" GPRS SI NOT CONNECTED
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPSSL=1 'Enable the SSL function (YOU MUST ENABLE SSL ELSE ANSWER FROM SERVER will be 0,603,0)
OK
AT+HTTPPARA="URL","https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=18&field2=32&field3=33"+CRLF 'SEND URL XXXXX YOUR API KEY
OK
AT+HTTPACTION=0 'GET ANSWER FROM SERVER
OK
'mind: TIME TO RECIVE ANSWER is between 1 and 5 seconds
+HTTPACTION:0,200,3 ' ANSWER OK, SEND BACK 3 BYTE
AT+HTTPREAD ' READ ANSWER FROM SERVER
+HTTPREAD:3 'ANSWER IS 3 BYTE LONG
120 ' RECIVED DATA FROM SERVER
OK
AT+HTTPTERM 'TERMINATE HTTP SERVICE
OK
AT+HTTPINIT 'INITIALISE HTTP SERVICE
OK
AT+HTTPPARA="URL","https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXXXX&field1=18&field2=32&field3=33" +CRLF 'SEND URL XXXXX YOUR API KEY
OK
AT+HTTPACTION=0
OK
'Mind: TIME TO RECEIVE ANSWER (1 - 5 sec)
+HTTPACTION:0,200,3
AT+HTTPREAD
+HTTPREAD:3
121
OK
AT+HTTPTERM 'TERMINATE HTTP SERVICE
OK
AT+SAPBR=0,1 'DISABLE GPRS
OK
[/quote:6fa7e6b41a]
↧