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





Views: 826

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

FastSerialPort1(Serial1); // GPS

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

int numSats=0;
int gpsfix=0;

void setup()
g_gps = &g_gps_driver;
g_gps->init(); // GPS Initialization

void loop()

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

if (g_gps->new_data && g_gps->fix) {

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,


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


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


© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service