For a drone project (drone using arduino) we wanted to add a GPS module, the dual BN-220
However, first we tried to test the GPS using only the arduino and serial output, but the GPS doesnt seem to get fixed (so it doesnt connect to a satellite). We think that this is the problem since we used like 4 different sets of code, and it also doesnt flash the red 'fixed' led. We have 2 pieces, and we tried all options on both.
We already tried outside of the house, soon we'll try some other places in town as well, but we just dont get any data. We also tried using an external power supply (5v) (using a PD board from another drone)
The code we are using:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
float lat = 28.5458,lon = 77.1703; // create variable for latitude and longitude object
SoftwareSerial gpsSerial(3,4);//rx,tx
TinyGPS gps; // create gps object
void setup(){
Serial.begin(9600); // connect serial
Serial.println("The GPS Received Signal:");
gpsSerial.begin(9600); // connect gps sensor
}
void loop(){
while(gpsSerial.available()){ // check for gps data
if(gps.encode(gpsSerial.read()))// encode gps data
{
gps.f_get_position(&lat,&lon); // get latitude and longitude
Serial.print("Position: ");
Serial.print("Latitude:");
Serial.print(lat,6);
Serial.print(";");
Serial.print("Longitude:");
Serial.println(lon,6);
Serial.print(lat);
Serial.print(" ");
}
}
We made sure the pins were well-placed (we even swapped them to make sure)
In our output it only spams the variable we set (i.e. 28.5458;77.1703), and we dont live in India
So yeaa, we are kind of desperate atm, since we dont have any clue.
We use the Arduino Uno R3, and we have installed tinygps/tinygps+ , software serial , adafruit gps library (for the other code). We tried the examples of them as well...
So does anyone have any idea what might be going on and also a solution for this?
Please give a call when you need more information,
yeah, but not thoroughly, because it didnt even flicker the 'fixing leds', so it wasnt searching.. It just gave the example coords over and over and over again.
Now though, the red led flickers, so it is searching! Still no result yet, but I'll just wait a while, while the GPS is on my balcony searching for a connection. I think the view of the sky from there should be big enough to fix, at least I hope so.
I think the problem, if it works, was that I had 2 versions (libraries) of SoftwareSerial. Apparently SS was already built into the latest software build.
Go outside, where you have a clear view of the entire sky (no trees, etc.) and wait at least 20 minutes.
Make sure that the ceramic patch antenna (the side with the brown/silver square) is pointing up.
I am using an Ultimate GPS, I can hook power up to the Ultimate, take it outside, wait, and get a connection without an Arduino. Have you tried that with your gps unit? If your gps unit, all by itself, does not do its thing, it may be broken. I'd give the gps as much as an hour to do its thing.
I added the battery to my gps unit, which speeds up the first fix time. I also, can supply just the gps unit with power and have the Adruino off.
The code you posted is missing a "}", I figure it was an oversight.
jremington:
Go outside, where you have a clear view of the entire sky (no trees, etc.) and wait at least 20 minutes.
Make sure that the ceramic patch antenna (the side with the brown/silver square) is pointing up.
Idahowalker:
I am using an Ultimate GPS, I can hook power up to the Ultimate, take it outside, wait, and get a connection without an Arduino. Have you tried that with your gps unit? If your gps unit, all by itself, does not do its thing, it may be broken. I'd give the gps as much as an hour to do its thing.
I added the battery to my gps unit, which speeds up the first fix time. I also, can supply just the gps unit with power and have the Adruino off.
The code you posted is missing a "}", I figure it was an oversight.
srnet:
That GPS looks like it has a 'FIX' LED (PPS) which should change state when the GPS gets a fix (check the manual).
It should do this with only the power connected, it does not need to be connected to the Arduino.
Thanks for your answers, when i come home ill try it with only the GPS and a battery outside.
Yea about the LED, it works how it is supposed to work (afaik), only it is in a forever going state of "searching" (i.e. forever flashing the red LED). The LED should be "on" when it finds a fix