Loading ...
Sorry, an error occurred while loading the content.

RE: [irlp-embedded] Reading a GPS from the serial port of IRLP node computer

Expand Messages
  • Rick Bates
    It s doubtful that you ll get a script writer (I m not one) to respond over the next few days, but something along the lines of EXPORT the Lat and Long in the
    Message 1 of 3 , Dec 24, 2011
    • 0 Attachment

      It’s doubtful that you’ll get a script writer (I’m not one) to respond over the next few days, but something along the lines of EXPORT the Lat and Long in the script below, then rewrite Randy’s script to draw these values in instead of the fixed values.  Both would have to be run as a cron job, at least while in motion, but you don’t have to write to the screen each time unless you prefer it that way (comment out the last half).  You may wish to adjust the timing of the broadcast.

       

      A better script would test against the last position to stop lengthen the time between broadcasts after you‘ve stopped moving.  There is no reason to keep sending “I haven’t moved” every 3 minutes for 5 days.  A superior script would emulate ‘SmartBeacon’, which is the most polite (currently) method of beaconing.

       

      3G shouldn’t be an issue, data is data.

       

      Merry Christmas,

      Rick WA6NHC

       


      From: craiginhouston

      How do you get your embedded mobile IRLP node to report its real-time position to the APRS servers over the 3G?

      I was successful today hooking a Germin 18 serial GPS device to the serial port on my regular IRLP node (haven't yet verified that it also works on an embedded node). The script below reads the GGA NMEA sentance at 4800 baud from the GPS unit and displays the data on the console screen. Now all I have to do is merge this script with kc6hur's IRLP APRS status reporting script and I'll be in business!

      http://irlp.kc6hur.net/irlp_scripts.php
      http://www.gpsinformation.org/dale/nmea.htm#GGA

      Craig
      K1BDX
      Houston Texas

      ---------- script begins here -----------------

      #!/bin/bash

      # This script reads NMEA sentances from a GPS device on the serial port and
      # filters out all but the sentence "GPGGA" and the 3rd, 5th, 8th and 9th
      # fields which correspond to Lat, Lon, number of satellites, and altitude

      # set serial port to 4800 baud rate
      stty -F/dev/ttyS0 4800

      # begin infinate loop to read the data and display to the screen

      while true; do

      GPGGAstring="`head -n26 /dev/ttyS0 | grep GPGGA`"

      GPStimeStamp="`echo $GPGGAstring | cut -d"," -f2`"
      Latitude="`echo $GPGGAstring | cut -d"," -f3`"
      Longitude="`echo $GPGGAstring | cut -d"," -f5`"
      NumberOfSatellites="`echo $GPGGAstring | cut -d"," -f8`"
      Altitude="`echo $GPGGAstring | cut -d"," -f9`"

      date
      echo "Latitude = " $Latitude
      echo "Longitude = " $Longitude
      echo "Altitude = " $Altitude
      echo "Satellites = " $NumberOfSatellites
      echo $GPGGAstring
      echo
      echo

      done

    • craiginhouston
      The script below was successful at reporting GPS position to the APRS servers on the internet Craig K1BDX Houston Texas ... #!/bin/bash # This script reads
      Message 2 of 3 , Dec 25, 2011
      • 0 Attachment
        The script below was successful at reporting GPS position to the APRS servers on the internet

        Craig
        K1BDX
        Houston Texas

        ---------- script begins here -----------------


        #!/bin/bash

        # This script reads NMEA sentances from a GPS device on the serial port and
        # filters out all but the sentence "GPGGA" and the 3rd, 5th, 8th and 9th
        # fields which correspond to Lat, Lon, number of satellites, and altitude

        # you must put in your own callsign and APRS server password below!
        # see http://irlp.kc6hur.net/irlp_scripts.php for more details

        APRS_CALL=xxxxx
        APRS_PASS=yyyyy

        # set serial port to 4800 baud rate
        stty -F/dev/ttyS0 4800

        count=0

        # begin infinite loop to read the data

        while true; do

        count=$(( $count + 1 ))

        #Read GPS data strings from serial port and throw away lines that don't begin with GPGGA
        GPGGAstring="`head -n26 /dev/ttyS0 | grep GPGGA`"

        # Pick out individual numbers for Time, Lat, Long, Satellites, and Altitude
        GPStimeStamp="`echo $GPGGAstring | cut -d"," -f2`"
        Latitude="`echo $GPGGAstring | cut -d"," -f3`"
        Longitude="`echo $GPGGAstring | cut -d"," -f5`"
        NumberOfSatellites="`echo $GPGGAstring | cut -d"," -f8`"
        Altitude="`echo $GPGGAstring | cut -d"," -f9`"

        # Trim Lat and Long to a charactor size that is compatible with APRS servers
        Latitude=$(expr substr "${Latitude}" 1 7)
        Longitude=$(expr substr "${Longitude}" 1 8)

        # Add the N and W to the end of the numbers
        Latitude=`echo $Latitude"N"`
        Longitude=`echo $Longitude"W"`

        # Print data to screen
        date
        echo "Latitude = " $Latitude
        echo "Longitude = " $Longitude
        echo "Altitude = " $Altitude
        echo "Satellites = " $NumberOfSatellites
        echo $GPGGAstring
        echo
        echo

        # only report to internet servers every 5 minutes (300 seconds)

        if [ $count -gt 300 ] ; then

        ###### APRS internet reporting script #######

        echo
        echo "REPORT POSITION TO APRS SERVERS ON THE INTERNET!"
        echo

        OBJ_NAME="IRLPmobil" # MUST be 9 characters long
        SYMBOL="k"
        NODE_STATUS_CHAR="/" # / = primary symbol table \ = alternate symbol table
        COMMENT="This is my IRLP linux APRS reporting script" # charactors 46-80
        LAT=$Latitude
        LONG=$Longitude
        TIMESTAMP=`date -u +%d%H%M`z # Format = DDHHMMz
        OBJECT=";${OBJ_NAME}*${TIMESTAMP}${LAT}${NODE_STATUS_CHAR}${LONG}${SYMBOL}${COMMENT}"
        BTEXT="$APRS_CALL>APVR30:${OBJECT}"
        LOGIN="User $APRS_CALL pass $APRS_PASS vers IRLP-interface 1"
        NC=/usr/bin/nc
        echo -e "${LOGIN}\n${BTEXT}" | $NC -w 10 rotate.aprs2.net 14580 # &>/dev/null

        count=0

        fi

        done
      Your message has been successfully submitted and would be delivered to recipients shortly.