Hi, just having fun and learning !~~!

Has anyone been successful connecting a arduino MEGA to a MediaTek MT3329 GPS?

OR  can some wizard type figure the code and connection that works?

I'll be happy to test it for you :)

both sold on diydrones see links

https://store.diydrones.com/product_p/br-dev-09152.htm

https://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_...

Thanks,

Rick

Views: 823

Reply to This

Replies to This Discussion

You could use the GPS library and try something along the lines of this here (cut&paste from various sources):

#include <FastSerial.h>
#include <AP_Common.h>
#include <AP_GPS.h>

#define GPS_SERIAL_BAUD 38400
#define GPSP Serial1

FastSerialPort0(Serial);
FastSerialPort1(Serial1); // GPS

static GPS *g_gps;
AP_GPS_MTK16 g_gps_driver(&Serial1);

int numSats=0;
int gpsfix=0;

void setup()
{
GPSP.begin(GPS_SERIAL_BAUD);
delay(500);
g_gps = &g_gps_driver;
g_gps->init(); // GPS Initialization
}

void loop()
{
update_GPS();
delay(500);
}

static void update_GPS(void) {
g_gps->update();
numSats = g_gps->num_sats;
gpsfix = g_gps->status();

if (g_gps->new_data && g_gps->fix) {
gps_fix_count++;

longitude = g_gps->longitude; // Lon * 10**7
latitude = g_gps->latitude; // Lat * 10**7
altitude = g_gps->altitude/100;
}

g_gps->new_data = 0;
}

forgot to declare gps_fix_count but anyway... should get you started into the right direction.

Thanks Andre,

Do you have this board and gps and if so does this work for you?

Thanks again,

Rick

Hi Rick,

Yes, I do. Please note that the Arduino Mega is a fairly "standard" board, meaning it extends much further that this DIY drones community. If you wonder about programming Arduinos, there are good tutorials out there.

I actually assumed you had some code you were running on the arduino already so you wanted to add GPS functionality.

In any case.. if you declare the missing variables it should compile just fine. I have this code and some other stuff used to debug my MTK.

A one important thing: this example assumed you are running version 1.6 of the GPS firmware. If not you need to use the other header file. Just look into the library folders.

Good luck, Andre

Hi,

I don't know what AZ is but anyway. Nothing wrong with doing this for fun. :) I just meant that this autopilot stuff is not the best place to learn arduino programming. This is at least the lesson I learned myself and I'm pretty new to this as well.

About your questions: in my example the GPS is connected to Serial1 which is the second serial port. If you want output you could write to the first port, which is the one the USB is connected to via Serial.print(latitude) or something. But it really depends on what you are actually planning to do with the GPS.

Cheers, Andre

That code won't print anything in the monitor...because it never prints to the monitor. It opens a connection to the GPS, sets it up for binary mode, reads the data in and keeps a copy of the GPS data fresh in a structure for later use.

You need to print the data in the GPS structure from time to time.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service