SM5100B shield send data to server. Doubts and Suggestions

Hello mates!

I´m on a project which will be my final paper at University!

First off, my intention is to get some data, which my Mega will receive via Xbee by another arduino, and transmit it via GPRS to a webserver. The first part is being handled by a friend of mine, so I will not discuss about it here. He developed the .aspx page which will be responsible for “getting the data”. In other words, everytime I acess the page xxxx/putenergy.aspx?idmed=2&watts=[value] and change the field [value] to the desired value, the latter will be inserted in our sql database.

The main idea would be making the module “visit” that page and everything would be fine, so I suppose I could simply do a POST, isn´t that right?

However, I´m encountering difficulties to get this shield working as I want! There are three problems so far.

1st - I can´t connect using AT+SDATACONF host value as a “www.xxx” name like the example given in the TCP/IP APP Note from the oficial site. It makes the module to reboot.

Starting SM5100B Communication...
ôÐÐ
+SIND: 1

+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1

+SIND: 11

+SIND: 3

+SIND: 4
 AT+CGATT?

+CGATT: 1

OK
AT+CGDCONT=1,"IP","zap.vivo.com.br"

OK
AT+CGPCO=0,"vivo","vivo", 1

OK
AT+CGACT=1,1

OK
AT+SDATACONF=1,"TCP","www.google.com",80
ÐÐÐèÐ
+SIND: 1

+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1

+SIND: 11

+SIND: 3

+SIND: 4

2nd - I can solve the above problem by connecting via IP adress. The IP below is from the server which is holding that page which I mentioned earlier.

Although I can connect and the server seems to acknowledge the data, I never get the +STCPD:1 confirmation.

I don´t know if the sintax of the POST command in the SSTRSEND is right!

Starting SM5100B Communication...
èÐÐ
+SIND: 1

+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1

+SIND: 11

+SIND: 3

+SIND: 4

AT+CGATT?

+CGATT: 0

OK
AT+CGATT=1

OK
AT+CGATT?

+CGATT: 1

OK
AT+CGDCONT=1,"IP","zap.vivo.com.br"

OK
AT+CGPCO=0,"vivo","vivo", 1

OK
AT+CGACT=1,1

OK
AT+SDATACONF=1,"TCP","187.73.33.212",80

OK
AT+SDATASTART=1,1

OK
AT+SDATASTATUS=1

+SOCKSTATUS:  1,1,0102,0,0,0

OK
AT+SSTRSEND=1,"POST /putenergy.aspx?idmed=2&watts=1042 HTTP/1.0"

OK
AT+SDATASTATUS=1

+SOCKSTATUS:  1,1,0102,48,48,0

OK

3rd - Last but not least. This one is really tricky. It started to happen out of the blue, and now i just can´t get it to happen again. Using the same set of commands and configurations from the 2nd problem, after sending the data, the module would return a CME Error:33 - which does NOT exist in the manual! :~

Could you guys shed light on my problem? I´m really in need of some help here!

I´ve been searching for the solution to my problems, but I can´t seem to find it! Found a lot of unanswered topics about the subject!!

I do accept suggestions on others GPRS modules to use, and which, you guys already managed to do what I want to do!

Cheers!

I´m still in the pursuit of the answer! Hehehe!

During this time, I found that I need do a GET request in order to do what I want! I successfully managed to do the GET request via a Telnet session, using the above statement:

"GET /putenergy.aspx?idmed=2&watts=3232 HTTP/1.1
Host: http://www.abqct.com.br"

Although, I just can´t do it using the AT commands!

Yesterday I spent some more time trying to make it work. I started using SDATATSEND instead of SSTRSEND, due to the fact that, as far as I am concerned it allows me to send data to the server in a transparent way. In other words (correct me if I am mistaken) its almost like a telnet session.

I managed to get an OK message, however as soon as I get it I also get +STCPC:1 , which means that the connection was terminated by the remote host. When in a telnet session the server also closes the connection when the GET/PUT request is done, so, I thought it worked even not receiving the +STCPD:1 confirmation. Yet, I was wrong. The GET request wasn´t successful.

I tried sending simple data (numbers) such as the example found on “SM5100B TCP/IP App Note” pdf, I get the OK message, but I never get the +STCPD:1 confirmation.

These are the commands I´m using after setting up the connection and connecting to the server:

AT+SDATATSEND=1,75<LF><CR>
GET /putenergy.aspx?idmed=2&watts=3232 HTTP/1.1<LF><CR>
Host: http://www.abqct.com.br <LF><CR>
<LF><CR>
<CTRL+Z>

OR

AT+SDATATSEND=1,75<LF><CR>
GET /putenergy.aspx?idmed=2&watts=3232 HTTP/1.1<LF><CR>
Host: http://www.abqct.com.br <LF><CR>
<END OF TRANSMISSION> (this is the 004,BYTE from ASCII table)
<CTRL+Z>

Hey guys! To my mind, now is not a module´s problem anymore! This is the situation:

I decided to run a mini local webserver and monitor the port to see if the module was really connecting and sending data. Guess what? It does connect and send data!!

The problem is that the server is not acknowledging the data, and so nothing happens! Even the server log doesn´t show any love. The wierd thing is that I´m using the same sintax which I´m using to send via Telnet:

GET /index.html HTTP/1.1 
Host: xxxxxx.zapto.org

Could it be header problems?? Does anyone know what it could be???

I did notice one issue with your commands …

AT+SDATATSEND=1,75

… is wrong because the should come before . So this is correct …

AT+SDATATSEND=1,75<CR><LF>

… but that may not solve your problem. I’m experiencing the same exact problem as you and posted a similar topic on Link Sprite’s forum. No response over there yet, but I just posted it. I know that my HTTP request is well formed because it works when I test it using telnet. So my problem is trying to execute the same HTTP GET request using AT+ commands on my SM5100B module.

Here’s the HTTP GET Request I’m trying to use. I’ve replaced my own domain with http://www.example.com.

GET /gprs.txt HTTP/1.1
Host: www.example.com

Below I prove that my HTTP GET request is well formed because it returns the “hello, world!” website that I’ve setup…

$ telnet www.example.com 80
Trying <my server's IP address>...
Connected to example.com.
Escape character is '^]'.
GET /gprs.txt HTTP/1.1
Host: www.example.com

HTTP/1.1 200 OK
Date: Sat, 31 Mar 2012 14:20:39 GMT
Server: Apache
Last-Modified: Sat, 28 May 2011 17:35:11 GMT
ETag: "35e132-e-4a45979e5f1c0"
Accept-Ranges: bytes
Content-Length: 14
Content-Type: text/plain

hello, world!

And here’s my most recent attempt at doing the same thing on my SM5100B module.

AT+CFUN=1,1
OK
~~~~~~~~~~
+SIND: 1

+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1

+SIND: 11

+SIND: 3

+SIND: 4
AT+CMEE=2
OK
AT+SLOG=1
OK
AT+SBAND=7
OK
AT+CGATT?
+CGATT: 1

OK
AT+CGDCONT=1,"IP","wap.cingular"
OK
AT+CGACT=1,1
OK
AT+SDATACONF=1,"TCP","<my server's IP address>",80
OK
AT+SDATASTART=1,1
OK
AT+SDATASTATUS=1
+SOCKSTATUS:  1,1,0102,0,0,0

OK
AT+SDATASTATUS=0
OK
AT+SDATARXMD=1,1,0
OK
AT+SDATATSEND=1,46
GET /gprs.txt HTTP/1.1
Host: www.example.net

[ctrl+z]
OK

The above AT+SDATATSEND returns OK, but I don’t see any response in the console and the web server logs don’t show the attempt (telnet does). I’ve tried every possible combination of AT+SSTRSEND, AT+SDATATSEND and AT+SDATASEND without any success. Even when I get “OK” from multiple lines sent at once, I don’t see anything in the web server logs like I do in my telnet test.

I feel the issue lies with how my newlines are being sent/translated, but I may be doing something wrong on the AT+ side of things, so I don’t know. Any help is appreciated.

Hi,

I’m facing the same problem, have you found a solution?

Hello,

I am having the same problem.

Has anyone a solution for this?

Regards

Did anyone found the solution ?

I think you have to try with 49 characters (in the example that you left). Remember that the carriage return and the new line are two characters and also the last blank line is two characters.

Also you have to wait before entering the http request until the module returns the "> " string.

I know this can be a pain, it took one day for me to get it working…

Tell us if you make it :slight_smile:

Regards,

Adrián