Pages: [1]   Go Down
Author Topic: GPS won't work with Serial.begin  (Read 382 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46255
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23837
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try "software serial" for receiving  the GPS data.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16548
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

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

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.
Logged

Espoo, Finland
Offline Offline
God Member
*****
Karma: 6
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Cheers,
Kari
Logged


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

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46255
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: