Shop OBEX P1 Docs P2 Docs Learn Events
Javelin and gprs — Parallax Forums

Javelin and gprs

ChristianGChristianG Posts: 29
edited 2004-09-04 06:10 in General Discussion
I need to send my sensordata to a webserver, using pgrs.
I can se that using UART, it possible to communicate with a modem, and f.example send AT-commands.
Gprs is cheapest, when sending an huge amount of bytes.
I can·put my modem in gprs-mode using AT-comands, but is it possible to·open a connection (an url) to send some data to·a web-server?
In advance, thanks,

ChristianG


·

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2004-08-04 07:01
    I found this info:
    http://en.wikipedia.org/wiki/GPRS
    which says it is packet radio related.
    There is a RF·network packet server·class here
    http://www.parallax.com/javelin/underdev.asp
    but I doubt it is useful for gprs.

    This may be more helpful
    http://turtiainen.dna.fi/GPRS-HOWTO
    which is a linux howto document.
    It shows how to setup a connection using AT commands.

    regards peter


    Post Edited (Peter Verkaik) : 8/4/2004 7:07:24 AM GMT
  • ChristianGChristianG Posts: 29
    edited 2004-08-04 20:29
    Thank you Petter,

    Setting ut gprs with at-commands is ok, it can be done by sending "AT^SJNET=GPRS,internet,dj,dj\r";
    After GPRS mode is turn on, it's not possible to send further at-commands.
    Sending data to a web server can be done by opening an URL witch contains one or several arguments for data, for example: http://www.mywebserver?createDocument&arg1=value1&arg2=value2
    I need an API for opening an URL. Using java microedition for mobile phones, you could write it this way:

    public static void sendgprsdata(String message)
    {
    System.out.println("Inside sendgprsdata");

    //String url = "http://www.mywebserver?createDocument&arg1=value1&arg2=value2";
    String url = message;

    StreamConnection c = null;
    InputStream s = null;
    try {
    c = (StreamConnection)Connector.open(url);
    s = c.openInputStream();
    int ch;
    wile ((ch = s.read()) != -1) {
    System.out.print( (char)ch );
    }
    if (s != null)
    s.close();
    if (c != null)
    c.close();
    }
    catch (IOException e) {
    System.out.println( "Exception during HTTP send/receive: " + e);
    e.printStackTrace();
    }
    System.out.println("Exiting out of sendgprsdata. ");
    }
    }

    Those classes (StreamConnection, InputStream) are not provided with the java-API for Javelin. I'm wondering if there is another way of sending/receiving gprs data.

    Regars, Christian
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2004-08-04 21:10
    Those classes are not available, but since you
    communicate using your mobile phone (via serial port??),
    you should/could replace them with uarts.

    As I understand your code, c would be the
    transmit uart, and s would be the receive uart.
    Especially for the transmit uart, you would need to know
    what codes to transmit to your particular phone to open
    url's.

    Also there is no printStackTrace() but a simple error print
    would do.

    Go here and read the part about serial cable:
    ·http://www.polycon.fi/~laa/biblo/linux_gprs.html
    It shows a log with used commands.

    regards peter


    Post Edited (Peter Verkaik) : 8/4/2004 9:52:09 PM GMT
  • ChristianGChristianG Posts: 29
    edited 2004-08-05 21:00
    Thank you Peter,

    I will try.
    My plan is to use the TC45 GSM/GPRS modem from siemens, witch is java enabled, via serial port.

    If I can't do the gprs stuff directly from Javelin, I could always try to establish a connection with the TC45, and transfer data in some way (file or memory). Then I can make the running java application from the TC45 to pick up the data, and transfer it by gprs.

    Christian
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2004-08-05 22:05
    Yes, you could also try to run that java code you

    showed on the pc, monitoring and capturing the serial

    port data to and from your phone.

    That way you would know exactly what commands and replies,

    and in what order, they must be sent.

    Then simply copy these commands into javelin code.

    There is a program called serialsniffer that can capture

    serial port data

    http://www.flache.de/Download/Shareware/SerialSnifferE/

    but·there are other programs too:
    http://www.hhdsoftware.com/sermon.html


    regards peter


    Post Edited (Peter Verkaik) : 8/5/2004 10:11:26 PM GMT
  • ChristianGChristianG Posts: 29
    edited 2004-09-03 21:09
    Hi Peter,

    GPRS is working fine with Javelin, but not in the way you decribed over (serialsniffer). My problem was that my original java-code for gprs connection was running directly on a gprs-modem, not on the pc. Nothing was passed through the serial port...Using for example hyperterminal, you could communicate with the modem, dial, send sms, turn the modem in gprs-mode, but not send gprs-data. In other words, I did not find an easy way to use gprs through the serial cable, and capture commands.
    But I found another way: From the javelin, you can run AT-commands. The trick is to write a phone-book entry (containing my wind data) using the AT+CPBW command, and then start a java-middlet running on the modem (AT^SJRA command). I programmed this middlet to read the new phone book entry, decode the data, switch to gprs mode, transmit data through the gprs connection, and terminate. It's easy, and it works fine...

    Regards Christian

    Post Edited (ChristianG) : 9/3/2004 9:37:03 PM GMT
  • Dave SDave S Posts: 22
    edited 2004-09-03 21:48
    Hey, I am very interesting in·implementing a GRPRS modem into some of my projects, where· can I get one, and price?

    Also, do you have to activate them or something? I assume theres a monthly·fee to use one?

    Any tips· would be greatly appreciated.

    On another· note, what components· did you use to measure wind speed and· direction?· I just finished my temp monitor in conjunction with a VB· prog that runs listenin to the javelin's serial· data· logging temps to a database.

    Thanks!
  • ChristianGChristianG Posts: 29
    edited 2004-09-04 06:10
    Dave,

    I use the TC45 module from TDC/Siemens:
    http://www.tdc.co.uk/gprs/gprs_siemens.htm#tc45java
    To use gprs you need a sim-card (gprs enabled).

    My vind sensor (anenometre and direction) is a Davis 7911.
    http://www.davisnet.com/weather/products/weather_product.asp?pnum=7911

    Christian
Sign In or Register to comment.