GPS Modules with Ar...
 
Notifications
Clear all

GPS Modules with Arduino and Raspberry Pi

78 Posts
19 Users
3 Reactions
8,485 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@will I have 10 of them, I will gladly mail you one of them if you want a free one. Just message me an address.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Will reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2548
 

@ronalex4203 

Thanks, but I ordered the 220 and 880 BeiTian modules from Amazon and they're supposed to be delivered tomorrow.

But I appreciate the offer, thanks.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@andre)
Member
Joined: 4 years ago
Posts: 2
 

Hi folks

Please could I have some advice regarding what people have found to be the best priced RTK GPS components to use with a Pixhawk flight controller. There is information on the Ardupilot website but the recommended GPS (UBlox GPS + Compass module) does not appear to be RTK compatible. I am leaning towards a GPS built on the Ublox M8P device but what I have found them to be quite expensive. I think the Sparkfun GPS-RTK Board - Neo-M8P-2 is one of the least expensive and I will need two of them. Any info or advice on this would be greatly appreciated.


   
ReplyQuote
(@fastrunner08)
Member
Joined: 3 years ago
Posts: 22
 

@dronebot-workshop I'm looking forward to any additional reading/videos on the RTK set up!   I have also been looking at the sparkfun version out there.  It seems you would need to buy two of their boards to make a complete set up?  

I'm hoping to make a "poor mans" guidance system for my tractor I use to spray my fields.  I have looked into buying an existing agricultural set up but they are 5k plus, and since we only farm about 100 acres, it isn't feasible for us to buy a of the shelf one, so cue up some engineering skills and a good micro controller!


   
Inst-Tech reacted
ReplyQuote
(@ezward)
Member
Joined: 4 years ago
Posts: 16
 

Loved the video.  I've been recently working on RTK GPS for a RaspberryPi rover without a base station using the Sparkfun F9P SMA board.  I ran into a couple of issues which eventually led to enabling a hardware UART on the 40 pin bus.  See here; https://github.com/tomojitakasu/RTKLIB/issues/659


   
ReplyQuote
(@witchdoc59)
Member
Joined: 2 years ago
Posts: 22
 

I went and bought a BN880 and I’m wondering if it’s possible to run both the magnetometer and the gps at the same time. I’ve got a working gps sketch and I can get a magnetometer sketch working but when I put the two together the magnetometer sketch takes over. I am running this on an Arduino Uno.  Seems odd to include both in a single device if you can only use one at a time.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@witchdoc59 My assumption is both will work. Is the sketch small enough to post here? If so, post each separately then post the combined sketch in a seperate post.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@witchdoc59)
Member
Joined: 2 years ago
Posts: 22
 
Here's my working GPS it displays the time, lat, long and altitude on a 4 line lcd
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>

#define RXPin 4
#define TXPin 3
#define GPSBaud 9600
#define ConsoleBaud 115200

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

// The TinyGPS++ object
TinyGPSPlus gps;

int dT(5000);
float lat;
char time[9];

LiquidCrystal_I2C lcd(0x27,20,4); //set the LCD address to 0x27 for a 20 chars and 4 line display

void setup()
{

Serial.begin(ConsoleBaud);

ss.begin(GPSBaud);

lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Time: ");
lcd.setCursor(0,1);
lcd.print("Lat:");
lcd.setCursor(0,2);
lcd.print("Long:");
lcd.setCursor(0,3);
lcd.print("Alt:");
}

void loop()
{

while (ss.available() > 0)

gps.encode(ss.read());

if (gps.location.isUpdated() || gps.altitude.isUpdated())

{

Serial.print("Course Heading: ");
Serial.println(gps.course.deg()); // Course in degrees (double)
Serial.print("Number of Satellites: ");
Serial.println(gps.satellites.value()); // Number of satellites in use (u32)
Serial.print("Location: ");
Serial.print(gps.location.lat(), 6);
Serial.print(",");
Serial.print(gps.location.lng(), 6);
Serial.print(" Altitude:");
Serial.println(gps.altitude.feet());

if (gps.time.isUpdated())
{

snprintf(time, 8, "%02d:%02d:%02d", gps.time.hour() , gps.time.minute(), gps.time.second());

Serial.print("Time: ");
Serial.println(time);

}

delay(dT);

lcd.setCursor(5,0);
lcd.print(time);
lcd.setCursor(4,1);
lcd.print(gps.location.lat());
lcd.setCursor(5,2);
lcd.print(gps.location.lng());
lcd.setCursor(4,3);
lcd.print(gps.altitude.feet());

}
}

   
ReplyQuote
(@witchdoc59)
Member
Joined: 2 years ago
Posts: 22
 
Here is the script with the magnetometer code added in.   I believe I used Bill's magnetometer code. 
Everything up to about line 112 works then nothing.
 
#include<Wire.h>
#include<LiquidCrystal_I2C.h>
#include<TinyGPSPlus.h>
#include<SoftwareSerial.h>
#include<Adafruit_Sensor.h>
#include<Adafruit_HMC5883_U.h>

#define RXPin 4
#define TXPin 3
#define GPSBaud 9600
#define ConsoleBaud 115200

intdT(5000);
chartime[9];
  /* Assign a unique ID to this sensor at the same time */
  Adafruit_HMC5883_Unified mag = Adafruit_HMC5883_Unified(12345);
 // The serial connection to the GPS device
SoftwareSerialss(RXPin, TXPin);
  TinyGPSPlus gps;

voiddisplaySensorDetails(void)
  {
sensor_t sensor;
mag.getSensor(&sensor);
Serial.println("------------------------------------");
Serial.print  ("Sensor:       "); Serial.println(sensor.name);
Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" uT");
Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" uT");
Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" uT");  
Serial.println("------------------------------------");
Serial.println("");
delay(5000);
  }

LiquidCrystal_I2Clcd(0x27,20,4); //set the LCD address to 0x27 for a 16 chars and 2 line display

voidsetup()
  {
Serial.begin(ConsoleBaud);

ss.begin(GPSBaud);
Serial.println("HMC5883 Magnetometer Test"); Serial.println("");
    /* Initialise the sensor */
if(!mag.begin())
    {
      /* There was a problem detecting the HMC5883 ... check your connections */
Serial.println("Ooops, no HMC5883 detected ... Check your wiring!");
while(1);
    }
      /* Display some basic information on this sensor */
displaySensorDetails();

lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Time: ");
lcd.setCursor(0,1);
lcd.print("Lat:");
lcd.setCursor(0,2);
lcd.print("Long:");
lcd.setCursor(0,3);
lcd.print("Alt:");
  }

voidloop()
  {
    /* Get a new sensor event */
sensors_event_t event;
mag.getEvent(&event);
        /* Display the results (magnetic vector values are in micro-Tesla (uT)) */
Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print("  ");
Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print("  ");
Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print("  ");Serial.println("uT");
      // Hold the module so that Z is pointing 'up' and you can measure the heading with x&y
      // Calculate heading when the magnetometer is level, then correct for signs of axis.
float heading = atan2(event.magnetic.y, event.magnetic.x);
      // Once you have your heading, you must then add your 'Declination Angle', which is the 'Error' of the magnetic field in your location.
      // Find yours here: http://www.magnetic-declination.com/
      // Mine is: -13* 2' W, which is ~13 Degrees, or (which we need) 0.22 radians
      // If you cannot find your Declination, comment out these two lines, your compass will be slightly off.
float declinationAngle = 0.28;
      heading += declinationAngle;
      // Correct for when signs are reversed.
if(heading < 0)
        heading += 2*PI;
      // Check for wrap due to addition of declination.
if(heading > 2*PI)
        heading -= 2*PI;
      // Convert radians to degrees for readability.
float headingDegrees = heading * 180/M_PI;
Serial.print("Heading (degrees): "); Serial.println(headingDegrees);
delay(dT);
      // If any characters have arrived from the GPS,
      // send them to the TinyGPS++ object

while (ss.available() > 0)

gps.encode(ss.read());

        // Let's display the new location and altitude

          // whenever either of them have been updated.

if (gps.location.isUpdated() || gps.altitude.isUpdated())
        {

Serial.print("Course Heading: ");
Serial.println(gps.course.deg()); // Course in degrees (double)
Serial.print("Number of Satellites: ");
Serial.println(gps.satellites.value()); // Number of satellites in use (u32)
Serial.print("Location: ");
Serial.print(gps.location.lat(), 6);
Serial.print(",");
Serial.print(gps.location.lng(), 6);
Serial.print(" Altitude:");
Serial.println(gps.altitude.feet());

if (gps.time.isUpdated())
          {
snprintf(time, 8, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
Serial.print("Time: ");
Serial.println(time);
          }

delay(dT);

lcd.setCursor(5,0);
lcd.print(time);
lcd.setCursor(4,1);
lcd.print(gps.location.lat());
lcd.setCursor(5,2);
lcd.print(gps.location.lng());
lcd.setCursor(4,3);
lcd.print(gps.altitude.feet());
        }
 }

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@witchdoc59 Please use the Help to learn how to post code

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@witchdoc59 I don't recognize that as script. Is it Z or bash? Also that is not what I asked for. Are these direct copies of Bill's sketches?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@witchdoc59 why do you have includes duplicated? How many years full time programming experience do you have? It's easier to answer questions when I know what I am dealing with.

Screenshot 2023 01 12 at 20.43.43

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@witchdoc59 If you are using Bill's code, just provide a link to the blog post with the code. Two links for both original sketches, then I will try to merge them and let you know if it can be done.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@witchdoc59)
Member
Joined: 2 years ago
Posts: 22
 

@zander Thankyou very much for your attention to this. I appreciate it very much.   The duplicate 'include' is a mistake that I thought I had fixed.  I got my degree in computer science back in the late 90s but since then I've mainly been doing end user support.   A bit of PowerShell scripting.  But resurrecting my C/C++ skills has been a challenge.  The working sketch is one that I developed on my own.  The second script, that isn't working properly, is the first sketch with some code borrowed from Bill's magnetometer sketch.  Here is the blog post that has the magnetometer sketch.  Using GPS Modules with Arduino & Raspberry Pi | DroneBot Workshop.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7287
 

@witchdoc59 Thank you very much for the clarification. If you could publish your code BEFORE inserting Bill's as a zip file it would help. I will then use the link to Bill's code to merge it in and return it to you as a zip. NOTE: It will compile error free or error noted but I don't have the required hardware to test the execution.

I remain concerned by your earlier comment about a failure 'up to about line 112' In my 64 years of experience, I don't recall ever seeing code fail 'about' a line, it is at a line. I like that you mentioned the line #, but you didn't include the line # so impossible for us to understand what is happening.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Page 5 / 6