Sparkfun GSM/GPRS SM5100b shield on a Diavolino

I have decided to return the SM5100B evaluation board since I am instead using the SM5100B cellular shield. This is because I was not really going to use any of the interface pins of the SM5100B module broken out on the eval board. One useful thing about the shield (that I wasn’t expecting) is that it is able to reset the cellular module using the on board reset button similar to the eval board.

8008528875_923b20b2d9_z

The Diavolino board here is running without any AVR 328 mega chip plugged into it, and has the 2.5mm x 5.5mm power barrel socket for the 5V 3A regulated power supply from EvilMadScience.

Diavolino hosting a GSM/GPRS shield

Meanwhile although I can receive TCP data on the SM5100B modem over GPRS I still haven’t been able to successfully confirm transmission of data.

TCP connection over GPRS with SM5100B module

After having no success sending GET requests to HTTP servers I finally decided to set up my own tcp server by directing a port on my router to my PC and setting up a simple tcpserver listener in cygwin like this:

~ > tcpserver -t1000 -v -Bare_we_receiving 0 9876 bash -c "sleep 1000"
tcpserver: status: 0/40

Then I sent the following commands to the modem

AT+CGATT? 
AT+CGDCONT=1,"IP","epc.tmobile.com" 
AT+CGPCO=0,"None","",1 
AT+CGACT=1,1
AT+SDATACONF=1,"TCP","MY_ROUTER_ADDRESS",9876 
AT+SDATARXMD=1,1,0
AT+SDATASTART=1,1

For some reason the MY_ROUTER_ADDRESS had to be the text host name instead of the IP address, which was something like c-blah-blah.comcast.net for me as per my router.

Immediately I saw a connection appear in the tcpserver log:

tcpserver: status: 1/40
tcpserver: pid 5232 from 208.54.32.166
tcpserver: ok 5232 :::ffff:192.168.1.111:9876 :::ffff:208.54.32.166::50107
tcpserver: end 5232 status 256
tcpserver: status: 0/40

And then some data was received on the GPRS modem side:

> +STCPD:1
>

Which I read back promptly:

AT+SDATASTATUS=1
> +SOCKSTATUS: 1,1,0102,54,0,16
> 
> OK
>
AT+SDATAREAD=1
> +SSTR:1,are_we_receiving
> 
> OK
>

And it exactly matched the banner text. So atleast I can establish TCP connections. The AT command interface though is a real pain.

Push growl notifications to Prowlapp with telnet

Assuming that you know what I am talking about, here is how it was done:

> cat ~/bin/http_get.sh
 #!/bin/bash
 if [ $# -ne 4 ]
 then
 echo "Example: `basename $0` test.com 80 test.com / | telnet"
 exit 1
 fi
 echo "open $1 $2"
 sleep 2
 echo "GET $4 HTTP/1.0"
 echo "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4"
 echo "Host: $3"
 echo
 echo
 sleep 2
 > ~/bin/http_get.sh www.prowlapp.com 80 www.prowlapp.com '/publicapi/add?apikey=YOUR_PROWL_KEY_GOES_HERE&application=dah&event=doo' | telnet
 telnet> Trying 209.20.72.170...
 Connected to www.prowlapp.com.
 Escape character is '^]'.
 HTTP/1.1 200 OK
 Date: Mon, 10 Sep 2012 23:40:33 GMT
 Server: Apache/2.2.3 (CentOS)
 X-Powered-By: PHP/5.1.6
 Vary: Accept-Encoding
 Content-Length: 118
 Connection: close
 Content-Type: text/xml
 <?xml version="1.0" encoding="UTF-8"?>
 <prowl>
 <success code="200" remaining="999" resetdate="1347324034" />
 </prowl>
 Connection closed by foreign host.

Thanks to this tonycode.com blog post for the script idea with telnet.