Maker Pro
Maker Pro

GPS NMEA, Failover Circuit upgrade attempt.

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
Dear friends,
About 3 years ago i came up with the idea of creating a circuit that would be used as a safety feature in a computer that requires GPS at all times (the reason for that is not important now).

At that time Chris provided me with a very simple but yet very reliable LM555 circuit that monitors No1 GPS output and in case of signal absence it would flip the computers input to No2 GPS output through a relay array.

https://www.electronicspoint.com/threads/help-with-data-switch.259040/

the protocols involved here are RS-232 or RS-422 at baud rate 4.800.

I noticed that the receivers on their internal screen indicate an error estimation and it was then that i started thinking how to upgrade the above circuit in order to make it monitor not only the signal presence but also siglan quality.

I know that the GPS receivers use NMEA sentences. Each NMEA sentence provides different information. So the error estimation must have something to do with the receiver utilising some NMEA sentence to calculate error [DOP (dilution of precision)].

After googling for NMEA sentence error calculation i came up with this :
http://www.gpsinformation.org/dale/nmea.htm

GSA - GPS DOP and active satellites. This sentence provides details on the nature of the fix. It includes the numbers of the satellites being used in the current solution and the DOP. DOP (dilution of precision) is an indication of the effect of satellite geometry on the accuracy of the fix. It is a unitless number where smaller is better. For 3D fixes using 4 satellites a 1.0 would be considered to be a perfect number, however for overdetermined solutions it is possible to see numbers below 1.0.

Finally i am thinking if it would be possible to replace the 555 circuit with an other one powered by a Picaxe microcontroller and a program that would read nmea data from the inputs and determine which is better to bo fed to the output.

I am completly ignorant as far as programming is concerned but i am willing to study (at least picaxe).

Do you think it may be possible to complete this project ?

I am really open to suggestions.

Thank you.
 
Last edited:

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
Ok so the GPS output is TTL level. That is what the Oscope picture tells me.
 

Attachments

  • GPS OUTPUT.PNG
    GPS OUTPUT.PNG
    9.1 KB · Views: 162

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
Here is the Hypertermilan log of the GPS output.
 

Attachments

  • GPS OUTPUT LOG 1.txt
    16.9 KB · Views: 220
  • GPS OUTPUT LOG 2.txt
    16.6 KB · Views: 203

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
GPS transmits NMEA sentence's packs and pauses for about a second between each sentence pack. The packs are being transmitted as follows
(GSA, GSV, RMB, RMC, VTG, GGA, GLL)

This is the first NMEA sentence's pack in the log.

$GPGSA,A,3,12,06,29,24,,,,,,,,,3.14,1.76,2.60*08
$GPGSV,3,1,09,25,60,329,,12,60,057,39,29,51,247,28,02,48,079,42*74 $GPRMB,A,,,,WP001 ,3811.181,N,02140.236,E,88.60,279.2,,V*57 $GPRMC,133212.00,A,3757.912,N,02331.187,E,0.030,,2
$GPVTG,,T,,M,0.03,N,0.06,K*4B
$GPGGA,133213.00,3757.912,N,02331.186,E,1,03,,18.70,M,-35.2,M,,*67 $GPGLL,3757.912,N,02331.186,E,133213.00,A*05
$GPRMB,A,,,,WP001 ,3811.181,N,02140.236,E,88.60,279.2,,V*57
$GPRMC,133213.00,A,3757.912,N,02331.186,E,0.072,,200516,3.0,E*71
$GPVTG,,T,,M,0.07,N,0.13,K*4B
$GPGGA,133215.00,3757.912,N,02331.186,E,1,04,1.762,18.76,M,-35.2,M,,*4C
$GPGLL,3757.912,N,02331.186,E,133215.00,A*03

GSA appears to be in correct format while DPO is 3.14
 
Last edited:

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
Here in the following pack GSA does not look ok.

$GPGSA,A,2,12,29,24,,,,,,,,,,,,*13
$GPGSV,3,2,09,24,35,162,45,14,21,281,,32,18,273,,06,15,041,26*75
$GPRMB,A,,,,WP001 ,3811.181,N,02140.236,E,88.60,279.2,,V*57
$GPRMC,133213.00,A,3757.912,N,02331.186,E,0.072,,200516,3.0,E*71
$GPVTG,,T,,M,0.07,N,0.13,K*4B
$GPGGA,133215.00,3757.912,N,02331.186,E,1,04,1.762,18.76,M,-35.2,M,,*4C
$GPGLL,3757.912,N,02331.186,E,133215.00,A*03

DOP does not appear in the line.

That could be due to bad signal reception (rainy day)
 

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
I use the 14m2 chip but i can buy a better model if needed.
 

Attachments

  • pinout14m2.jpg
    pinout14m2.jpg
    46.1 KB · Views: 783

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
I fear that in order to create a stable system the program will have to be very complicated.
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
The most difficult part would be programming the picaxe chip to read NMEA data using Serial In. But settings up the conditions to switch the relays would be simple.

This is what I imagine your circuit to look like from what I've read:

PICAXE.png

Relay 1 is used to switch between reading GPS #1 and #2 serial inputs. The picaxe reads the nmea data. Depending upon the conditions Relay 2 switches the desired GPS output to the PC. If neither GPS is activate the picaxe sounds the buzzer.

Have you tried writing any picaxe code?
 
Last edited:

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
Not so far because my project board for the picaxe is not ready. let me think about your circuit a bit though.
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
This guy has written a pdf that shows how you can use the 'Serin' command to obtain a sample of nmea data. The $GPGGA qualifier is used, so the program only samples that specific nmea sentence. In your case this would be '$GPGSA'.

The bits (b0) is used to skip the comma character you don't need, then (b1-b10) samples the data.
Program.png


The problem with this method is it doesn't work when there are blanks in the nmea sentence. Only one of the GPGSA sentences in your first log is complete, as shown below. So you may have to use another method to sample the data. Unless the GPS was still booting up and was still looking for satellites.

(My mistake thats a GPGGA sentence I havent deleted:rolleyes:)

GPS_Output_1.png
 

Attachments

  • upload_2016-5-23_13-33-33.png
    upload_2016-5-23_13-33-33.png
    187 KB · Views: 163
Last edited:

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Not so far because my project board for the picaxe is not ready. let me think about your circuit a bit though.

Okay, I've never written picaxe code so learning as i go to help you.

According to a few things I've read, you dont have to use the Serial Input pin to read serial. You can use any pin.

So it may be a case of just connecting both GPS #1 and GPS 2# data to there own picaxe pins.
 

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
I will play more with the PGS and log it's output and post it here. maybe then we will be able to figure out something.

i was wondering if we can skip the input relay and just use C.5 and B.1 as serial inputs. then b.5 as output to the relay that will control which PGS will be fed to the Computer.

I am not sure what (hserin) stands for so i dont know for sure if it is possible.
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Okay, then its just where you want your buzzer. I'm not sure what hserin is used for :confused:


PICAXE.png
 

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
I am not sure what (hserin) stands for so i dont know for sure if it is possible.

It seems 'hserin' stands for hardware serial in. It uses the designated serial in port and the integrated hardware to read the serial communication.

Whereas 'serin' is software based and does not use hardware to read the serial communcation. Which means we can use any pin. I imagine the 'serin' function has been simplified and there's a lot of ready made code behind it.
 

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
So Picaxe has to be getting a sample of both GPS inputs then process the data and determine the output state.

Maybe if we program it to wait for nmea sentence GSA, read it and then flip the input relay and again wait untill GSA comes up then read again, compare the two values and then flip the output relay accordingly.

something like that.

I feel that such program will just be too complicated to make plus there are many "x" factors that we will have to consider to make a reliable software "bug free".
 

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
More logs right here.
 

Attachments

  • GPS LOG 3.txt
    16.6 KB · Views: 218
  • GPS LOG 4.txt
    19 KB · Views: 227
  • GPS LOG 5.txt
    4.1 KB · Views: 206
  • GPS NO SIGNAL.txt
    23.2 KB · Views: 183

Sadlercomfort

Ash
Feb 9, 2013
424
Joined
Feb 9, 2013
Messages
424
Those GPS logs look very consistent, which means we can use the method I described earlier to extract the DOP from the nmea sentence.



The conditionals of a program are very straightforward to setup and are reliable since its just logic and if statements. Parsing the data from the nmea sentence is likely to be the most buggy, but once we get it right it stays that way.

I'll help you tomorrow, when I'm at my desk :)
 

HellasTechn

Apr 14, 2013
1,579
Joined
Apr 14, 2013
Messages
1,579
I really need to learn programming.... :) at least Picaxe.

But can an old dog teach himself new tricks ?
 
Top