+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Newbie level 5
    Points: 73, Level: 1

    Join Date
    Dec 2012
    Posts
    8
    Helped
    0 / 0
    Points
    73
    Level
    1

    sim900 c code startcode to work with

    Dear,

    Im a student

    I would like to connect this* gprs-module to lpc1768, this is an arm-processor.

    So I would have to write C/C++ files, Im currently using mbed.org but this library doesnt include gsm/gprs-files.

    I need to send data like I would feed data to pachube/cosm.com,
    I would send data to a webserver basically (the gprs part is done by me, the webserver is made by somebody else)

    I would only receive a simple command like 'reset the system'

    Is it possible for me to use code from this:

    http://code.google.com/p/gsm-s...

    I would like to have a startcode to work with/modify
    but starting from scratch would not be possible for my current programming skilllevel/time schedule

    thanks if you can help me out..

    ps: somebody told Im supposed to use sockets, is this true or false?

    *http://www.open-electronics.org/smal...00-gsm-module/

  2. #2
    Banned
    Points: 7,016, Level: 19

    Join Date
    Apr 2009
    Location
    New Jersey, USA
    Posts
    671
    Helped
    170 / 170
    Points
    7,016
    Level
    19

    Re: sim900 c code startcode to work with

    Your link to the code is broken so we can't view that.
    Look at the last FAQ on this page http://www.madeeasykits.com/Faqs.asp; it shows you how to send data to a web server.
    Sockets is an operating system API for communicating over a network. If you were writing a program for the PC you would use sockets.



    •   AltAdvertisment

        
       

  3. #3
    Newbie level 5
    Points: 73, Level: 1

    Join Date
    Dec 2012
    Posts
    8
    Helped
    0 / 0
    Points
    73
    Level
    1

    Re: sim900 c code startcode to work with

    thank you for the reply

    its to clear to me if still got some research to do, so this site is very useful

    if I bump in some new clearly defined problems, i can post them later on

    sincere

    - - - Updated - - -

    http://code.google.com/p/gsm-shield-...tibleVer/?r=42

    i hope this link works now

    - - - Updated - - -

    Do I need to use sockets on the microcontroller side if I want to receive data?

    the thing that confuses me is that Im using at-command but also sockets while I get the impression everything is done by at-commands

    and sockets is used in wifi / networks?
    or does my gprs have its own ip-adres?

    but unfortunately I dont really know yet where Im talking about..

    please help

    - - - Updated - - -

    let say I use

    http://www.prasannatech.net/2008/07/socket-programming-tutorial.html

    http://www.pythonprasanna.com/Papers%20and%20Articles/Sockets/tcpserver.c

    how would at-commands fit in here?

    also do I need to use udp or tcp?

    thx..



    •   AltAdvertisment

        
       

  4. #4
    Banned
    Points: 7,016, Level: 19

    Join Date
    Apr 2009
    Location
    New Jersey, USA
    Posts
    671
    Helped
    170 / 170
    Points
    7,016
    Level
    19

    Re: sim900 c code startcode to work with

    Quote Originally Posted by Brecht View Post
    Do I need to use sockets on the microcontroller side if I want to receive data?
    the thing that confuses me is that Im using at-command but also sockets while I get the impression everything is done by at-commands
    and sockets is used in wifi / networks?
    You don't use Sockets on a micro-controller. You control the SIM900 by sending it AT commands; which, once you get a grasp of the concept, is quite simple. You'll need to do a bit of research to figure out what is required. Check out this web site: http://www.developershome.com/sms/atCommandsIntro.asp

    Quote Originally Posted by Brecht View Post
    does my gprs have its own ip-adres?
    Once you connect make a connection to the network the SIM900 will be given an IP address.

    Quote Originally Posted by Brecht View Post
    These examples use Sockets and are not applicable

    Quote Originally Posted by Brecht View Post
    also do I need to use udp or tcp?
    If you are sending to a Web Server then you would use TCP.



    •   AltAdvertisment

        
       

  5. #5
    Newbie level 5
    Points: 73, Level: 1

    Join Date
    Dec 2012
    Posts
    8
    Helped
    0 / 0
    Points
    73
    Level
    1

    Re: sim900 c code startcode to work with

    wow supergreat reply

    thank you!

    they confused me with these sockets, at-commands is pretty simple

    I used arduino prototype to start with.. it was just basically nothing but at-commands (link: http://www.seeedstudio.com/wiki/GPRS_Shield)

    I will use tcp

    thanks again.. supergreat help

    I will keep working on it

    - - - Updated - - -

    allow me to ask one more question:

    how is the receiving done?

    is this a loop that makes the microcontroller do an aerial search for a system that wants to connect with it (lets say every second),
    and the computer tries to make connection ( lets say for a duration of 5 seconds)

    is this how it gets done ? Is this kind of thinking correct?

    thanks for help..



  6. #6
    Banned
    Points: 7,016, Level: 19

    Join Date
    Apr 2009
    Location
    New Jersey, USA
    Posts
    671
    Helped
    170 / 170
    Points
    7,016
    Level
    19

    Re: sim900 c code startcode to work with

    I'm not exactly sure of what you are asking.

    Once the SIM900 is turned on (and it's been configured properly) it will start search for cell towers - often it will find several in the area. It will register itself with the one that is part of your service provider's network (i.e AT&T, T-Mobile, etc.) and that has the best connection. It will continue to monitor the connection without any intervention on your part and switch cell towers if necessary; for example if your device is moving.

    When you want to send data to your web server, you send AT commands to create a GPRS connection and then send your data - as outline in http://www.MadeEasyKits.com/FAQS.asp



  7. #7
    Newbie level 5
    Points: 73, Level: 1

    Join Date
    Dec 2012
    Posts
    8
    Helped
    0 / 0
    Points
    73
    Level
    1

    Re: sim900 c code startcode to work with

    Dear,

    sorry I might have been incomplete with my question

    I also wish to send data from the web server to the microcontroller/gprs-module

    Is this done similar as sending data to the web server?
    I was thinking this would be some kind of loop that uses one or more at-commands..

    thanks for the help..



    •   AltAdvertisment

        
       

  8. #8
    Banned
    Points: 7,016, Level: 19

    Join Date
    Apr 2009
    Location
    New Jersey, USA
    Posts
    671
    Helped
    170 / 170
    Points
    7,016
    Level
    19

    Re: sim900 c code startcode to work with

    Quote Originally Posted by Brecht View Post
    I also wish to send data from the web server to the microcontroller/gprs-module.
    Getting a web server to send a request to your SIM900 is a bit tricky and there are several obstacles you have to overcome to accomplish that:
    • The SIM900 must be put into Server mode - this can be really tricky if you want to simultaneously support client mode
    • Since the SIM900 will get it's IP address from the network, and is therefore not known in advance, you must have a means to tell your clients what the SIM900's IP address is - your service provider may give you a fixed IP address, but in most cases it won't
    • Your service provider must allow incoming connections - for security purposes, most service providers block incoming requests
    Assuming you can meet those 3 points, you can configure the SIM900 to be a server by following the instruction in this document: http://www.svtehs.com/simcom/docs/SI...TCPIP_V100.pdf


    However, if you want to both send data to the server and get data from it there's another way...
    In a network-based conversation between 2 devices one is considered the client (the one that makes a request) and one is considered the server (the one that replies to the request). When you open a browser and go to a web site, your browser (computer) is the client and the web site is the server. When you make a request to the server you can give it parameters that tell it to do something. And the web server can return just about anything as a response to your request. It can return a web page, picture, XML data, or text that means something to your application - all depends on how your server is configured.

    Let's say you have a web site with a web page named "StoreData.php", and the purpose of the web page is to store data you send it in a database. To make the example simple lets send the data in a "GET" request. A request to this page may be something like "74.125.228.35/StoreData.php?Data=this_is_my_data". Once you've established a GPRS connection you could make this request by sending the following:
    Code:
    AT+CIPSTART='TCP','74.125.228.35','80' \n                       // Will return 'CONNECT OK' to indicate it's connected to the server
    AT+CIPSEND\n                                                    // Issue Send Command (wait for module to return '>' to indicate it's ready to receive data
    
    GET /StoreData.php?Data=this_is_my_data HTTP/1.1\n             // Send request 
    Host: 74.125.228.35\n
    Accept: */*\n
    Accept-Language: en-us\n
    \n
    Ctrl-Z
    Anything the server returns as a response will be sent out the SIM900's serial port after you send the Ctrl-z. For example, in this case it could return a status message or the ID of the data it just stored.


    To get the data from the server you could have another page "GetData.php" that returns data to the SIM900. A request to this page may be something like "74.125.228.35/GetData.php?ID=1". The following commands would accomplish that:
    Code:
    AT+CIPSTART='TCP','74.125.228.35','80' \n                       // Will return 'CONNECT OK' to indicate it's connected to the server
    AT+CIPSEND\n                                                    // Issue Send Command (wait for module to return '>' to indicate it's ready to receive data
    
    GET /GetData.php?ID=1 HTTP/1.1\n                     // Send request 
    Host: 74.125.228.35\n
    Accept: */*\n
    Accept-Language: en-us\n
    \n
    Ctrl-Z
    The server will return the data you requested - the SIM900 will send it out the serial port after you send the Ctrl-Z.



  9. #9
    Newbie level 5
    Points: 73, Level: 1

    Join Date
    Dec 2012
    Posts
    8
    Helped
    0 / 0
    Points
    73
    Level
    1

    Re: sim900 c code startcode to work with

    ok thx! :)

    very helpful again..



  10. #10
    Newbie level 5
    Points: 73, Level: 1

    Join Date
    Dec 2012
    Posts
    8
    Helped
    0 / 0
    Points
    73
    Level
    1

    Re: sim900 c code startcode to work with

    Dear GSM Man,

    currently I use pachube/cosm to send data to,
    Is there a site (free or pay) that I can use to test the receiving part?

    sincere



--[[ ]]--