New to openXsensor - GPS and smartport question

Development & General Chat for the superb openxvario project.

Moderator: rainer

twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

New to openXsensor - GPS and smartport question

Post by twincam1449 »

I'm new to openXsensor and just got my Arduino Pro Mini 5V 16Mhz working for RPM telemetrie only.

Two questions:
1) Do I need a 5.6k resistor between the smartport wire (going to the RX) and the PIN 4 on the Arduino.
I get conflicting information.

I use the 5V 16Mhz Arduino.
Arduino is powered by 2s lipo at RAW pin

2) I like to add a GPS also.
NEO 6, 7 or 8.
I read somewhere to use the Neo M8N.
Also there I read conflicting information whether or not the M8N can be powered by the VCC pin of the Arduino.
Some say it's rated up to 3.6 volt. Other websites say up to 5,5V

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

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

I never used a resistor on the wire between Sport RX and arduino.
Still I expect that using one could not be bad.

oXs supports neo 6, 7 and 8.
Most of those GPS are build on a pcb module that have a voltage regulator to deliver the 3.3 volt to the gps chip.
I think that, on many gps module, the voltage regulator are foreseen for max 5.5 volt at the input side.
If you connect the gps module to the Arduino VCC, it will probably work but perhaps the voltage regulator on the arduino board will overheat (to be tested).
Connecting the gps module to arduino RAW pin should be bad because 2S lipo voltage exceed the input voltage of most gps module.
So in this case, I usually use a separate 5v voltage regulator with the input connected to 2S lipo and the output to the VCC GPS module.
I also use a resistor (or a voltage divider) on the wire to the GPS RX pin to protect the gps pin from the 5 volt coming from arduino signal.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

Any one who bought a working M8N GPS from alieexpress?
I'd like to have a link of a version that is known to work properly

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

Re: RE: Re: New to openXsensor - GPS and smartport question

Post by jhsa »


mstrens wrote:I never used a resistor on the wire between Sport RX and arduino.
Still I expect that using one could not be bad.
I think you should. Even if the receiver's processor can tolerate the 5V signal from the arduino, it might not be good in a long term.
I do use a voltage divider between the oXs and all my receiver's telemetey input.
Not using any kind of protection is asking for trouble.
My parents can confirm that, but for different reasons ;) :mrgreen:

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: New to openXsensor - GPS and smartport question

Post by mstrens »

Here a link to a module that works for me.
https://www.befr.ebay.be/itm/New-Ublox- ... 2749.l2649

It is a neo 7 but you can easily find similar pcb module with neo8

twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

As mentioned here viewtopic.php?f=86&t=10691, I received my M8N (fake?) GPS module.
I connected it to u-center and it gets a fix position.

Unfortunately I can't get openxsensor to send the GPS telemetry to the FrSky smartport.
The arduino 5v 16M is programmed. I also added a RPM sensor to the sketch and while discoering it does discover the RPM
But it does not discover the GPS data.

ucenter (UBX-CFG-RATE) = 1 Hz

So I made following change to oxs_config_advanced:

**
// --------- 9 - GPS ------------------------------------------------------------------------------------------------
#define GPS_SPEED_IN_KMH // uncomment this line if GPS speed has to be sent in km/h instead of knot/h (only for Frsky protocol)
//#define GPS_SPEED_3D // uncomment this line if GPS speed has to be the 3d speed instead of the 2d speed (note: 3d is probably less accurate - to test)
#define GPS_REFRESH_RATE 1 // rate at which GPS sent new data; select between 1, 5 or 10 (Hz). Default = 5 Hz; Ublox NEO6 does not support 10 hz
**

double checked wiring:
Smartport GND -> GND
Smartport VCC -> RAW
Smartport SIGN -> 4 with 5.6k resistor

GPS GND -> GND
GPS RX -> PIN 6 with 10k resistor
GPS TX -> RXI
GPS VCC -> VCC

GPS gets a fix when connected to smartport, the green led on the gps module is blinking

What am I doing wrong.

I attached the full sketch
Attachments
openXsensor.zip
(331.47 KiB) Downloaded 379 times
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

At startup, oXs has to send some gps commands to the GPS module in order to ask for some specific messages being send to oXs.
Only those specific messages will be handled by oXs.
As long as oXs does not get a valid message from the module (so it requires both a fix and the speficic messages) it does not send GPS data to the TX (and so the sensor is not discovered by the Tx).

In order to get and process the commands sent by oXs at power on, the GPS module must be configured in such a way that, at power on, the GPS uploads the standard ublox configuration. This standard config uses e.g. a speed of 9600 baud and some NEMA messages.

Some GPS module are able to store a different (non default) config in an external eeprom.
Perhaps that you module has such a config. So if e.g. the GPS baud rate is different from 9600, it will not recognise the commands sent by oXs.

Using Ucenter program (free) from Ublox, I expect that you should be able to find the config of your module at power on and to change it to the default Ublox config.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

mstrens wrote: Tue Dec 12, 2017 4:32 pm Perhaps that you module has such a config. So if e.g. the GPS baud rate is different from 9600, it will not recognise the commands sent by oXs.

Using Ucenter program (free) from Ublox, I expect that you should be able to find the config of your module at power on and to change it to the default Ublox config.
U center baudrate is set at 9600.

Do you have some info what other settings to look for and what it needs to be?
Attachments
Schermafdruk 2017-12-12 21.45.32.png
Schermafdruk 2017-12-12 21.45.32.png (6.27 KiB) Viewed 21816 times
Schermafdruk 2017-12-12 21.45.44.png
Schermafdruk 2017-12-12 21.45.44.png (3.29 KiB) Viewed 21816 times
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

I think that 9600 bauds is the main parameter.

Perhaps we can try to debug the messages sent by the gps (if any).
In the file oXs_gps.cpp you have some lines with
#ifdef DEBUG
//#define DEBUGGPS
#define DEBUGPARSEGPS
//#define DEBUGSENDGPS
//#define DEBUG_FORWARD_GPS_MSG_TO_PC
#endif

You can change them in
#ifdef DEBUG
//#define DEBUGGPS
//#define DEBUGPARSEGPS
//#define DEBUGSENDGPS
#define DEBUG_FORWARD_GPS_MSG_TO_PC
#endif

Then in file oXs_config_advanced.h, there is a line with
//#define DEBUG

It should be changed to
#define DEBUG

Then you upload the program to Arduino (disconnecting the GPS to allows the update).
Then you do not have to connect the arduino to the receiver but you reconnect the GPS and to the FTDI.
You connect the FTDI to your pc and you open a terminal session on the pc (pressing CTRL + M in arduino IDE).
Take care to put the baudrate of the terminal session to 38200.

Normally oXs should send to the Ppc terminal some text and the beginning and afterward, there should be one line for each message (frame) sent by the GPS. Each line should contain the codes (in hexadecimal) received by oXs, each code being separated by a comma.

Can you try and say me if you get messages on the pc.
If so you can post a few of them so I can analyse them.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

I think you mean CTRL+SHIFT+M?

This is what is displayed:
openXsensor starting..
milli=0
freeRam=523
Enter setup voltage
Reference voltage:1100
Voltage:1 , pin=6 , offset=0 , mVoltPerStep=17.92
Voltage:2 , pin=8 , offset=0 , mVoltPerStep=2.01
Voltage:3 , pin=8 , offset=0 , mVoltPerStep=3.44
Voltage:4 , pin=8 , offset=0 , mVoltPerStep=3.98
Voltage:5 , pin=8 , offset=0 , mVoltPerStep=1.08
Voltage:6 , pin=8 , offset=0 , mVoltPerStep=3.88
vario setting up..
vario is up..
End of GPS setup
FRSky Output Module: TX Pin=4
Sport protocol= 1
End of general set up
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

If there is no message after "End of general set up", it seams that oXs does not get data from GPS module.
Did you wait up long enough to let the GPS get a fix. It could be that GPS does not send messages when there is no fix (not sure about this)?

We can make 2 more tests:
- one to see if the GPS sent messages when it is not connected to oXs.
For this test, you disconnect FTDI and GPS from arduino. You connect directly GPS to FTDI connecting only Vcc, grnd and RX pin from FTDI to TX pin from GPS. With the Pc terminal at 9600 bauds, you should get some text (readeable) on PC
If this does not work, there is an issue with the GPS module.

- one to see if it sent messages when it is connected to oXs
For this test, you connect arduino to GPS with 3 wires keeping the same program as before (so with GPS code activated): GND to GND , , Vcc to Vcc , arduino pin 6 (+ resistor) to pin RX from GPS
You connect also FTDI to GPS with 3 wires : GND to GND , , Vcc to Vcc , RX pin from FTDI to TX pin from GPS 'just like in first test)
With the Pc terminal at 38200 bauds, you should get some caracters on PC (normally unreadable because it would be binary code and not ascii)
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

The GPS has a fix.
The green GPS light blinks.
I have waited more than 5 minutes after led starts to blink

Test 1) it continually spits out $GNGSA, $GPGSV, $GLGSV, $GNGLL, $GNRMC, $GNVTG code including GPS LAT/LON data
Test 2) lots of unreadable code, see attachment
Attachments
Schermafdruk 2017-12-13 09.51.50.png
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

So test 1 shows that , by default, GPS sent NEMA messages at 9600 bds. This is OK

About test2, I presume that unreadable code continues (and does not stop a few seconds after power on). If so it means that GPS sent also messages after it got the command from oXs.
At this stage (in test 2), we still do not know if the GPS messages are in the format expected by oXs.

I propose you to try a test 3:
Just use the same configuration as in test 2 but put your PC terminal session in 9600 bauds instead of 38400.
If the pc terminal shows readable text (in fact the same as in test 1) it means that the GPS is still in his default config and did not handle the commands sent by oXs to force special messages/baudrate.
If the pc terminal shows unreadable code, it means that GPS receives the commands from oXs and changes the type of messages and the baudrate.

Depending on the result, we can further investigate.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

Yes, the unreadable code continues. Does not stop.
I tried all the different baudrates. Same unreadable symbols.

See attachment in 9600
Attachments
Schermafdruk 2017-12-13 10.52.56.png
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

More info screens from u-center about NMEA and port settings
Attachments
Schermafdruk 2017-12-13 10.59.07.png
Schermafdruk 2017-12-13 10.59.51.png
Schermafdruk 2017-12-13 10.59.57.png
Schermafdruk 2017-12-13 11.01.18.png
Schermafdruk 2017-12-13 11.01.18.png (6.34 KiB) Viewed 21796 times
Schermafdruk 2017-12-13 11.01.45.png
Schermafdruk 2017-12-13 11.01.45.png (8.07 KiB) Viewed 21796 times
Schermafdruk 2017-12-13 11.01.50.png
Schermafdruk 2017-12-13 11.01.50.png (8.06 KiB) Viewed 21796 times
Schermafdruk 2017-12-13 11.01.55.png
Schermafdruk 2017-12-13 11.01.55.png (6.07 KiB) Viewed 21796 times
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

It is very strange.
We know that :
- GPS alone works and sent NEMA messages at 9600bds (OK); those messages are clear text (OK)
- GPS handles commands sent by oXs because when connected to oXs GPS does not sent anymore clear text.

Note: when both FTDI and GPS are connected to Arduino, the RX pin from arduino is connected to FTDI TX and also to GPS TX. There could be some conflict between FTDI and GPS.
So when you try to use oXs and GPS best is to disconnect FTDI or at least to not connect the FTDI TX pin.

Can you make a test 4 with following config.
- as asked previously uncomment this line //#define DEBUG_FORWARD_GPS_MSG_TO_PC ; so removeg the "//" in order to let oXs sent incoming characters from GPS to the Pc in some readable format.
-FTDI connected to arduino (Vcc, gnd, RX from FTDI connected to arduino TX); let FTDI TX unconnected.
- GPS connected to arduino in the normal way (Vcc, Gnd, arduino Rx to GPS Tx, arduino 6 to GPS RX via resistor)
- set pc terminal to 38400 baud;
Normally you should get readlable chars.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

Readable characters. Going on and on. Does not stop

See attachments
Attachments
Schermafdruk 2017-12-13 12.03.58.png
Schermafdruk 2017-12-13 11.58.05.png
Schermafdruk 2017-12-13 12.02.04.png
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

Those are the expected characters.
GPS sent UBLX frame instead of NEMA frame, so GPS has handled the oXs command at start up. OK
Each frame begins with 0xB5 and oXs get the characters and forward them to PC: OK

So normally oXs should work.
I suggest that you
- disconnect GPS
- upload the program again putting #define DEBUG as comment (adding //) in file oXs_config_advance.h
- disconnect FTDI
- connect GPS to arduino and arduino to Receiver.
- power on.
Wait a little (e.g. 1 or 2 min) after GPS led is blinking (I think there are several levels of fix and probably oXs sent to receiver only when there is a "good" fix)

Ps : Which protocol (SPORT, HUB, HOTT,...) do you use?
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

FrSky Smartport

I will try conencting to X8R receiver again late this afternoon
Thank you very much so far!!
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

I could not wait, so connected it all up.
It still only shows the RPM sensor (ID 5) from the Arduino + RSSI and RXBT (ID 25), but does not show any GPS sensors.

So I took a plane in which the GPS sensors (ID 4) were already discovered when using the FrSky GPS v1.
Connected the Arduino. But also only --- where the GPS data should be seen.

While editing this text I suddenly heard sensor lost.
Now I see two GPS sensors: GPS and GAlt (ID 4) including LAT/LON and height value.
But they are red.

This means the sensor worked for a very short period, but was lost again.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

I looked further at the codes displayed on your PC in your previous test (post from 12h04).
The char received by oXs are not 100% correct.
There can be 2 reasons:
a- the voltage level of the signal sent by GPS does not match the level expected by arduino. Your arduino is running at 5 volt and the GPS runs at 3.3 volt (there is a voltage regulator on GPS module to reduce Vcc). Normally arduino can work with this difference but perhaps your arduino not.
b- the signal is decoded based on an expected baudrate 38400) . To analyse the signal, arduino uses his own clock. It could be that the clock of your arduino is not exactly 16 Mhz.


If you have another arduino board, I suggest that you try with another arduino (with the same GPS).

If you do not have another arduino, you can:
- check your soldering/wires between arduino and gps (at least gnd and TX-RX lines)
- keep the wires between gps and arduino short (e.g. 5 or max 10 cm)
- add a 10k resistor (or higher up to 100k) between arduino Vcc (5 volt) and arduino Rx. This can help increasing the HIGH level of signal coming from from GPS.

You can then repeat the test from 12h04 (so activating again the debug) and check if the texts displayed on PC are more consistent (same number of characters on each line begining with the same 4 (or 5?) codes.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

I just made a unit with a new Arduino.
Still the same problem. No GPS sensors found.

I did not add the 10k or 22k resistor yet.
I have 10k and 22k resistor. What is best?

Do I understand correctly that you want me to test this (adding purple resistor ???):
Attachments
GPS arduino pins -add resistor.png
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

Yes you schema is correct.

It is safier to use 22k.
Normally GPS Tx pin is driven by the GPS module between 0 volt (LOW) and 3.3 volt(level HIGH).
It could be (not sure) that your GPS does force the voltage to 3.3 volt when signal should be logical HIGH.
Adding a resistor between Vcc and this pin could help to get a higher voltage.
In worst case, this could put on GPS Tx a voltage exceeding 3.3 volt what is unsafe for the GPS module.
Still, I expect that the GPS has some kind of protection and should not become defect if the current is limited by a resistor with a high value (so better to use 22k).

If this does not work, I can try writing a smal program just for further test purpose.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

still no luck with the extra 22k resistor
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

I will try to morrow to write a program just for testing.
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

okay great .
Thanks again.
I will send you a PM with my emailaddress
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

After a lot of testing Michel found a solution:

We changed following entries in the oXs_config_basic. h
#define FIRST_BARO_SENSOR_USE NO_BARO // select between NO_BARO , MS5611, GY86 , BMP085 , BMP180 , BMP280
#define ARDUINO_MEASURES_VOLTAGES NO

I did not need these sensors to be used. This is a GPS only sensor.

!!Thanks for all the help Michel!!
User avatar
ddano007
Posts: 41
Joined: Thu Nov 13, 2014 8:40 pm
Country: Slovakia
Contact:

Re: New to openXsensor - GPS and smartport question

Post by ddano007 »

Questions to twincam1449:
1, How do you know, that your GPS fix position? I have two LEDs on GPS, green ( blue) blink when GPS send data to OXS ( 10x per second ), red blink when GPS fix position 1x per second. Until GPS has no fix, OXS doesn`t send data do RX.
2, can you give some photos of your oxs + GPS?
3, 22k or 10k resistor ( maybe question to mstrens ): why so high values? Difference between Arduino ( 5V) and GPS (3.3V) is only 1.7V. Normally digital IC has protection diodes to Vcc, GPS has consumption say 50mA, if we use 1k resistor, it will make 1.7mA current via protection diodes to Vcc 3.3V, what is highly bellow 50mA, even though when GPS is off power OXS it will give maximum 5V/ 1k = 5mA. That cannot destroy GPS. Only my opinion, that 10k is too high.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by mstrens »

Normally there is no need for a resistor to Vcc.
It was for testing.
I do not know how much current can go into the diode that (in principe) protect the Tx GPS pin. So 22 k was to be safe.
In fact there was no need for a resistor. The issue was because oXs losts some chars from GPS because it was waiting for a I2C component (that was configured but did not exist).
twincam1449
Posts: 24
Joined: Wed Apr 22, 2015 6:31 pm
Country: -

Re: New to openXsensor - GPS and smartport question

Post by twincam1449 »

1) The GPS has two leds.
One for power one for satellite fix.
When GPS has a good fix, the green LED starts to blink.
oXs does not send data via Smartport before GPS has a good fix

2) I would strongly advice NOT to buy the GPS I have.
I realy think it's counterfeit/fake.
- the QR code does not correspond to M8N (it says M6)
- deviation is bad ( up to 25m)
- seems to be best with 1 Hz only, 5Hz and 10Hz are bad.
- can not update from 2.01 to 3.xx firmware

Maybe @Mstrens can advice for a good genuine M8N GPS.
Does Hobbyking EU have a good genuine M8N that works with oXs?
Is there a (big) difference between M7 and M8? or is a M7 almost as good for us?

3) Already answered by Mstrens

ddano007 wrote: Thu Dec 14, 2017 7:28 pm Questions to twincam1449:
1, How do you know, that your GPS fix position? I have two LEDs on GPS, green ( blue) blink when GPS send data to OXS ( 10x per second ), red blink when GPS fix position 1x per second. Until GPS has no fix, OXS doesn`t send data do RX.
2, can you give some photos of your oxs + GPS?
3, 22k or 10k resistor ( maybe question to mstrens ): why so high values? Difference between Arduino ( 5V) and GPS (3.3V) is only 1.7V. Normally digital IC has protection diodes to Vcc, GPS has consumption say 50mA, if we use 1k resistor, it will make 1.7mA current via protection diodes to Vcc 3.3V, what is highly bellow 50mA, even though when GPS is off power OXS it will give maximum 5V/ 1k = 5mA. That cannot destroy GPS. Only my opinion, that 10k is too high.

Post Reply

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