DIY flight recorder using any (NMEA) GPS - #1 Hardware

Mirumod, Macgyver, hull, cam, propeller, leg, cross, ball bearing mods... etc.
gtonini
Battery Charged
Posts: 6
Joined: 24 Jan 2015, 23:30
Drone Type: AR.Drone 2

Re: DIY flight recorder using any (NMEA) GPS - #1 Hardware

Post by gtonini » 05 Mar 2015, 16:39

I soldered everything as shown and uploaded the sketch. I have two lights on the cp102 module steady green and flashing yellow. On the ardunio module I have one solid red light. And on the gps module I have one solid red light. I used the modules that were recommended does my light configuration sound right. I ran the debug in sirf demo and I'm not picking up any satellites. Thanks Gary

johnek28
Newcomer
Posts: 1
Joined: 06 Aug 2015, 23:21
Drone Type: AR.Drone 2

Re: DIY flight recorder using any (NMEA) GPS - #1 Hardware

Post by johnek28 » 14 Aug 2015, 00:38

hi can anyone upload a sketch file that is pre configed for m6 gps unit please

Zamzara
Battery Charged
Posts: 5
Joined: 29 Jun 2018, 13:25
Drone Type: AR.Drone 2

Re: DIY flight recorder using any (NMEA) GPS - #1 Hardware

Post by Zamzara » 21 Jul 2018, 21:55

Great tutorial, I've used with some success so far.

To get the phone app to stop trying to update the GPS firmware, renamed the GPS .bin files in /firmware on the drone to .bak and it seems to have stopped trying. (Edit: this in itself proved not to solve the issue reliably, see below.)
Last edited by Zamzara on 26 Jul 2018, 16:39, edited 1 time in total.

Zamzara
Battery Charged
Posts: 5
Joined: 29 Jun 2018, 13:25
Drone Type: AR.Drone 2

Re: DIY flight recorder using any (NMEA) GPS - #1 Hardware

Post by Zamzara » 26 Jul 2018, 16:32

For automatic configuration of uBlox GPSs -

Anywhere outside the main functions add this:

Code: Select all

// set baud to 38400 and NMEA output only
unsigned char MSG_BAUD[] =  {0x01,0x00,0x00,0x00,0xD0,0x08,0x00,0x00,0x00,0x96,0x00,0x00,0x07,0x00,0x02,0x00,0x00,0x00,0x00,0x00};
// switch off NMEA messages 1,2,3, and 5 leaving RMC and GGA
unsigned char MSG_NMEA1[] = {0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x01};
unsigned char MSG_NMEA2[] = {0xF0,0x02,0x00,0x00,0x00,0x00,0x00,0x01};
unsigned char MSG_NMEA3[] = {0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x01};
unsigned char MSG_NMEA5[] = {0xF0,0x05,0x00,0x00,0x00,0x00,0x00,0x01};
// set 5 Hz rate
unsigned char MSG_RATE[] =  {0xC8,0x00,0x01,0x00,0x01,0x00};
// set prefix to GP instead of GN
unsigned char MSG_NMEA_TALKER[] =  {0x00,0x00,0x40,0x00,0x02,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 
 
 
void send_ublox(unsigned char m_id, unsigned char payload[], unsigned int len)
{
  unsigned char ck_a = 0;
  unsigned char ck_b = 0;
  unsigned char m_class = 0x06; // config message: class 6
  gpsSerial.write(0xB5); gpsSerial.write(0x62);                   // start sequence
  gpsSerial.write(m_class); ck_a = ck_a + m_class; ck_b=ck_b + ck_a;
  gpsSerial.write(m_id); ck_a = ck_a + m_id; ck_b=ck_b + ck_a;     // class + id of message
  gpsSerial.write(len & 0xFF); ck_a = ck_a + (len & 0xFF); ck_b=ck_b + ck_a;
  gpsSerial.write(len >> 8); ck_a = ck_a + (len >> 8); ck_b=ck_b + ck_a;         // length (little endian)
  for(int i = 0; i < len; i++)
  {
    gpsSerial.write(payload[i]); ck_a = ck_a + payload[i]; ck_b=ck_b + ck_a;  // payload
  }
  gpsSerial.write(ck_a & 0xFF); gpsSerial.write(ck_b & 0xFF);   // checksums a and b
}
And replace gpsInit() with:

Code: Select all

void gpsInit()
{
  // uBlox setup commands
  gpsSerial.begin(9600);
  delay(50);
  // Baud 38400 and NMEA only
  send_ublox(0, MSG_BAUD, 20);
  gpsSerial.flush();
 
  gpsSerial.begin(38400);
  delay(50); // small delay to let the serial port initialize;
  send_ublox(0x01, MSG_NMEA1, 8);
  delay(5);
  send_ublox(0x01, MSG_NMEA2, 8);
  delay(5);
  send_ublox(0x01, MSG_NMEA3, 8);
  delay(5);
  send_ublox(0x01, MSG_NMEA5, 8);
  delay(5);
  send_ublox(0x08, MSG_RATE, 6);
  delay(5);
  send_ublox(0x17, MSG_NMEA_TALKER, 20);
  gpsSerial.flush();
}
I have what was sold as an Neo-M8N but as it lacks the flash memory I believe it's a slightly different model. This code should work with all similar uBlox units. I'm not sure if the delays and flushes are strictly necessary or not.

Zamzara
Battery Charged
Posts: 5
Joined: 29 Jun 2018, 13:25
Drone Type: AR.Drone 2

Re: DIY flight recorder using any (NMEA) GPS - #1 Hardware

Post by Zamzara » 26 Jul 2018, 16:38

My second change was to try to further solve the issue of the Drone frequently rejecting or ignoring the device.

This does seem to be related to the software version string not being received. Pawelsky's code correctly implements the Sirf protocol for sending the string, but the Drone doesn;t seem very good at picking it up.

I tried sending it repeatedly without invitation and that seems to work much better. I added this at the end of the Arduino loop function immediately after send_sirf SIRF_MSG_29:-

Code: Select all

if (millis()<20000)
    {
    send_sirf(SIRF_MSG_06, NEL(SIRF_MSG_06));
    }
This blasts the string at the Drone for the first 20 seconds and seems to make detection much more reliable.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests