GPS integration

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

GPS integration

Post by Alexinparis »

I've just uploaded a new dev version to prepare the integration of GPS feature.

Currently, you must use a mega board for this, and choose a free serial port.
Addind a GPS to a promini board should be possible with some soft Serial tweaking or sharing the Serial 0 with PC/Arduino, but the dev will be focused at first on the mega boards only.
The first functionality in the pipe is "Return To Home". ("Position Hold" or other things are planed after)

current status:
- a new define is added in the config.h file

Code: Select all

/* GPS
   only available on MEGA boards (this might be possible on 328 based boards in the future)
   if enabled, define here the Arduino Serial port number and the UART speed
   note: only the RX PIN is used, the GPS is not configured by multiwii
   the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices)
*/
#define GPS
#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2
#define GPS_BAUD   4800

- a new GPS.pde file is added to the project
- only NMEA GGA frames are recognized
- once the first fix is obtained, it becomes the home ref.
- for every following new coordinates, a distance to home and direction to home is calculated. An approximation is used to save computation time. This may differ from some OSD, but the accuracy should still be very good.
- the direction to home is indicated in the N/S/E/W referential.
- the magnetometer indicates now the direction of the multi nose.

Still to do:
- with the knowledge of
[*] - direction to home
[*] - compass heading
[*] - distance to home
, determine the action to do on the motors.

The real coordinates are not shown in the GUI.
The GPS altitude is not used.

compass heading (white arrow)
and home direction (grey arrow)
Image

this does currently nothing, but the GPS RTH activation via checkbox is ready in the GUI
Image

detection of the device: if the #define has been checked or not
activation of GPS RTH, does nothing for the moment
Image

2 info here:
the distance to the home in meters
the number of satellites:
- if red, the fix is not ok
- if green, the fix is ok
Image
Attachments
gui.JPG
sensor_detection.JPG
(3.9 KiB) Not downloaded yet
dist_home_num_sat.JPG
(1.75 KiB) Not downloaded yet
checkbox.JPG
(7.47 KiB) Not downloaded yet
boussole.JPG
(2.07 KiB) Not downloaded yet

Kayle
Posts: 141
Joined: Sun Feb 13, 2011 6:45 pm

Re: GPS integration

Post by Kayle »

Hi Alex,

this is madness. I hope the implementation for Arduino Pro mini will be coming soon.

Thanks Alex. Keep Going.

Greetings
Kayle

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: GPS integration

Post by copterrichie »

Great Job Alex!!!

Kudos.

User avatar
Loosi
Posts: 63
Joined: Sat Aug 20, 2011 8:31 pm
Location: Germany (HSK)
Contact:

Re: GPS integration

Post by Loosi »

Hey!
Very gread job Alex! Cant wait to come back from vacation on Saturday ;)
What refresh-rate should the GPS-Receiver have? I ordered the MediaTek MT3329 GPS 10Hz + Adapter Basic from Lipoly last week. Still waiting for my FlyduinoMega board.

Greetings from Schillig @ the NorthSea ;)

Daniel

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: GPS integration

Post by PatrikE »

Super....
Iv'e been playing around with positionhold during the week.
Using Tinygps.
This Will be a great help.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

I use the GPS device included in this kit:
http://www.hobbyking.com/hobbyking/stor ... duct=17141

It's convenient to make developments: it is 5V native, and NMEA standard.
But I don't advice it anyway: It's only a 1Hz refresh rate and the GPS device is quite large and heavy.

The code can take any refresh rate: once a new coordinate can be received, it is computed.

babelo
Posts: 28
Joined: Wed Jul 06, 2011 12:56 pm

Re: GPS integration

Post by babelo »

Hi Alex,

You are fast :) just started same thing, by porting ardupirate code.
For PROMini somthing like that should be enougth to read serail at 4800 baud, don't take care about pin 3 and 4 i use a fcwii and need to check empty pin tomorow :

Code: Select all

#ifdef PROMINI
  #include "NewSoftSerial.h"
  // Here's a GPS device connect to pins 3 and 4
  NewSoftSerial SerialProMini(4,3); 
#endif


And in config.h :

Code: Select all

#define GPS
#define GPS_SERIAL SerialProMini // should be Serial2 for flyduino v2
#define GPS_BAUD   4800


Fabrice,

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

Very good Alex.

Within two days I added to this version of GPS i2c support for the Arduino pro mini.
On integration of GPS can we work together.

babelo wrote:Hi Alex,

You are fast :) just started same thing, by porting ardupirate code.
For PROMini somthing like that should be enougth to read serail at 4800 baud, don't take care about pin 3 and 4 i use a fcwii and need to check empty pin tomorow :

Code: Select all

#ifdef PROMINI
  #include "NewSoftSerial.h"
  // Here's a GPS device connect to pins 3 and 4
  NewSoftSerial SerialProMini(4,3); 
#endif


And in config.h :

Code: Select all

#define GPS
#define GPS_SERIAL SerialProMini // should be Serial2 for flyduino v2
#define GPS_BAUD   4800


Fabrice,



Softserial port isnt good idea. Big poroblem is a baud rate limitaion - only for 1Hz (1s) very slow gps module. For solid GPS navigation needs to be higher GPS refresh rate >= 4Hz (<=250ms)

babelo
Posts: 28
Joined: Wed Jul 06, 2011 12:56 pm

Re: GPS integration

Post by babelo »

Hi,

The NewSoftSerial libray works with interrupt, buffer and allow highest communication baud, better than old softserial.
Check here http://arduiniana.org/libraries/NewSoftSerial/

Fabrice,

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: GPS integration

Post by copterrichie »

Another problem with Softserial is, it is not interrupt driven so the process has to sit there and wait for the data to come across. This could be very costly in the time critical control loop.

User avatar
Loosi
Posts: 63
Joined: Sat Aug 20, 2011 8:31 pm
Location: Germany (HSK)
Contact:

Re: GPS integration

Post by Loosi »

Heyho!

copterrichie wrote:Another problem with Softserial is, it is not interrupt driven so the process has to sit there and wait for the data to come across. This could be very costly in the time critical control loop.


babelo wrote:The NewSoftSerial libray works with interrupt, buffer and allow highest communication baud, better than old softserial.
Check here http://arduiniana.org/libraries/NewSoftSerial/


just rtfm ;) should work like a hardware uart with interrupts and so on :D

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: GPS integration

Post by copterrichie »

Loosi wrote:Heyho!


babelo wrote:The NewSoftSerial libray works with interrupt, buffer and allow highest communication baud, better than old softserial.
Check here http://arduiniana.org/libraries/NewSoftSerial/


just rtfm ;) should work like a hardware uart with interrupts and so on :D



Full Stream Ahead!!! :D

User avatar
Loosi
Posts: 63
Joined: Sat Aug 20, 2011 8:31 pm
Location: Germany (HSK)
Contact:

Re: GPS integration

Post by Loosi »

Will try it on Saturday when i'am back at home from vacation :)

babelo
Posts: 28
Joined: Wed Jul 06, 2011 12:56 pm

Re: GPS integration

Post by babelo »

Just for information if you did not use SERIAL_SUM_PPM receiver, you have to comment out in NewSoftSerial the PCINT2_vect, because it is already used in multiwii for standard receiver interrupt and there is no more free port on portD i want to use the other motor pin which are free for my tricopter

Line 329 in NewSoftSerial.cpp, then check some free pin for tx and rx on your board and setup them correctly in my previous post

Code: Select all

/*
#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
  NewSoftSerial::handle_interrupt();
}
#endif
*/



Sorry alex i stop to post here to keep this thread clear for other annouce :)

Fabrice,

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

@MichalM_sk,
Your devs are interesting to convert a standard Serial GPS device to an I2c one.
Anyway, there exists also GPS devices with a native I2C interface.
I think it should be simple to use the same GPS stabilization part given a Serial input or a I2C input

@babelo
no problem to discuss about it ;)
as you can see it's difficult to handle "ready to use" libraries due to the common use of same timers or ISRs.

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: GPS integration

Post by alexmos »

Hi! I just updated to patch 1.8, and project was failed to compile with ProMini - GPS code gives error in line

Code: Select all

if (GPSPRESENT) GPS_SERIAL.begin(GPS_BAUD);  


Please add #ifdef GPS .. #endif to all GPS code insertion for those who not planing to use GPS.

Katch
Posts: 280
Joined: Thu Aug 04, 2011 1:44 pm

Re: GPS integration

Post by Katch »

What's a good GPS module to get in order to start testing the GPS dev code?

Gaza07
Posts: 12
Joined: Sat Apr 23, 2011 9:28 pm
Location: Nottingham Uk

Re: GPS integration

Post by Gaza07 »

Ive got a flyduino mega v1.1 with fmp-04 gps fitted and working very well with the mega pirate code, but I would like to try the multiwii dev with gps where do I download it from
cheers
Gary


Gaza07
Posts: 12
Joined: Sat Apr 23, 2011 9:28 pm
Location: Nottingham Uk

Re: GPS integration

Post by Gaza07 »

Is there no zip file with all the files needed in it

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: GPS integration

Post by PatrikE »

No there is no file But i Made a package for you.


/Patrik
Attachments
MultiWii_Gps.zip
(51.46 KiB) Downloaded 1387 times

Gaza07
Posts: 12
Joined: Sat Apr 23, 2011 9:28 pm
Location: Nottingham Uk

Re: GPS integration

Post by Gaza07 »

Hi Patrik thanks for that, I just spent ages copying and pasting the files before I saw your reply :D
I have edited them for my hardware and uploaded them to my quad using Arduino-0022 but I am not stuck
on the multiwii conf, How do I make an executable file from the pde,
Sorry for the quastions but the dev releases I used before where all packaged up :D

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: GPS integration

Post by PatrikE »


Gaza07
Posts: 12
Joined: Sat Apr 23, 2011 9:28 pm
Location: Nottingham Uk

Re: GPS integration

Post by Gaza07 »

Hi Patrik thanks for your help I now have a working multiwiiconf.exe :D

boke
Posts: 11
Joined: Sat Aug 13, 2011 1:36 am

Re: GPS integration

Post by boke »

Hey guys, thanx for working on gps integration! Which gps module do u use?
Greetings Boke

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

Hi,

http://www.sendspace.com/file/x2pfoa

This is promised MultiWii 1.8 version with my addons.

Added:

MultiWii firmware:

1.GPS I2C Support for Arduino Pro Mini & Mega boards
2.GPS is divided into Serial(SER) and I2C in Config part
3.Position hold (should work on both not tested in 1.8 yet) - position hold
is activated after the AUX1 or AUX2 switch if GPS fix is on
then the head rotates to the True North.

MultiWii config

1.View Latitude, Longitude
2.If no fix - values lat, lon, numSats are red.

Warning:

This firmware is only for testing purposes , GPS not tested on version 1.8 yet only on 1.7.
I am not responsible for any damage.

kataventos
Posts: 702
Joined: Sun Aug 28, 2011 8:14 pm
Contact:

Re: GPS integration

Post by kataventos »

Hi Alex, I am new on this project and just as a pilot. I have been reading everything about it and about this post I have a question.
Does this GPS ( MediaTek MT3329 GPS 10Hz + Adapter ) will work? The description seems to be apropriated.
Thank you for your time.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

kataventos wrote:Hi Alex, I am new on this project and just as a pilot. I have been reading everything about it and about this post I have a question.
Does this GPS ( MediaTek MT3329 GPS 10Hz + Adapter ) will work? The description seems to be apropriated.
Thank you for your time.


Yes, but by default it will output binary data.
(http://store.diydrones.com/MediaTek_MT3 ... 329-01.htm)

You have to find a way to configure it to output NMEA data before.

User avatar
Loosi
Posts: 63
Joined: Sat Aug 20, 2011 8:31 pm
Location: Germany (HSK)
Contact:

Re: GPS integration

Post by Loosi »

Alexinparis wrote:
kataventos wrote:Hi Alex, I am new on this project and just as a pilot. I have been reading everything about it and about this post I have a question.
Does this GPS ( MediaTek MT3329 GPS 10Hz + Adapter ) will work? The description seems to be apropriated.
Thank you for your time.


Yes, but by default it will output binary data.
(http://store.diydrones.com/MediaTek_MT3 ... 329-01.htm)

You have to find a way to configure it to output NMEA data before.


Good morning!

You can change the output format between NMEA and MKT (binary) protocol (https://docs.google.com/Doc?docid=0ASI4 ... l=en&pli=1)

You can find some infos under the following links:
-DataSheet
-Custom Binary Protocol Reference
-MTK Commands Manual

If i understand it correct, you can change to output all messages with

Code: Select all

$PGCMD,16,1,1,1,1,1*6B


Or only GGA:

Code: Select all

$PGCMD,16,0,0,0,0,1*6B


see this link, table 2

To do this with Arduino:

Code: Select all

Serial.print("$PGCMD,16,0,0,0,0,1*6B\r\n");


I think it should be possible to add the binary mtk protocol to multiwii, i will try it, but at the moment i dont have much time.

Greetings
Daniel

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

Hi,

I use Mtk3329 chipset ( Skylab SKM53 gps module) in my GPS to i2c board. It is a good module for a low price.

Default config for this module:
1Hz refresh rate (up to 10Hz)
NMEA sentenses On
Baud rate 9200bps

Configuration messages that I use for MTK 3329 chipset GPS module:

Code: Select all

#define SBAS_INTEGRITY_ON "$PMTK319,1*24\r\n"
#define SBAS_TEST_ON "$PMTK319,0*25\r\n"
#define WAAS_ENABLE  "$PMTK313,1*2E\r\n"                                         
#define WAAS_DISABLE "$PMTK313,0*2F\r\n"
#define DGPS_SBAS_ON "$PMTK301,2*2E\r\n"                  // default is SBAS on

#define MEDIATEK_BAUD_RATE_38400 "$PMTK251,38400*27\r\n"
#define MEDIATEK_BAUD_RATE_57600 "$PMTK251,57600*2C\r\n"
#define MEDIATEK_BAUD_RATE_115200 "$PMTK251,115200*1F\r\n"
#define MEDIATEK_REFRESH_RATE_4HZ "$PMTK220,250*29\r\n"                      //refresh rate - 4Hz - 250 milliseconds
#define MEDIATEK_REFRESH_RATE_5HZ "$PMTK220,200*2C\r\n"
#define MEDIATEK_REFRESH_RATE_10HZ "$PMTK220,100*2F\r\n"                      //refresh rate - 10Hz - 100 milliseconds
#define MEDIATEK_FACTORY_RESET "$PMTK104*37\r\n"                             //clear current settings
#define NMEA_GGA_ENABLE "$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*27\r\n" //Set GGA messages

Attachments
MTK_commands.rar
MTK 3329 commands
(71.4 KiB) Downloaded 921 times

kataventos
Posts: 702
Joined: Sun Aug 28, 2011 8:14 pm
Contact:

Re: GPS integration

Post by kataventos »

Loosi wrote:
Alexinparis wrote:
kataventos wrote:Hi Alex, I am new on this project and just as a pilot. I have been reading everything about it and about this post I have a question.
Does this GPS ( MediaTek MT3329 GPS 10Hz + Adapter ) will work? The description seems to be apropriated.
Thank you for your time.


Yes, but by default it will output binary data.
(http://store.diydrones.com/MediaTek_MT3 ... 329-01.htm)

You have to find a way to configure it to output NMEA data before.


Good morning!

You can change the output format between NMEA and MKT (binary) protocol (https://docs.google.com/Doc?docid=0ASI4 ... l=en&pli=1)

You can find some infos under the following links:
-DataSheet
-Custom Binary Protocol Reference
-MTK Commands Manual

If i understand it correct, you can change to output all messages with

Code: Select all

$PGCMD,16,1,1,1,1,1*6B


Or only GGA:

Code: Select all

$PGCMD,16,0,0,0,0,1*6B


see this link, table 2

To do this with Arduino:

Code: Select all

Serial.print("$PGCMD,16,0,0,0,0,1*6B\r\n");


I think it should be possible to add the binary mtk protocol to multiwii, i will try it, but at the moment i dont have much time.

Greetings
Daniel


Hi and thanks to all,

The HK OSD GPS that Alex is using to code seems to be weak! just 1hz refresh rate, this is bad for solid GPS navigation, but, is this enough for "accured" position hold? 1x data per second! I´m tempted to buy this one for now because of the OSD, I fly my Multiwiiquadcopter only in FPV and with this cheap equipment is better then have nothing, and if Alex is coding with this one... Better! About your reply´s, at this moment I am just checking what´s best and cheaper and it seems that the MediaTek MT3329 GPS 10Hz is a good choice!

Greetings,
Henrique

babelo
Posts: 28
Joined: Wed Jul 06, 2011 12:56 pm

Re: GPS integration

Post by babelo »

Hi,

i have done a gps integration on promini board, gps should go in place of LCD connector in my sample. I need someone to check my code, because i did not know if problem come from my GPS or from the code.
My gps come from remzibi OSD, i ve no test board other than fcwii, so it is hard to check.
The idea i s to have the GPS on LCD conector and to use the serial used by computer seetings tool to send data to remzibi OSD

Thanks for help
Fabrice,
Attachments
gpspromini.zip
patch file
(3.02 KiB) Downloaded 983 times

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: GPS integration

Post by msev »

Guys here is another cheap candidate for a gps: http://www.dealextreme.com/p/em-411-gps ... pset-80037

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: GPS integration

Post by PatrikE »

MichalM_sk
Can you test if this works.?
I dont have a shield redy for my MEGA yet so i cant test it.
Trying to get it to run on a PROMINI.

This small calculation will rotate GPS axis to compensate Roll & Pich To the compass heading.
Add it last in void GPS_position_control.

Remove magHold = DECLINATION_FACTOR functions

Code: Select all

/*==========================================
 Adding compensation with compassheading.
 By Patrik E                        
==========================================*/

  float Angle= radians(heading+DECLINATION_FACTOR);
 
/* Convert from GPS coordinates to Compass coordinates 
==========================================*/
  command_gps_roll  = command_gps_roll*cos(Angle)+command_gps_pitch*sin(Angle);
  command_gps_pitch =-command_gps_roll*sin(Angle)+command_gps_pitch*cos(Angle);
/*==========================================*/
 


You may have to adust directions in your code.

And maby do like this.

Code: Select all

     
  rcCommand[ROLL]  += gps_roll;                 //GPS added to Rc command
  rcCommand[PITCH] += gps_pitch;   
 


/Patrik

babelo
Posts: 28
Joined: Wed Jul 06, 2011 12:56 pm

Re: GPS integration

Post by babelo »

@patrike

You can use my previous post , it should work, i get data from my GPS, but it is hard to debug with this board. Don't forgot to comment the part about INT on PORTD in newsoftserial.
I report this part in RX.pde to handle interrupt and forward it to NEwSoftSerial class.

@alexinparis, if you can look at this code or have a devel board

Latest library is here http://arduiniana.org/libraries/newsoftserial/
And my patch for MultiWii is just above this post

Fabrice,

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

Hi,

ok i will test it.

PatrikE wrote:MichalM_sk
Can you test if this works.?
I dont have a shield redy for my MEGA yet so i cant test it.
Trying to get it to run on a PROMINI.

This small calculation will rotate GPS axis to compensate Roll & Pich To the compass heading.
Add it last in void GPS_position_control.

Remove magHold = DECLINATION_FACTOR functions

Code: Select all

/*==========================================
 Adding compensation with compassheading.
 By Patrik E                        
==========================================*/

  float Angle= radians(heading+DECLINATION_FACTOR);
 
/* Convert from GPS coordinates to Compass coordinates 
==========================================*/
  command_gps_roll  = command_gps_roll*cos(Angle)+command_gps_pitch*sin(Angle);
  command_gps_pitch =-command_gps_roll*sin(Angle)+command_gps_pitch*cos(Angle);
/*==========================================*/
 

TennesseePilot
Posts: 2
Joined: Thu Jan 20, 2011 2:17 am

Re: GPS integration

Post by TennesseePilot »

Will the current dev 20110903 display the no. of sats and distance home in the GUI if a working gps is attached to serial2? The GPS define has been uncommented, baud set at 38400, using serial2 and activated gps checkboxes. Using a mega 1280.....or is that still to be developed?

TP

User avatar
Loosi
Posts: 63
Joined: Sat Aug 20, 2011 8:31 pm
Location: Germany (HSK)
Contact:

Re: GPS integration

Post by Loosi »

Hi!

I´m not sure if it was the dev 20110903 or the current svn revision, but normally it should switch to green and display the no. of sats and die distance, i try it in 2 hours when i´am at home.

TennesseePilot
Posts: 2
Joined: Thu Jan 20, 2011 2:17 am

Re: GPS integration

Post by TennesseePilot »

Thanks Loosi. Right now I'm not getting any data display in the GUI. Let me know what you find out later when you get to try it.

TP

User avatar
Loosi
Posts: 63
Joined: Sat Aug 20, 2011 8:31 pm
Location: Germany (HSK)
Contact:

Re: GPS integration

Post by Loosi »

Hi!
Sorry my Laptop crashed and i had to replace the harddisk :(

The version on page 3 of this topic is the working one :) viewtopic.php?f=8&t=649&start=20#p3555

multiwii_gps.JPG

mr_swell
Posts: 3
Joined: Thu Sep 22, 2011 11:48 am

Re: GPS integration

Post by mr_swell »

Hallo MichalM_sk,
i have the Flyduino V2 (Mega2560/ and the GPS Mtk3329 connected serial2, it is ok, see in Multiwii GPS Signal and get FIx
http://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htm

I don't really know how can i do this, get 10Hz, i look in the GPS.pde, config.h etc, found nothing...
Configuration messages that I use for MTK 3329 chipset GPS module:

#define SBAS_INTEGRITY_ON "$PMTK319,1*24\r\n"
#define SBAS_TEST_ON "$PMTK319,0*25\r\n"
#define WAAS_ENABLE "$PMTK313,1*2E\r\n"
#define WAAS_DISABLE "$PMTK313,0*2F\r\n"
#define DGPS_SBAS_ON "$PMTK301,2*2E\r\n" // default is SBAS on

#define MEDIATEK_BAUD_RATE_38400 "$PMTK251,38400*27\r\n"
#define MEDIATEK_BAUD_RATE_57600 "$PMTK251,57600*2C\r\n"
#define MEDIATEK_BAUD_RATE_115200 "$PMTK251,115200*1F\r\n"
#define MEDIATEK_REFRESH_RATE_4HZ "$PMTK220,250*29\r\n" //refresh rate - 4Hz - 250 milliseconds
#define MEDIATEK_REFRESH_RATE_5HZ "$PMTK220,200*2C\r\n"
#define MEDIATEK_REFRESH_RATE_10HZ "$PMTK220,100*2F\r\n" //refresh rate - 10Hz - 100 milliseconds
#define MEDIATEK_FACTORY_RESET "$PMTK104*37\r\n" //clear current settings


Greetz
Jo

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

mr_swell wrote:Hallo MichalM_sk,
i have the Flyduino V2 (Mega2560/ and the GPS Mtk3329 connected serial2, it is ok, see in Multiwii GPS Signal and get FIx
http://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htm

I don't really know how can i do this, get 10Hz, i look in the GPS.pde, config.h etc, found nothing...
Configuration messages that I use for MTK 3329 chipset GPS module:

#define SBAS_INTEGRITY_ON "$PMTK319,1*24\r\n"
#define SBAS_TEST_ON "$PMTK319,0*25\r\n"
#define WAAS_ENABLE "$PMTK313,1*2E\r\n"
#define WAAS_DISABLE "$PMTK313,0*2F\r\n"
#define DGPS_SBAS_ON "$PMTK301,2*2E\r\n" // default is SBAS on

#define MEDIATEK_BAUD_RATE_38400 "$PMTK251,38400*27\r\n"
#define MEDIATEK_BAUD_RATE_57600 "$PMTK251,57600*2C\r\n"
#define MEDIATEK_BAUD_RATE_115200 "$PMTK251,115200*1F\r\n"
#define MEDIATEK_REFRESH_RATE_4HZ "$PMTK220,250*29\r\n" //refresh rate - 4Hz - 250 milliseconds
#define MEDIATEK_REFRESH_RATE_5HZ "$PMTK220,200*2C\r\n"
#define MEDIATEK_REFRESH_RATE_10HZ "$PMTK220,100*2F\r\n" //refresh rate - 10Hz - 100 milliseconds
#define MEDIATEK_FACTORY_RESET "$PMTK104*37\r\n" //clear current settings


Greetz
Jo


these configuration messages I use in my GPS to I2c board, in multiwii firmware with directly connected serial GPS it isnt implemented yet.

In a short time (when I fix crashed quadcopter) I add a new version of multiWii firmware with MediaTek serial configuration + patch 2 + some code changes + GPS telemetry support

mr_swell
Posts: 3
Joined: Thu Sep 22, 2011 11:48 am

Re: GPS integration

Post by mr_swell »

hi micha,
i am glad to test it
(when I fix crashed quadcopter)
= possibly your gps flight ;)
thx
jo

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: GPS integration

Post by crashlander »

Hello!
I'm using couple of years old GPS module form SparkFun (LS20031, it is 32 channel and 1Hz) which defaults to 57600bps (and I set it in code) and I'm unable to change that (tried suggestions from previous posts with no success).
By default it is "producing" code like that (without position lock):
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.426,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*74
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,235951.626,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*48
$GPGLL,8960.0000,N,00000.0000,E,235951.626,V,N*4D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.626,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*76
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

But I can not see anything (when connected to MultiWii GUI) with or without position lock.
Any suggestions?!

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »


crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: GPS integration

Post by crashlander »

MichalM_sk wrote:Hi,

you use this version?
viewtopic.php?f=8&t=649&start=20#p3555

I'm using version from Alex, from SVN. I don't have enough tools/expiriences to create custom PCB, program and solder Atmega168. Could you design Arduino (ProMini) based board and firmware?

Andrej

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

This firmware viewtopic.php?f=8&t=649&start=20#p3555 also works with serial GPS module.
Another multiwii config utility doesn't permit display GPS info currently.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

crashlander wrote:Hello!
I'm using couple of years old GPS module form SparkFun (LS20031, it is 32 channel and 1Hz) which defaults to 57600bps (and I set it in code) and I'm unable to change that (tried suggestions from previous posts with no success).
By default it is "producing" code like that (without position lock):
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.426,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*74
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,235951.626,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*48
$GPGLL,8960.0000,N,00000.0000,E,235951.626,V,N*4D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.626,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*76
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

But I can not see anything (when connected to MultiWii GUI) with or without position lock.
Any suggestions?!


Hi,
I've uploaded a new dev (28 september), could you try this one ?

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: GPS integration

Post by msev »

Will this gps integration be universal, work with different gps's from cheap one's with low update rate to the faster, better, more expensive 10Hz one's :D ?

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: GPS integration

Post by crashlander »

Hello,
@Alexinparis: yes now it works (in GUI) I can see data at 57600bps
@MichalM_sk: sorry I vas unaware that it works with serial GPS, but now I tested it and can see data in GUI. But my current (new) Mega shield only supports Spektrum satellite receiver, so I'm currently unable to test any further with your code.

Regards Andrej

Post Reply