I’ve been running trials using the Ethernet for uploading energy data to emoncms.

Works fine, and I tested that it works with the OpenKontrol Gateway as well.

However, some people still don’t have reliable broadband, and others won’t want you using their upload capacity to get energy data online.

So, it was time to try to get a GPRS option working. This summary is going to tell you what I’ve done so far! Any input would be appreciated – I had hoped to write this up with it working, but I'll update this as I go.  Photobucket

Figure 1. Overview of the OKG with SM5100B. I started with buying the OpenKontrol Gateway from the shop, and bought the following from CoolComponents:

1 x Cellular Shield with SM5100B

1 x Quad Band Cellular Antenna SMA

2 x Stackable Header - 6 Pin

Alternative shields are the SIM900 and the awesome looking cooking-hacks shield.

I used this power supply for the OKG.

Photobucket

Figure 2. Power Supply for the OKG

I downloaded this terminal program to the laptop from https://sites.google.com/site/terminalbpp/ so that I could see 2-way comms with the SM5100B.

Photobucket

Figure 3. Terminal showing successful registration on network.

The following drawing isn’t far off what I was trying to do…. Photobucket

Figure 4. Useful schematic to illustrate one approach using a SIM900 module from http://www.elecfreaks.com/wiki/index.php?title=File:Wireless-EFCom-18.jpg

I setup a separate power supply for the SM5100B as recommended in Ref 1. Photobucket

Figure 5. Power Supply for the SM5100B-D (needs to be at least 2A!)

I also use a tiewrap to secure the antenna connection. There isn’t any cable support to prevent mechanical strain on the soldered connections, and I knew it would get a lot of movement on the desk. Photobucket

Figure 6. Tiewrap to secure RF connection.

The reset and GND lines from the OKG and the SM5100B were connected, as well as the appropriate UART port; I used the SS/MISO pins on the expansion port of the OKG(pins 10,11 on the Atmega328). I’ve including a few photo’s showing the setup in more detail. Note that I’m using a M2M[ Machine SIM] with no pin. Make sure you disable the pin requirement before you test with your own SIM card.

Photobucket Photobucket Photobucket Photobucket

Figure 7-10. Closer views of connections.

I used the sample sketch (Ref 8) at http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Cellular/Cellular_Shield_... and simply added my SoftwareSerial port like this, in the sketch …..’SoftwareSerial cell(10,11);’ since the ATmega328 only has one hardware serial.

I’ve read that since you are limited to 9600 baud using the SoftwareSerial port, data loss might be a problem. 115200 baud is recommended to keep up with the SM5100B. Might need to use a 128 which has 2 hardware ports….but I should be able to connect before I need to go swopping it out. I was able to register on the GSM network and receive calls. However, when I try to send data to emoncms, the socket closes and the connection is lost. I do get an ack back in the +SOCKSTATUS: confirming the data has been received though.

The following is a set of test results with the SM5100B.

1: Validate Registration on O2 network

AT+CGATT? AT+CGATT=1 (GPRS Attached) AT+CGDCONT=1,"IP","Internet","",0,0(Setup PDP context for your network)

AT+CGPCO=0,"","",1 (Configure parameters, in my case username and password isn’t needed)

AT+CGACT=1,1( Activate the PDP context)

AT+SDATACONF=1,"TCP","213.138.101.177",80 (Configure a remote host before we open a TCP or UDP connection) AT+SDATASTART=1,1 (Start Connecting)

AT+SSTRSEND=1,http://emoncms.org/api/post?apikey=MYAPIKEY&json={power:274}

AT+SDATASTATUS=1(Query the socket status) 

+SOCKSTATUS: 1,1,0102,173,173,0(Means we’ve sent 173 characters and have receive ack’s for 173 from the remote host) RESULT: OK at terminal – no update on emoncms.org I’ll update this as I continue…...

Update(19th Nov 2012): 

When I useusing the sockettest [Ref 12 ] tool to just test out whfor this[ Client tab]. The IP address is pointing me to http://vis.openenergymonitor.org/ for some reason....

S: http://emoncms.org/api/post?apikey=MYAPIKEY&json={power:274}

 <SNIP>

      <p>Hello! This is the old entry point for the hosted openenergymonitor emoncms. The new entry point is emoncms.org, if       you have an account on vis.openenergymonitor.org all your data can be accessed via emoncms.org just log in as usual.</p>

    <h2><a href="http://emoncms.org" >emoncms.org</a></h2>
    <p><a href="http://vis.openenergymonitor.org/emoncms3/" >Old Emoncms Login</a></p>
    <p>If you have any questions feel free to drop me an email: <b>trystanlea@openenergymonitor.org</b></p>
    </div>

 <SNIP>

____________________________________________________________________________________________

By Eamonn O'Brien (EnergyRnR).

__________________________________________________________________

References

1. Tutorial in 2 parts, but doesn’t yet deal with GPRS data http://tronixstuff.wordpress.com/2011/01/19/tutorial-arduino-and-gsm-cel...

2. Excellent application. http://www.imamuseum.org/blog/2012/06/26/tracking-the-island-resident-wi...

3. Useful TCP/IP AT command ref http://www.sparkfun.com/datasheets/CellularShield/SM5100B%20TCPIP%20App%...

4. Example code (from someone who’s got it working with an UNO) http://rexids.blogspot.ie/2012/08/so-ive-been-working-with-arduino-uno.html

5. COSM example : http://community.cosm.com/node/623

6. Useful checklist before you start : http://nicegear.co.nz/blog/gprs-with-the-sm5100b-arduino-gsm-shield/

7. The sparkfun comments here are useful https://www.sparkfun.com/products/9607

8. The documents listed below the product descriptions should be reviewed also https://www.sparkfun.com/products/9607

9. And of course Arduino.cc has some folks who’ve had experience with the SM5100B http://arduino.cc/forum/index.php?topic=71787.0

10. Similar project using the SIM900 module http://www.elecfreaks.com/wiki/index.php?title=File:Wireless-EFCom-18.jpg

11. Excellent Application http://labs.vectorform.com/2011/10/remote-temperature-monitoring-with-th...

12. Useful UDP/socket tool; http://sockettest.sourceforge.net/

13. Good summary of the different GPRS options from makezine.com. http://books.google.ie/books?id=14HZK0Pi-mEC&pg=PA395&dq=telit+gm862+SM5100b+compared&hl=en&sa=X&ei=elurULC2HtGV0QWZi4HgAQ&ved=0CCwQ6AEwAA#v=onepage&q&f=true

14. Another possibility; http://store.open-electronics.org/?_route_=/Arduino/Shield/GSM_GPRS_GPS_SHIELD