Go Down

Topic: GPS won't work with Serial.begin (Read 506 times) previous topic - next topic

talev

I am trying to connect the arduino to a GPS.
When running an empty sketch ("Bare minimum") - I can see in the monitor that I get data from the GPS.
But when I add Serial.begin(4800) in the setup function - it stops working.
I tried other values too. Nothing.

The tinyGPS sample program does not work for me either.

Answers, suggestions or tips would be great.

PaulS

Quote
When running an empty sketch ("Bare minimum") - I can see in the monitor that I get data from the GPS.

How? The only information that gets sent to the Serial Monitor comes from the Arduino, and only if the sketch, or some library, calls Serial.begin().

How is the GPS connected to the Arduino? Using pins 0 and 1, I'll bet, in which case you should not also be trying to use (or even open) the Serial Monitor.

talev

Quote
How? The only information that gets sent to the Serial Monitor comes from the Arduino, and only if the sketch, or some library, calls Serial.begin().

The GPS sends the data to the arduino's serial, which is connected to the PC using the USB cable.
And yes, it was connected to pins 0 and 1.

I am trying to figure out how to connect it to any other pin but nothing works. The only configuration that works is pins 0 and 1, and without the Serial.begin().

Ideas?

CrossRoads

Try "software serial" for receiving  the GPS data.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty

If you wire your GPS to pins 0 and 1, you are effectively overloading the single comm path to the PC via the USB serial converter chip. You can allow either your sketch via Serial commands to use pins 0 and 1, or an external serial device like your GPS, however both can't be used at the same time, it's an electrical conflict thingee. As suggested either use a software serial library for your GPS or get a mega board so your sketch can read the GPS on a different serial port pins and then your sketch can deal with the data and send off anything you wish to the PC via the normal serial commands.

That make sense?


talev

I tried.
I tried using the tinyGPS example, but I get nothing.
As a metter of fact - the only change I see when running the tinyGPS example is this:
If I play with the connection between the GPS's Tx and the arduino (taking it in and out) - I raise the character count by a few...
But no real info, and not when I keep it connected.

There might be ways to go around it, but I thought connecting a GPS is an everyday experience. I can't seem to find record of people expiriencing the problem I am having.

GaryP

You have tried software serial as recommended? I didn't quite get that from your post.


Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

PaulS

Quote
I raise the character count by a few...

You raise what character count? You know this how?

Is there some part of "You can't use the Serial Monitor and the GPS on the serial pins at the same time" that you don't understand? If so, we'll try to make it clearer.

YOU CAN"T DO THAT!

Go Up