mike_117:
the last instruction means like the proccess gonna start only when i have information who can be proceseced by the arduino, that means ‘the gps have signal’
Nope. That just tells you if it completed decoding one “sentence”. GPS devices send different kinds of sentences, with different pieces of information. A “batch” of these different sentences is sent each second. So the sentence that was just received may or may not have status in it. You can still ask TinyGPS for the status, but it may not be the most recent status.
The NeoGPS library groups a batch of sentences into one complete “fix” structure. It always has the most recent status. You would check the status this way:
#include <NMEAGPS.h>
// Pick the port your GPS is connected to. Comment all the others out.
#define gps_port Serial1 // for a Mega
//AltSoftSerial gps_port; // pins 8 & 9 only on an UNO, need to get and include Library
//NeoSWSerial gps_port( 3,4 ); // any two pins, need to get and include Library
//SoftwareSerial gps_port(x,x); // NOT RECOMMENDED! Very inefficient, can interfere with sketch timing
NMEAGPS gps;
gps_fix fix;
void setup()
{
Serial.begin( 9600 );
Serial.print( F("Waiting for GPS fix...") );
gps_port.begin( 9600 );
}
void loop()
{
// Read and process available GPS characters
if (gps.available( gps_port )) {
// A complete batch of sentences were received. Get the latest fix structure.
fix = gps.read();
// Look at the "status" member of the fix structure (check the valid flag first)
if (fix.valid.status && (fix.status < gps_fix::STATUS_STD)) {
digitalWrite( GPS_LED, LOW ); // Bad GPS status
Serial.print( '.' );
} else {
digitalWrite( GPS_LED, HIGH ); // Good GPS status
// Other fields are available in the 'fix' structure. See the NeoGPS Data Model page.
// If the GPS device has a time, print the current seconds.
if (fix.valid.time) {
Serial.print( fix.dateTime.seconds );
Serial.print( ' ' );
}
// If the GPS device has a location, print it.
if (fix.valid.location) {
Serial.print( fix.latitude(), 6 );
Serial.print( ' ' );
Serial.print( fix.longitude(), 6 );
Serial.println();
}
}
}
}
When a new fix is available, the GPS device will be quiet for a little bit. That’s the best time to do other work, like sending an SMS message. The TinyGPS examples do not wait for this quiet time, so the GPS characters that keep coming can interfere with your sketch, especially if you try to use SoftwareSerial.
Sorry, I don’t know the AT command to get the signal strength. It’s probably there somewhere…
The 5mm LEDs can be driven from an Arduino pin, as long as you use a resistor, too. The anode is the + side (longer leg, to an Arduino digital output pin), the cathode is the - side (shorter leg, to the resistor), and the other side of the resistor goes to ground. The resistor should be between 220 and 470 ohms. More ohms if it’s too bright.
Cheers,
/dev