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?

asked Sep 16, 2015 at 4:59
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" Commented Sep 16, 2015 at 9:41
  • It return +SAPBR: 1,3,"0.0.0.0". What is that said? Commented Sep 18, 2015 at 2:04
  • That means you are not connected. Commented Sep 18, 2015 at 3:13

4 Answers 4

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.

answered Dec 16, 2015 at 1:20
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

answered Sep 16, 2015 at 11:25
1
  • how to know my IP address? my device run by SIM card Commented Sep 18, 2015 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.

jfpoilpret
9,1627 gold badges38 silver badges54 bronze badges
answered Nov 28, 2016 at 18:05
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

answered Feb 14, 2019 at 10:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.