1

I build a simple HTTP GET request by SIM900. Here is it:

-----1-----
AT+CSQ

+CSQ: 25,0

OK

-----2-----
AT+CGATT?

+CGATT: 1

OK

-----3-----
AT+SAPBR=3,1,"CONTYPE","GPRS"

OK

-----4-----
AT+SAPBR=3,1,"APN","indosatgprs"

OK

-----5-----
AT+SAPBR=1,1

OK

-----6-----
AT+HTTPINIT

ERROR

-----6.1-----
AT+HTTPPARA="CID",1

OK

-----7-----
AT+HTTPPARA="URL","http://www.minimalsites.com"

OK

-----8-----
AT+HTTPACTION=0

OK

-----9-----
AT+HTTPREAD

OK

-----10-----
AT+HTTPTERM

ERROR

+HTTPACTION:0,200,1240

-----10.0-----
AT+SAPBR=0,1

OK

The step 9 AT+HTTPREAD I supposed to see some html from http://www.minimalsites.com. But i dont see anything, What wrong with me?

3
  • 1
    Before you do anything HTTP you should do a "AT+SAPBR=2,1" and see if you are actually connected to the bearer. It should return "+SAPBR: 1,1,aa.bb.cc.dd" – Majenko Sep 16 '15 at 9:41
  • It return +SAPBR: 1,3,"0.0.0.0". What is that said? – Tama Sep 18 '15 at 2:04
  • That means you are not connected. – Jake C Sep 18 '15 at 3:13
2

From what I can see in your results, it seems AT+HTTPINIT returned an error. This means the HTTP service wasn't even successfully activated. So there's no way the commands you issued later would have been successful. From the AT command manual, AT+HTTPINIT is necessary before you can do any HTTP-related stuff. You need to run the command AT+CGATT=1 to attach GPRS, even if your query shows its value is already 1. It could also be that your APN requires authentication, using a username and password. So once you find out the username and password authorized by 'indosatgprs' (customer care?), you can use them in the following commands.

    AT+SAPBR=3,1,"USER","Enter the username here"
    AT+SAPBR=3,1,"PWD","Enter password"

Both commands should return OK if successful. To view all the parameters you have set, you can use AT+SAPBR=4,1. If all the parameters are satisfactory, and you have sufficient airtime in the SIM, then you can attempt AT+HTTPINIT. Only if this command returns OK, should you proceed to run AT+HTTPPARA-related commands.

0

Check Your Connection Try Pinging the IP of Your Arduino and INstead of Using the AT commands use this library its easier and Nice https://github.com/amcewen/HttpClient

1
  • how to know my IP address? my device run by SIM card – Tama Sep 18 '15 at 2:08
0

You have to wait after AT+HTTPACTION=0 for a while until you see something like +HTTPACTION:0,200,1240

Then continue to AT+HTTPREAD, you will see the result.

Finally, terminate HTTP.

0

after days fighting with asynchronous and limit serial buffer size (64Bytes). I found this one.

this link help me out, it uses the standard library SoftwareSerial and my big txt file 1100 bytes or my html file (5814bytes) are download again & again with no issue!!

https://www.youtube.com/watch?v=cpgQOmQwUL8&t=1263s http://www.iforce2d.net/sketches/gsm_HTTPGet.zip nb: I change it to AltSoftSerial, no problem neither. Thanks iforce2d

ps: you can also use the "ModuleSerial-master" library, but I need to save the space for other code (which already uses 74% of 2KB RAM) so I stick to AltSoftSerial which already found in my sketch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.