Pages: [1]   Go Down
Author Topic: dual serial communication problem (GSM + GPS)  (Read 1543 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am kind of new to using the forums here and am a bit new to the Arduino (arduino mega 1280).

The problem that i am having is connecting 2 devices serially to the Arduino via serial2 and serial3 and using real-time update of GPS and SMS (via GSM). I am not exactly sure how to achieve a real-time update of both unless i should use interrupts or run each serial port X number of milliseconds then check next port for changes.

Any advice would be greatly appreciated.

Thanks,
Friendlyghost89
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Any reason you can't just add two Serial.reads to the main loop?

Code:
loop () {

  if (Serial2.available() > 0 {
     // do GPS stuff
  }

  if (Serial3.available() > 0 {
     // do SMS stuff
  }
}

If you are expecting long streams of data that needs to be parsed this simple approach may not be good.

What is the nature of the data and amount of processing that needs to be done on it?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the quick reply.

Basically what is happening is that when the GSM module receives a SMS message it will contain set information (GPS location, start, stop, resume,etc) and the GPS will be used to determine the location of the unit itself and which direction/how far the unit has to go to reach the destination. so the GSM part will only be when a SMS is received, but the GPS needs to be mainly real time probably at least every 2 seconds just to be sure.

Thanks,
Erik
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Then if the message lenghts aren't too long you can wait in a loop for the SMS, parse that then get info from the GPS and do whatever.

That's the easy way but IMO not the best way.

Probably better is something like this

Code:
loop () {

  if (Serial2.available() > 0 {
     add character to SMS buffer
     if end of packet
        do stuff based on current GPS value already stored in variables
  }

  if (Serial3.available() > 0 {
     add character to GPS buffer
     if end of packet
        calc current location and place in variables
  }
}

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thankyou for the reply again.

I'll go ahead and try that when everything comes in. Just have to wait on the lovely shipping companies..... lol
I hope this all works when it comes in, i'll post back if anything else comes up and keep it updated as I get parts together and working.

Thanks,
Friendlyghost89
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What service/plan is your unit going to use, if you don't mind me asking?
i ask because I recently asked a GSM related question in project guidance
http://arduino.cc/forum/index.php/topic,51823.0.html
« Last Edit: February 11, 2011, 10:55:51 am by SirPoonga » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SirPoonga

I have an AT&T account currently so for testing i will be using that but the end result will probably be a T-Mobile pre-pay for about $15-20 a month.

The GSM shield that i am ordering is found at sparkfun: http://www.sparkfun.com/products/9607

you will also need at least a small antenna so just choose whichever meets your projects requirements.






Erik
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the info.  I see two routes to take.  Cellular is one, the other is APRS and ham radio.
http://trackuino.blogspot.com/

It isn't hard to get a ham radio license.  And it is a standard data format.  There are several sites you can use to track that data onto google maps.
http://aprs.fi/?call=a%2FN0KFB&mt=roadmap&z=14&timerange=21600
« Last Edit: February 11, 2011, 04:54:37 pm by SirPoonga » Logged

Pages: [1]   Go Up
Jump to: