GPS sensor

Development & General Chat for the superb openxvario project.

Moderator: rainer

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

Yes, I will add GPS support to D serie Rx (and to Multoplex too).
Currently it should work for Sport and Hott Tx.

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: GPS sensor

Post by jhsa »

Didn't know oXs supports Hott.. Gotta tell the guys from the club ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

jhsa wrote:Didn't know oXs supports Hott.. Gotta tell the guys from the club ;)

João
It is not yet available in the master branch because it is currently being tested by one member.
It is available in a branch openXsensor_imu (branch being use to prepare support of accelerometer/gyro sensor)
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

I noticed the hot support in the IMU version 8-)
Also noticed it size is coming down as you strip out unneeded imu code :) .

I have another gps unit on the way now lol, I was going to move one around a few models but decided to just order more at £7 odd its cheap! :D
Price is reduced now to £6.90 from £7.20......., what can I spend the £0.30 I saved on? :D
http://www.aliexpress.com/item/Ublox-7- ... eb201560_9

I will build one and fit it over the weekend now that my x4r is replaced and working , might still be a while before flying with it though with this storm kicking up ..
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: GPS sensor

Post by jhsa »

mstrens wrote:
jhsa wrote:Didn't know oXs supports Hott.. Gotta tell the guys from the club ;)

João
It is not yet available in the master branch because it is currently being tested by one member.
It is available in a branch openXsensor_imu (branch being use to prepare support of accelerometer/gyro sensor)
Thanks.. They will like to know anyway ;) :)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Fungus
Posts: 2
Joined: Mon Oct 19, 2015 7:23 pm
Country: -

Re: GPS sensor

Post by Fungus »

Here is a vid (not good but useful) showing the oXs together with HOTT telemetry ;)

http://youtu.be/Y-a5du_yqC4

Thanks to mstrens and carbo for the support, it's a pleasure to work with you guys :)

Karol
Last edited by Fungus on Fri Nov 13, 2015 8:54 pm, edited 1 time in total.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: GPS sensor

Post by Carbo »

Here is my actual oXs setup, maybe it is helpful for newcomers. I have built a lot of oXs and presumably i have made all the possible mistakes in the past.

Neo7 GPS with connector
Neo7.jpg
Bottom with MS5611 equipped with pressure connector (useful if you use a pitot tube, with clean static pressure from outside the fuselage, or necessary, if you use a TEK-Probe) and 4525DO airspeed-sensor with 100nF capacitor on powersupply.
Bottom.jpg
Connector.jpg
Top with power supply and additional wires for GND and RAW to powersupply the GPS. Best is to twist/drill the wires, put them through the hole, cut them flush with the pcb and solder them then. On the left side is a SMD resistor between A6 and GND, the purple wire is the voltage probe, the second resistor is on the other side of the wire, in case of a shortcut it will not produce smoke and damage.
Top.jpg
10k resistor from PIN6 to GPS RX
10k.jpg
Here is the wiring:

Receiver GND --> Arduino GND
Receiver VCC --> Arduino RAW
SPort (or RX Hub-protocol) --> Arduino PIN 4

GPS RX --> resistor 10k --> Arduino PIN 6
GPS TX --> Arduino RX
GPS VCC --> Arduino RAW (do not exceed 6V!)
GPS GND --> Arduino GND

MS5611 VCC --> Arduino VCC
MS5611 GND --> Arduino GND
MS5611 SCL --> Arduino A5 (green)
MS5611 SDA --> Arduino A4 (yellow)

4525DO PIN1 --> 100nF Cap --> Arduino GND
4525DO PIN2 --> 100nF Cap --> Arduino VCC
4525DO PIN3 --> Arduino A4 (yellow)
4525DO PIN4 --> Arduino A5 (green)

Voltage to measure --> (resistor to Voltage) --> A6
A6 --> (resistor to GND) --> GND
How to calculate the resistors --> oXs.config_description.h

All you need to know about building and wiring can be found in "oXs_config_description.h" written by mstrens.

Mstrens made and still makes an incredible job, in developing and documenting oXs.
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

Thanks for the pics , I will build mine similar with the GPS on a plug probably , though i may solder one to an arduino but leave the RX wire on a plug to remove for flashing still using the wiring and case that came with the GPS so keeping it out on its own away from the arduino etc.
I considered removing the case on the GPS and soldering direct to arduino somehow but decided against it after removing case and seeing how delicate it seems, probably best leaving it in case and using the supplied wire.
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

Recieved my gy-86 in post today. :D
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

I got my gy-86 a few days ago.
Please note that the code currently available on github does not work. It is a code written before I got my sensor.
I am currently testing the mpu6050.
It was quite easy to get the accelerations but not to use them in order to reduce the reaction time of the vario.
I have tested quite different algorithms (outside of oXs) and it seems that I found one that gives better results.
I noticed:
- the ms5611 it self has a quite long reaction time. When I move the sensor up and down, the vertical acceleration returned by mpu6050 varies about 0.5 sec before the altitude reported by the MS5611
- when the acceleration from MPU6050 is merged (using a kalman filter) with the altitude from MS5611, I can calculate a vertical speed. This vertical speed seems to react about 0.5 sec faster than the vertical speed calculated with only the MS5611 (currently used in oXs). It seems also a little more noisy.

The code used for this test is not integrated in oXs. It requires 25 k flash (max of arduino promini is about 30k) but it is not optimised.
I have now to look if I can reduce the size of the code and if I can integrate it in oXs.
Further tests will be required to see if the vario is not too noisy and if changes of roll/pitch does not have a too big impact on the vertical speed.

In attachment, you can see a chart that shows the current results.
Attachments
test_mpu6050_2015_11_20_V1.rar
(146.26 KiB) Downloaded 277 times
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

I imagine it would take a fair bit of tunnng to get it right but once done should give better results.
Just hope the pro mini is up to the job once you've optimised the code...

I got the vario built and loaded openxsensor 2.5 and its working,I tried the GPS version but got nothing but did not have the GPS connected and might well have something in the settings done wrong again lol..

I wonder if the IMU could be used to get rid of stick thermals to some extent? Ie if glider goes up and nose goes up then they cancel each other out but if glider goes up and nose stays level or goes down then thermal is there...or is this what you are actually doing?

Good thing is the gy-86 added to the arduino does not make the whole thing any bigger then just the gy-63 if done neatly.
Fungus
Posts: 2
Joined: Mon Oct 19, 2015 7:23 pm
Country: -

Re: GPS sensor

Post by Fungus »

For your idea niglesheffield he needs the AOA!
By the way, great idea too ;)
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: GPS sensor

Post by Carbo »

nigelsheffield wrote:I wonder if the IMU could be used to get rid of stick thermals to some extent? Ie if glider goes up and nose goes up then they cancel each other out but if glider goes up and nose stays level or goes down then thermal is there...or is this what you are actually doing?
If the gy-86 is sensible enough, to detect accelleration or deceleration when the speed of the plane changes because of stick thermals, dTE should be possible, but, i dont believe so.

@mstrens: is acc logging already possible, to have some real flight data?
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

I also get my gy-521 , I was wanting to know if i could add this to a gy63 on the same pins with resistors or is this not possible?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

Carbo wrote:
If the gy-86 is sensible enough, to detect accelleration or deceleration when the speed of the plane changes because of stick thermals, dTE should be possible, but, i dont believe so.


accelerometers (like gy86) are very sensitive but I am not sure it will be possible to use it for dte:
- for dte, we need the acceleration in the direction of the glider. From AccX measured by the sensor, we have to take out the impact of gravity (when pitch is not zero). I am afraid that the "netto" (=linear) acceleration will not be very accurate because the netto acceleration will be small compared to the gravity acceleration (when pitch is not zero).
- I expect (to be checked) that the (air) speed has also to be taken inot account for dte.
If so, it will, for sure, be a big issue. In theory, it is easy because it is just an integration of linear acceleration. Still in practice, a small offset on acceleration will have very big impact (even over a short time) and the calculated speed will diverge if it can't be merged (checked) with another source of data (like an airspeed sensor)
I do not expect that it is possible (and even makes sense) to merge with a GPS (ground speed is not equal to airspeed, lack of memory/cpu in Arduino).
Carbo wrote: @mstrens: is acc logging already possible, to have some real flight data?

The version on github does not work for sensor 6050 (bug).
I think I have a version of oXs (on my pc) that works but it does not contains the code to send the Acc from 6050 sensor (and it does not contains the algorithm for merging the data with the baro sensor).
I hope that I can make a version of oXs for testing this week end.
Do you already have a gy86?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

nigelsheffield wrote:I also get my gy-521 , I was wanting to know if i could add this to a gy63 on the same pins with resistors or is this not possible?
I think that gy-521 does not have level converteron the SCL and SDA signal.
Mpu6050 normally does not accept more than 3.3 (or 3.6) volt.
If you connect it a arduino 5 volt, there is a risk for the mpu6050.
Perhaps, it will work but I am not sure.
Adding resistors on SCL and SDA would not work (I think).

One option could be to power on your arduino with 3.3 volt instead of 5 volt.
Even if it is a 16mhz (and it is out of tolerance), most of the time arduino will work.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: GPS sensor

Post by Carbo »

mstrens wrote:Do you already have a gy86?
No, it should arrive within 10 days.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: GPS sensor

Post by Carbo »

The gy-86 arrived today. Is the wiring identical to MS5611, or is additional wiring (interrupt) necessary?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

Int has to be connected too (on arduino pin 2 = int0).
I put some code on git hub but it does not work correctly.
I tried to reuse some code from nav6 project.
Still this code uses a lot of flash memory and I try to remove what is not absolutely required.
It seems that I removed some required part because the data are now updated very slowly when I rotate the sensor.
So I try to find what is currently missing.
Note: I did not yet add code to send new data over telemetry. So I just test in debug mode.
kcaldwel
Posts: 40
Joined: Wed Mar 12, 2014 7:49 pm
Country: Canada

Re: GPS sensor

Post by kcaldwel »

Hi,

I'm new at this, so please excuse the basic questions. I have the OXS vario working, and would like to add a GPS to this, hopefully running at 10Hz. I would also like to have a feed-through for the SPort, to add other sensors. I have also been looking at the GPS set-up on RCGroups:

http://www.rcgroups.com/forums/showthread.php?t=2482328

In the RCGroups thread, flarssen hooks his GPS up to VCC, while here it is connected to RAW. But he has his input voltage from SPort also coming to VCC. It would be easier to hook up to VCC, given the leads already soldered into the RAW connection, but I assume it was done to provide raw voltage to the GPS, rather than loading the Arduino regulator? The VCC connection is from the Arduino voltage reg?

flarssen connects his GPS to TX0 (Grn), and RXI. If I understand correctly, here it is connected to RXI, and P6 through a 10k resistor (Grn). Is this just a difference in where the firmware is sending the signals?

If I am using the set-up shown above, can I add a feed through for other SPort sensors? flarssen shows his connected to Gnd, VCC (in and out), and the signal wire to P12 through a 56.2k Ohm resistor. The SPort connection here is Gnd, RAW, and P4. Can I connect a feed though SPort connection to these same pins?

Thanks for all the work on this!

Kevin
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

kcaldwel wrote:Hi,
In the RCGroups thread, flarssen hooks his GPS up to VCC, while here it is connected to RAW. But he has his input voltage from SPort also coming to VCC. It would be easier to hook up to VCC, given the leads already soldered into the RAW connection, but I assume it was done to provide raw voltage to the GPS, rather than loading the Arduino regulator? The VCC connection is from the Arduino voltage reg?
Kevin
Connecting power supply to Vcc or to Raw depends on the voltage of you power supply.
If your battery can deliver more than 5 volt (for a pro mini 16 mhz), this voltage will be present on Vcc from RX and will power on the Arduino via the SPORT Vcc.
It is safe to connect Vcc Sport to RAW in order to let Arduino voltage regulator drop the voltage down to 5 volt.
If you battery is a one cell lipo, voltage can not exceed 4.2 volt. It is then better to connect Vcc SPORT to Arduino Vcc in order to bypass the voltage regulator that can't regulate the voltage and in any case would add an extra voltage drop. When voltage is to low, you have a risk that Arduino misfunction when it is a 16 mhz model.

The same logic can apply for GPS. Still GPS normally has a 3.3 voltage regulator instead of a 5 volt.
As you said, connecting GPS to raw has the advantage to avoid extra load on Arduino voltage regulator.
Still, if you use a high voltage battery (e.g. 2S lipo), it could be that the GPS has to be connected on Arduino Vcc (which should be regulated on 5 volt) because GPS volage regulator does not always support an input voltage above 6 volt. Please check the specification of your model.
kcaldwel wrote:Hi,
flarssen connects his GPS to TX0 (Grn), and RXI. If I understand correctly, here it is connected to RXI, and P6 through a 10k resistor (Grn). Is this just a difference in where the firmware is sending the signals?
Kevin
When oXs start up, it sent some data to the GPS in order to force some config. I decided to implement a software UART to send the data to the GPS.
In this way, I can still use the hardware UART (TX0) to send debug information to the PC terminal (via FTDI and USB).
In order to get data from GPS I use hardware UART (RX1) because oXS has already many other task to execute and it was not possible to implement a reliable software UART. This is not an issue for debugging because when debuging, Pc normally do not send data to Arduino and so RX1 is free.

kcaldwel wrote:Hi,
If I am using the set-up shown above, can I add a feed through for other SPort sensors? flarssen shows his connected to Gnd, VCC (in and out), and the signal wire to P12 through a 56.2k Ohm resistor. The SPort connection here is Gnd, RAW, and P4. Can I connect a feed though SPort connection to these same pins?
Kevin
With oXS too, you can connect other sensor on the SPORT bus. So connect Gnd, Vcc (or raw) and signal () Arduino P4) from all sensors toegether.
Just take care to avoid that 2 sensors have the same sensor id. If needed, you can change the sensor ID of oXs in the config.h file.
Please note that when GPS is installed in oXs, oXs uses 2 sensor ID; one for all data except GPS (this is the value in the config.h) and one for the GPS data; Currently the GPS sensor Id is hardcoded and is the value normally used by Frsky for his GPS sensor.
kcaldwel
Posts: 40
Joined: Wed Mar 12, 2014 7:49 pm
Country: Canada

Re: GPS sensor

Post by kcaldwel »

Thanks so much for all the help!

Can I add a 3 pin SPort connection sort of like flarssen did in the photo below, except the signal wire from P4 and the voltage from RAW, using the Gnd, A6, and A7 lands as mounting points (Mini Pro 16MHz)? Or are A6 or A7 used for voltage sensing as it seems to be in Carbo's layout above, and I should just run two SPort pigtails to the same points?

flarssen also uses a 5.6kOhm resistor that is supposed to drop the 5V on the Arduino to 3.3V for the SPORT signal level - but that doesn't seem to be done on the OXS vario instructions, or on Carbo's system above. I don't want to smoke my Rx or my Arduino, and really don't know what I'm doing!

It seems people sometimes use the various pin-outs just to mount connectors, and I don't understand how that works if they are analog or digital in/out pins?

I'm not too interested in the IMU right now, and would just like a higher rate GPS and the vario. Nigel has given me an older version of your code that just had that working without the IMU.

Thanks again!
SPort.JPG
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

The resistor is a good idea, flarrison told me he scoped the RX pin with resistor and levels were 3.3v ..
The frsky RX are 5v tolerant I was told but problem will occur if you connect another s.port sensor which is not 5v tolerant if you don't use resistor.
Another option is to power the arduino with 3.3v but then you defo need to connect to vcc and not raw.
I was warey of using other pins and prefers to just connect to only the pins I am using, this also leaves those pins free if you want to add voltage sensors etc to the arduino, but I guess if you are not going to use those pins and you make sure in the config file that those other pins are not defined as anything other then inputs it should be OK? But you could make a short extension to the connector with another set of pins or y lead or something similar.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

I think that Carbo uses A6/A7 to measure voltages.
It happens that some users put pin headers on Arduino in order to easily connect/disconnect external sensor (e.g. a current sensor).

You can use the latest version of openXsensor in the branch openXsensor_imu. If you do not connect a imu, you just have to disable it in the config.h.
If you want to get 10 hz from GPS, you have to activate this line (removing the //) in oXs_GPS.cpp
// 0xB5,0x62,0x06,0x08,0x06,0x00,0x64,0x00,0x01,0x00,0x01,0x00,0x7A,0x12, // NAV-RATE for 10 hz
and put the line above (foreseen for 5 hz) as comment (adding // in front)

In addition to nigelsheffield comments I can say that you have to avoid connecting more than arduino Vcc to a pin.
So, if you power your Rx with a battery that can exceed 5volt, do not connect Rx Vcc to an Arduino pin (like A6, A7)
If you power your Arduino with 3.3 volt directly on arduino Vcc (using e.g. an external voltage regulator) do not apply a voltage that exceed 3.3 volt.
If you really want to use the pin for a totaly another purpose (e.g. a pin header) , you can try to cut the wire between the pin and the avr328p (MCU). Then you can apply any voltage.
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

I got an error when Itried toI compiled the IMU code yesterday?
I am using older arduino suit still, should I be on newer version now?
Actually thinking about it I may have some IMU code in my library folder from when I fptried to get flarrison code , I will remove those folders and try again.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

I do not think having some imu code in library folder would have an impact.
I suggest using a newer version of arduino IDE.
I am on 1.6.5.
It uses another version of the compiler I think.
I use the option -Os of compiler in order to reduce size of flash memory because for some combination in config I reach the limit of AVR328p.

If you still have an issue, send me your config.h file, so I can try to reproduce.
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

ok i am updating it now.

this was report anyway. this was just from downloading the imu openxsensor from github with no changes made by me.


This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328"
oXs_gps.cpp: In member function 'bool OXS_GPS::UBLOX_parse_gps()':
oXs_gps.cpp:295: error: 'cosf' was not declared in this scope
oXs_gps.cpp:300: error: 'sqrtf' was not declared in this scope
oXs_gps.cpp:304: error: 'atan2f' was not declared in this scope
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: GPS sensor

Post by mstrens »

cosf, atan2f are trigonometric functions for float
sqrtf perform the square root on a float.
Those functions should be available in some library (probably with ARM GCC compiler).
I do no remember form wher I got them (perhpas with Arduino IDE)
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

ok tested with new arduino ide,
it uploads now.
altitude does not always work first time and i need to uplug and plug back in then it works.

i connected pin 2 of arduino pro min to INTA on gy-86.

altitude seems more responsive then with just the gy-63, and no problems i can see with other movements.

there is no v.speed?
nigelsheffield
Posts: 308
Joined: Fri Nov 08, 2013 9:56 pm
Country: -

Re: GPS sensor

Post by nigelsheffield »

ok i see there are other readings on T1 T2 and accy which are moving with the sensor.
at least i know my sensor is working now ..
thanks again.

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”