GPS/satellite modem help needed
tv
Posts: 5
I am new to the basic stamp world and need help on a quick learning curve. I have a BS2, Parallax GPS, DS1620 thermometer and a Iridium satellite modem. I need to get the GPRMC striing from the GPS, a temp reading and send it out via the satellite modem. I am trying to put together a program that will do the following:
Blink LED when powered up (done...yes this was easy)
Power up GPS - wait for GPRMC string, store in buffer, Power down GPS (sort of successful....but not quite there)
Get temp reading from DS1620, store in buffer
Power up modem, send AT command to accept data in buffer, load BS2 buffer data (GPS string and temp) into modem buffer, send AT command to modem to send message, power down modem
Sleep BS2 for 1 hour, then repeat starting at "Power GPS"
It all sounds pretty simple and I have accomplished bits and pieces of everything but my skills are still very basic. Anyone willing to help out? I can give more details when needed. Yes, I am in a time crunch on this.
Thanks,
Blink LED when powered up (done...yes this was easy)
Power up GPS - wait for GPRMC string, store in buffer, Power down GPS (sort of successful....but not quite there)
Get temp reading from DS1620, store in buffer
Power up modem, send AT command to accept data in buffer, load BS2 buffer data (GPS string and temp) into modem buffer, send AT command to modem to send message, power down modem
Sleep BS2 for 1 hour, then repeat starting at "Power GPS"
It all sounds pretty simple and I have accomplished bits and pieces of everything but my skills are still very basic. Anyone willing to help out? I can give more details when needed. Yes, I am in a time crunch on this.
Thanks,
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
thanks for any input. I will be happy to share modem command sets anytime.
' File.....TrekPak v1.0
' Purpose..Program development for TrekPak communication with Iridium modem.
' Date.....20070111
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
'=====================================================================================
DEBUG "setting up pin assignments",CR
'pin 15 is used for LED
'pin 14 is used for GPS
TX1 CON 13 ' Q9612 "Tx" pin
RX1 CON 12 ' Q9612 "Rx" pin
TX2 CON 7 ' PC "Tx" pin
Rx2 CON 6 ' PC "Rx" pin
'====================================================================================
'Blink power LED when power is applied
'====================================================================================
counter VAR BYTE
FOR counter = 1 TO 10
DEBUG ? counter
HIGH 15
PAUSE 200
LOW 15
PAUSE 200
NEXT
DEBUG "Light off", CR, CR
'====================================================================================
'Start of repeat LOOP FOR message timing
'====================================================================================
Again
'====================================================================================
'Power up GPS, get message string and store in buffer, power down GPS
'====================================================================================
'Power up GPS - not sure how to set this up on board yet
serStr2 VAR BYTE (10) 'make 10 byte array
SERIN 8, 16572, [noparse][[/noparse]WAIT ("GPRMC,"),STR serStr2\26]
DEBUG CLS
DEBUG STR serStr2
'Power down GPS here
'====================================================================================
'Get temp reading and store in buffer
'====================================================================================
'====================================================================================
'Wake up modem, tranfer buffer, send message and listen for modem message reply, power down modem
'====================================================================================
tx VAR BYTE
FOR tx = 1 TO 25
DEBUG ? tx
'Power up modem
PAUSE 3000 ' allow Q9612 modem to power up
'DEBUG "clearing MO & MT Buffers",CR
'SEROUT TX1, 16416,[noparse][[/noparse]"AT+SBDD2",CR] ' clear Q9612's MO and MT buffer
'PAUSE 3000
DEBUG "clearing Q9612 Buffers",CR
SEROUT TX2, 16416,[noparse][[/noparse]"AT+SBDD2",CR] ' clear Q9612's MO and MT buffer
PAUSE 3000
'DEBUG "writing text message to PC",CR
'SEROUT TX1, 16416,[noparse][[/noparse]"AT+SBDWT",CR] ' write a text message to Q9612 message buffer
'PAUSE 3000
'SERIN RX1, 16416,[noparse][[/noparse]WAIT ("READY")]
'SEROUT TX1, 16416,[noparse][[/noparse]"Hello",CR]
'PAUSE 3000
DEBUG "writing text message to Q9612 message buffer",CR
SEROUT TX2, 16416,[noparse][[/noparse]"AT+SBDWT=jan15basic1",CR] ' write a text message to Q9612 message buffer
PAUSE 3000
'SERIN RX2, 16416,[noparse][[/noparse]WAIT ("READY")]
'SEROUT TX2, 16416,[noparse][[/noparse]"january15test2",CR]
'PAUSE 3000
DEBUG "initiating an SBD session",CR,CR,CR
SEROUT TX2, 16416, [noparse][[/noparse]"AT+SBDI", CR] ' initiate an SBD session
'SERIN RX1, 16416, 2500, Error, [noparse][[/noparse]WAIT ("OK")]
SLEEP 900
'Power down modem
'====================================================================================
'Power GPS and modem down and sleep Basic Stamp for 30 min then repeat from Wake GPS on
'====================================================================================
SLEEP 1800 'Message interval is set here - 30 minutes
GOTO Again
First off, the BS2 has 26 bytes of variable space----period. You'll never be able to read a string longer than 26 bytes long.
Early on in your code, you used 1 of them for "counter" that leaves 25
then, you set your input array to 10 bytes and tried to read 26 bytes into it, not possible. That's why you only got back a partial reading with DEBUG
You'll have better luck first deciding which information you need from a string and extracting just those pieces using formating modifiers.
very good examples can be found in Jon Williams' Nuts and Volts articles.
just google "jon Williams gps" and they'll all pop up - A couple bonus one from other authors, too.
If you really want to massage gps stuff or input long strings, get a BS2p or other stamp that allows direct input to scratch pad ram.
You'll be able to read in the whole string at once and massage it at your leisure. otherwise you'll need to extract different parts of the string over two or three reading.
here's a line of code that shows how to extract data from a GPS sentence:
SERIN gps_in, 16572,2000,nodata_GPRMC, [noparse][[/noparse]WAIT("GPRMC,"),WAIT(","),STR C_status\1,WAIT(","),WAIT(","),WAIT(","),WAIT(","), WAIT(","),DEC New_heading,WAIT(","),DEC deviation]
it extracts only the message status (whether the signal was valid- 1 byte), the travel heading- (degrees Decimal 1 word), and the compass deviation (degrees Decimal 1 word).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Tim
Be sure the transistor you use can handle the current draw of the GPS Module. The 2N3904 will not, as an example. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Tim