Page 1 of 1

MultiWii GPS support

Posted: Wed Jun 15, 2011 6:23 pm
by MichalM_sk
GPS to I2C board for MultiWii by MichalM_sk.rar
GPS to I2C adapter board sources + pcb layout
(23.76 KiB) Downloaded 1301 times
Hi,

MultiWii 1.8 with gps I2C support here http://www.sendspace.com/file/x2pfoa

I am software developer and fan of Multiwii project :) . Before two weeks ago I started a project to support gps for multiwii. I ordered serial gps module EM-406 - very slowly so replaced!! by the Skylab SKM53 (Mediatek MTK3329 chipset) and developed hardware (based on atmega 168) & software to read gps NMEA strings from gps module, parsing data from nmea and sending these data (now are sending Altitude,Latitude, NumSats) 10 bytes data packet via twi (i2c) interface of atmega 168 to master multiwii control board. I2c communication is directly based on twi interface and TWI registers. Supported and tested is 100Khz and 400Khz i2c bus speed. System stability of my i2c sensor emulation ist good now but much time was necessary until I solved all problems with system freezing. My multiwii board contains (wmp,nk,bmp085,hmc5843 and now gps :) ) No changes to multiwii control board twi interface code only added gps support.

Status: relased first version - work only with Mediatek MTK3329 chipset with a different
chipset will not work - differently config GPS sentenses.
I used SKM53 gps module , check "read info.txt" in package!! .


Connecting elements:

GPS to I2C board TX -------------> RX of GPS module
GPS to I2C board RX -------------> TX of GPS module
GPS to I2c board VCC -------------> VCC of GPS module
GPS to I2c board GND -------------> GND of GPS module

Video - Data only for visualisation, I work on position hold algoritm, no decimal precision of alt,lat,lon for now :)
http://www.youtube.com/watch?v=N2DuavNyLHE

Top side of gps board
Image

Bottom side of gps board
Image

I2c connection with control board
Image

Re: MultiWii GPS support

Posted: Wed Jun 15, 2011 7:45 pm
by miniquad
Looks very interesting. Keep up the good work. :)

Re: MultiWii GPS support

Posted: Wed Jun 15, 2011 9:58 pm
by Kayle
Hey michalM_SK,

Thats awesome. Really great. Where do yo come from?

Did you think to realize a position hold with your gps code?

Kind regards
Kayle

Re: MultiWii GPS support

Posted: Thu Jun 16, 2011 8:09 am
by Alexinparis
Hi Michal,

It's a great news toward a GPS integration.
do you you have an idea about the time needed to sent the 23 bytes over I2C at 400kHz ?

Re: MultiWii GPS support

Posted: Thu Jun 16, 2011 9:23 am
by MichalM_sk
Kayle wrote:Hey michalM_SK,

Thats awesome. Really great. Where do yo come from?

Did you think to realize a position hold with your gps code?

Kind regards
Kayle


Hi, I am from Slovakia.
Position hold is goal of this project.

Alexinparis wrote:Hi Michal,

It's a great news toward a GPS integration.
do you you have an idea about the time needed to sent the 23 bytes over I2C at 400kHz ?


Thank you, I modifies code (master side) and find out what time it is necessary to transfer all gps data via I2C 400kHz.

Re: MultiWii GPS support

Posted: Thu Jun 16, 2011 1:50 pm
by MichalM_sk
I modified code to view duration of i2c operation (reading gps data - 23 bytes)

Code: Select all

uint32_t sTime = 0; //start time
uint32_t eTime = 0; //end time
uint32_t dTime = 0; //duration time

sTime = micros();
//change I2C bus speed to  400kHz
TWBR = ((16000000L / 400000L) - 16) / 2;
i2c_rep_start((9<<1) + 1);       //GPS I2c address 0x09 (7bit)  and 0x12 (8bit)

for(uint8_t i = 0; i < 22; i++)
      gpsData[i]= i2c_readAck();
gpsData[22]= i2c_readNak();
eTime = micros();
dTime = eTime - sTime;
Serial.print("duration of i2c operation in uSec:  "); Serial.println(dTime);

results:

Code: Select all

100kHz - 692 uSec
400kHz - 616 uSec

Re: MultiWii GPS support

Posted: Fri Jun 17, 2011 3:02 pm
by MichalM_sk
I added a new video with full implementation to MultiWiiConf.

http://www.youtube.com/watch?v=PZN7VO-xhuE

Re: MultiWii GPS support

Posted: Fri Jun 17, 2011 3:51 pm
by Kayle
Hey michalm_sk,

Great, keep going. I check the details from the gps modul you are using. The positional accuracy is normaly 10m. Do you think there is a good position hold function thinkable?

Greetings Kayle

Re: MultiWii GPS support

Posted: Fri Jun 17, 2011 9:57 pm
by MichalM_sk
Kayle wrote:Hey michalm_sk,

Great, keep going. I check the details from the gps modul you are using. The positional accuracy is normaly 10m. Do you think there is a good position hold function thinkable?

Greetings Kayle


+- 10 meters is normal positional accuracy for non-SBAS (WAAS, EGNOS,...). but sirfstar III chipset in EM-406 support WAAS. so I will test it with WAAS enable. Only tests confirm what is the real accuracy. Also it is possible to use any other GPS module (connected to gps board) with standard NMEA 0183 data format ;)

Re: MultiWii GPS support

Posted: Sun Jun 26, 2011 5:55 pm
by c2po
MichalM_sk wrote:

Code: Select all

100kHz - 692 uSec
400kHz - 616 uSec

I'd hate to tell you that those numbers are a little bit off. There is no way that reading 23 bytes will take such a short time. :?
Let's do some math: at 100kHz one bit takes exactly 1/100000 = 10us, so one byte with start, ack, and stop bits will take about 100us. Reading 23 byte should take about 23 * 100 = 2300us, plus you need another 2 bytes of address before that, so total would be 2500ms.
At 400kHz it will be much faster, one byte is about 30us, so 23 * 30 = 690 plus 2 bytes of address, 750us total.
To prove the math I attached the screenshots from oscilloscope. ;)
First two show signals at 100kHz, and the third one is at 400kHz.

Image Image Image

Re: MultiWii GPS support

Posted: Sun Jun 26, 2011 8:13 pm
by Felch
Supppose you will not use i2c but custom bit-banged protocol sending blindly data and clock? Then speed depends only of yor processors clock (assuming that int's are disabled during transfer). In that case you'd need a separate processor at the gps side collecting and deciphering data from slow gps module. As soon as main processor enables transfer, it could be done very quickly.
I used such trick in my gamma-spectrometer (PhD work). Can't tell exact transfer time right now but it was below 1ms for sure.

Re: MultiWii GPS support

Posted: Mon Jun 27, 2011 9:54 am
by EOSBandi
HI Guys,
I appriciate the work to bring gps to MultiWii, but do we really need to go along the i2c path? The amount of data that we need to move is quite big, compared to the sensor data and with a 10Hz GPS it will slow down the cycle time significantly. Plus the serial to i2c conversion also add unneccessary complication to the system. I rather suggest to connect gps to a serial port. I know that the Arduino mini does not have enough ports, but some of the recent developments also requires a ATMega 2560 or similar board.
Regards,
Andras

Re: MultiWii GPS support

Posted: Fri Jul 08, 2011 10:56 pm
by MichalM_sk
I use custom i2c protocol, 23 bytes was sent only for visualization purposes in multiwiiconf, currently is addressed only 10Byte (4 bytes Latitude , longitude and 2 conf bytes), control board read data from i2c GPS every 100 ms. Reading speed at 400 kHz is now comparable to the HMC5843.

Refresh rate of EM406 GPS module is too low (1Hz) so it is currently used MediaTek MT3329 GPS module with refresh rate increase up to 10Hz.

In the coming days I will test it, but in the moment I have a problem with PID values ​​on dev firmware. Default values is not working for me.

Re: MultiWii GPS support

Posted: Fri Jul 08, 2011 11:17 pm
by MichalM_sk
currently is implemented the routine to hold position and go home position (not complete - missing yaw correction)

Re: MultiWii GPS support

Posted: Thu Jul 28, 2011 11:31 am
by MichalM_sk
Project status:

Position hold work (still needs a lot of testing) but i have gps unacuracy during the day sometimes up to 20 meters (in Slovakia, like elsewhere in Europe), about 10 - 11.00 pm only 1 to 2 m.

I have to try it when the geometry of satellites in the sky to determine the best accuracy.

Re: MultiWii GPS support

Posted: Thu Jul 28, 2011 12:54 pm
by babelo
Hi,

Do you have the code or diff from svn ? I wan to do a try with my gps from remzibi osd :))

Thanks

Re: MultiWii GPS support

Posted: Thu Jul 28, 2011 9:56 pm
by MichalM_sk
babelo wrote:Hi,

Do you have the code or diff from svn ? I wan to do a try with my gps from remzibi osd :))

Thanks


Hi,

At the moment the project is not public, want to have any testing until it was finalized.

For GPS position hold will be required:

- GPS sensor board (serial MTK GPS connected to developed custom I2C board)
- Magnetometer (determine the size of the angle between the head and the true North)

Re: MultiWii GPS support

Posted: Fri Jul 29, 2011 12:33 am
by babelo
Ok so, i can continue to look at part of code from ardupirat, which took pid loop for lat / lon, and maybe heading can be read from gps too when copter is in move.

Code is there just need to extract part for NMEA serial, reading / pid loop

Re: MultiWii GPS support

Posted: Sun Jul 31, 2011 5:24 pm
by KaiK
I am just playing around with a Holux GPSlim 236 on a Arduino Mega Serial port.

I think the NMEA protocol doesnt provide a higher update rate than 1 Hz, which should be high enough for position hold an autonomous flight (and in contrast to the speed of quadrocopters and the precision of GPS)?

Regards
Kai

Re: MultiWii GPS support

Posted: Tue Aug 16, 2011 10:07 am
by Lapino
here's some kind of motivation to get GPS support going ;)
http://www.multiwii.com/forum/viewtopic.php?f=7&t=469&p=3244#p3244

Greetings,

Lapino

Re: MultiWii GPS support

Posted: Thu Aug 18, 2011 9:01 pm
by Maciek
Hello Michal

I would love to hear if you've made any progress with your GPS software and are perhaps ready to share it with us...

Thanks

Re: MultiWii GPS support

Posted: Fri Aug 26, 2011 10:53 pm
by MichalM_sk
Hi,

I returned from vacation.

Following days I will implement my code to multiwii 1.8 and then publish the source code.

Info for all interested

This project is built on the Arduino pro mini platform which has only one serial port. Therefore, communication with the GPS is solved through the I2C bus. After more testing I found no errors during i2c comunication with my board so there is no freeze I2C bus, which could cause an accident.

Benefits I2c solutions

Main CPU does not slow down with reading serial port data (every 100ms), decoding the GPS data, position data averaging
Only 10Bytes is sending via I2C
Very short transfer time (about 300 us)
400kHz I2C bus

Re: MultiWii GPS support

Posted: Mon Aug 29, 2011 3:48 pm
by vps_rj
Amazing. I'm new to this world of MultiWii, but i want to help soon! I'm a Java programmer and i want to contribute with to help our platform be bigger and mature.

I need to take a look at this forum to start with this exciting world...
Best regards!

Re: MultiWii GPS support

Posted: Wed Aug 31, 2011 2:45 pm
by MichalM_sk

Re: MultiWii GPS support

Posted: Wed Aug 31, 2011 11:48 pm
by goofy23
Wow i am really astonished how fast the things moved.
I am still full of work and have hardly any time to test all the thing which are new here.
Did a quick test with a Flyduino V2 and a FMP04, got no fix.
Changed the serial3 simply to serial2 but may i am wrong and its more complicated.
I think my serial mapping makes some problems, as the GPS proved to work on the megapriate before.
Its on Serial2 for the V2 Flyduino.
The cables should arrive tomorrow, but i still need some time to evaluate the new GPS module abugsnightmare found, have it here but didnt connected it, in my opinion its a hot item and the support will be good, it will be also relaitve cheap.
So more will come for sure.

Re: MultiWii GPS support

Posted: Thu Sep 01, 2011 3:50 pm
by SoundMTB
Dear Michal,

I very interested in your GPS solution.
Can you give me your schematic and source for the GPS adapter board to implemt this in my MULTIWII Copter with Arduino Pro Mini?

thanks
Oliver

Re: MultiWii GPS support

Posted: Fri Sep 02, 2011 12:46 pm
by MichalM_sk
SoundMTB wrote:Dear Michal,

I very interested in your GPS solution.
Can you give me your schematic and source for the GPS adapter board to implemt this in my MULTIWII Copter with Arduino Pro Mini?

thanks
Oliver



Hi,

sources & pcb layout in my first post

Re: MultiWii GPS support

Posted: Sat Sep 03, 2011 5:32 pm
by SoundMTB
Thanks
sorry I was so happy to find a GPS solution than I haven't seen the file

gread job
Oliver

Re: MultiWii GPS support

Posted: Sat Nov 19, 2011 2:30 pm
by MatthiasW
Hi MichalM_sk,

thank you for posting your GPS-I2C-Converter.
I have a 4800baud-GPS-Modul (1Hz). Am I able to use your converter as it is, or are there changes to be done in the Mega168-Firmware ?
Can you send me the sourcecode? Then i can do the changes myself.

Thank you alot
have a nice day
Matthias

Re: MultiWii GPS support

Posted: Wed Dec 28, 2011 10:15 pm
by Ben_der
Has anybody an idea what happened to MichalM_SK ?

Re: MultiWii GPS support

Posted: Thu Dec 29, 2011 3:22 pm
by PatrikE
Userstats say
Last visited:02 Nov 2011 10:34

So probably done something else for a while. 8-)

Re: MultiWii GPS support

Posted: Thu Jan 12, 2012 9:07 pm
by leszczuarek
Hi
Sorry for my english
I want to build this project
to my multiwii
I have 2 questions about the construction.

First Q2 how much Mhz?

Second Does the GPS sensor will be good?
http://www.maritex.com.pl/pl/shop/produ ... /1/backurl
Thank you very much for your help.

Re: MultiWii GPS support

Posted: Mon Jan 16, 2012 5:30 pm
by skazic
Hello,
I have a plan to create a GPS I2C adapter board, but I encountered a problem in the making.
Unable to figure out the value of Q2.
It would be very grateful to you if we who says that value
Thanks

Re: MultiWii GPS support

Posted: Mon Jan 16, 2012 6:45 pm
by PatrikE
I think it will work.
It have both Serial and USB ports.

Re: MultiWii GPS support

Posted: Mon Jan 16, 2012 9:41 pm
by marbalon
leszczuarek wrote:Hi
Sorry for my english
I want to build this project
to my multiwii
I have 2 questions about the construction.

First Q2 how much Mhz?

Second Does the GPS sensor will be good?
http://www.maritex.com.pl/pl/shop/produ ... /1/backurl
Thank you very much for your help.


Hi,
I think you are from Poland so please read this post ;)
http://rc-fpv.pl/viewtopic.php?t=5576

But fer every other people who want to use this module - I have custom firmware for this module with 10Hz support and binary protocol ;)

Re: MultiWii GPS support

Posted: Tue May 01, 2012 6:53 pm
by ProstetnikJeltz
Hello Michal,

great work !

Could you please also post a schematic of the pcb.
In your first post are the pcb and the placement of the parts but no schematics.
I just bought a TQFP-Breakoutboard and don't want to use your PCB due to space problems in my copter .
May you be so kind, to attach it here ?

Greetings from Munich Uli

Re: MultiWii GPS support

Posted: Wed May 02, 2012 1:26 pm
by MichalM_sk
Hi,

new schematic + latest hex (from 3.10.2011) in attachment.
I use my I2c board about one year without any problems. Now with modified MultiWii 2.0 ;)

Regards Michal M

Re: MultiWii GPS support

Posted: Mon Jun 18, 2012 1:09 pm
by chandoo
KaiK wrote:I am just playing around with a Holux GPSlim 236 on a Arduino Mega Serial port.

I think the NMEA protocol doesnt provide a higher update rate than 1 Hz, which should be high enough for position hold an autonomous flight (and in contrast to the speed of quadrocopters and the precision of GPS)?

Regards
Kai


Hello Kai
I just placed order for my multiwii quad parts, waiting for shipment to be delivered.
I have Holux GPSlim 236 as well, and i am totally new to electronics and Quad Copters, this is my first attempt in doing something in this Hobby.

since holux gpslim236 can output gps data over bluetooth interface, initially i thouhgt of getting bluetooth module for Cirus Multiwii SE and interfacing with Holux GPSlim236 in getting the gps data, later i found that mini USB interface on Holux GPSlim can output serial data.
I found this info regarding the holux gpslim 236 pinout
http://pinouts.ru/GPS/holux_gps_pinout.shtml
i thought it might help.
If you are still playing with GPSlim236, I will be joining you soon .

Thanks
Chandoo

Re: MultiWii GPS support

Posted: Mon Jun 18, 2012 8:11 pm
by EOSBandi
Forget the holux, it's a SirfIII based module, max 1Hz update rate. Not enough for poshold.

Re: MultiWii GPS support

Posted: Mon Aug 13, 2012 6:14 pm
by spidi
What do i need to coonect GPS to my MultiWii SE board?

Can you please give me link to best price?

Thank You!

Re: MultiWii GPS support

Posted: Mon Aug 13, 2012 6:50 pm
by LuFa
thats know the right plase to ask question about gps :
viewtopic.php?f=8&t=649

Odp: MultiWii GPS support

Posted: Tue Aug 14, 2012 12:03 am
by ezio
I started to think about buying a gps. Which one is better u-blox or MTK?

Re: MultiWii GPS support

Posted: Thu Aug 16, 2012 5:05 pm
by flyrobot
I have both MTK and ublox, i still prefer MTK chipset FMP04 from flyduino (its serial). FMP04 just plug and run without any modification and very good signal reception.