TK 103 data format - gps

I am trying to decode the Hex data sent by the device to my server. I am able parse the latitude , longitude ,speed etc. But what I am unable to decode is the 'state' information. I believe they represent the state of the vehicle e.g. oil and electricity, ignition on/off etc.
I cant find any document which can guide me as to how to decode the 8 bits of state and what each bit represents.
Any help or documentation for the same will be appreciated.

This is what I have been able to find out.
8 bits of IO:
First bit represents Power : 0 indicating on, 1 indicating off
Second bit represents Ignition status: 1 indicating ACC on, 0 indicating ACC off.
Other reservations.
Source: http://www.traccar.org/docs/protocol.jsp

Probably state is related to Valid / Invalid position.
Try it out, by comparing the value when having GPS free view to sky, and without (disabel Antenna, shield with metall paper trash bin or metall foil.

If this may help, I just release a new server base on a jison grammar to make protocol easier to implement. https://www.npmjs.org/package/gpsdtracking

Related

Bsd correction possible?

I am looking at using the BSD checksum described here at wiki BSD does anyone know if you can use it for basic error correction?
Consider an 8 bit or 16 bit left rotating checksum where all the message bytes are supposed to be zero, but one them has a single bit error. The checksum will detect the error, but you'd get the same checksum for message[0] = 0x01, or message[1] = 0x02, ... , or message[7] = 0x80. The checksum can't determine which of these 8 (or more) possible error cases occurred, so it can't be used for error correction.
You'd need at least something like a Hamming code, BCH code or RS code to be able to correct one more bit errors. Since you have CRC as a tag, a single bit correcting binary BCH code is essentially the same as a CRC using a "primitive" polynomial that is the basis for a finite field, if the message length (including the CRC) is shorter than the number of possible values in the finite field. For example, a 15 bit message would have 11 data bits and 4 "parity" bits, based on a finite field of GF(2^4) (GF(16)).

Gps nmea output getting valid $GPGSV but not valid $GPGGA $GPRMC

I'm trying to parse gps nmea output from a modem connected to serial port of a cubietruck board (ARM® Cortex™-A7 Dual-Core). The configuration is done succesfully I get 4g network form modem but when I try to see nmea outout of the gps module, I get the following :
$GPRMC,,V,,,,,,,,,,N*53
$GPGSV,2,1,08,07,49.9,43.6,28.2,28,49.9,158.9,29.2,02,3.5,239.1,,05,49.9,286.9,E
$GPGSV,2,2,08,06,,,,08,9.8,68.9,,09,31.6,104.1,,13,20.4,299.5,,1*5E
$GNGNS,112218.9,,,,,NNN,,,,,,*03
$GPVTG,,T,,M,,N,,K,N*2C
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GNGSA,A,1,,,,,,,,,,,,,,,*00
$GPGGA,,,,,,0,,,,,,,,*66
$GPRMC,,V,,,,,,,,,,N*53
$GPGSV,2,1,08,07,49.9,43.6,27.9,28,49.9,158.9,29.7,02,3.5,239.1,,05,49.9,286.9,F
$GPGSV,2,2,08,06,,,,08,9.8,68.9,,09,31.6,104.1,,13,20.4,299.5,,1*5E
$GNGNS,112219.9,,,,,NNN,,,,,,*02
Looking in http://aprs.gids.nl/nmea/ I found that $GPGSV is GPS Satellites in view. So what I understand is that I get 2 satellites. Is this perhaps the case that I don't get valid $GPGGA $GPRMC or should I check something else?
You don't have a positional "fix" and therefore get empty values in some of the telegrams. As you probably know, there should be latitude, longitude and other data instead of empty values between the commas. Two satellites are not enough to get a fix, you need at least 3 or 4 to get the position.
The NMEA 0183 standard is weakly defined and doesn't mention what GPS units should do when they don't have a positional fix. Sending empty values is pretty common, but some units might act differently. You can easily tell whether the data is valid or not from the A and V letters. V means void and A means active. In the RMC telegram, you can see a V, meaning the entire thing is void.
The reason you get values in the GSV telegrams is because the GPS is able to see two satellites and therefore calculate the values needed in the telegram.
The third field, 08, is the theoretical number of satellites you would be able to see in good conditions.
So what you have to do is to take the GPS outdoors or connect it to a proper antenna. It will start sending proper values when it's able to see the satellites.
Actually by your two GPGSV sentences you can see 08 satellites - eight of them. You have 2 'sentences' of GSV 2,1,08 means 1 of 2 sentences describing 08 satellites, and 2,2,08 means 2 of 2 sentences describing 08 satellites

74LS148 circuit output remains constant regardless to input

I am trying to get to get familiar with working with a 74LS148 Priority Encoder IC. I am providing a 5 Volt constant current voltage source to the IC and have a 0 Volt ground Voltage. I tried connecting every input to the 5 Volt source to set it on a HIGH logic state, which should give, according to the truth table, HIGH in the output. Then tried setting some inputs to LOW, but that had no effect in the output which remained in a HIGH state.
I then tried using pull up resistors, the use and circuit configuration of which is not entirely clear to me, which I think is the problem. I connected the resistors as shown in the picture below, which should give a HIGH state in the output. I then tried connecting some inputs, along with their resistors, to the Ground. The output still remained on a HIGH state, around 4.3 Volts.
I repeated the entire process with another 74LS148 IC to make sure the first one was working.
I'd could really use a little help. Thank you all!
74LS148 has the following truth table:
EI (pin-5) must low (connect to ground)
The enable E1 must be ground. you also your diagram indicates inputs 0 through 7 are pulled high. This will always produce your outputs to be HIGH
I think you should include a bleeder resistor at output to draw some constant current. This will help regulator function as desired.

Trying to understand nbits value from stratum protocol

I'm looking at the stratum protocol and I'm having a problem with the nbits value of the mining.notify method. I have trouble calculating it, I assume it's the currency difficulty.
I pull a notify from a dogecoin pool and it returned 1b3cc366 and at the time the difficulty was 1078.52975077.
I'm assuming here that 1b3cc366 should give me 1078.52975077 when converted. But I can't seem to do the conversion right.
I've looked here, here and also tried the .NET function BitConverter.Int64BitsToDouble.
Can someone help me understand what the nbits value signify?
You are right, nbits is current network difficulty.
Difficulty encoding is throughly described here.
Hexadecimal representation like 0x1b3cc366 consists of two parts:
0x1b -- number of bytes in a target
0x3cc366 -- target prefix
This means that valid hash should be less than 0x3cc366000000000000000000000000000000000000000000000000 (it is exactly 0x1b = 27 bytes long).
Floating point representation of difficulty shows how much current target is harder than the one used in the genesis block.
Satoshi decided to use 0x1d00ffff as a difficulty for the genesis block, so the target was
0x00ffff0000000000000000000000000000000000000000000000000000.
And 1078.52975077 is how much current target is greater than the initial one:
$ echo 'ibase=16;FFFF0000000000000000000000000000000000000000000000000000 / 3CC366000000000000000000000000000000000000000000000000' | bc -l
1078.52975077482646448605

Is this GPGSV sentence valid?

While parsing the NMEA output of a GPS receiver I get the following lines:
$GPGSV,4,1,16,02,17,228,35,03,04,048,37,05,59,285,29,06,02,030,34*73
$GPGSV,4,2,16,07,58,061,46,08,80,159,40,09,11,227,32,10,51,167,47*77
$GPGSV,4,3,16,13,15,089,38,15,00,279,,16,00,018,,26,34,279,42*7A
$GPGSV,4,4,16,28,20,154,39*4C
As I understand it, from various sources on the web (e.g. here), this is wrong. According to the 3rd number, there should be 16 satellites, which was true for all those GPS receivers I previously encountered, but the sentence from this one only contains the data for 13 satellites.
Is this an error? Or do I read the specification wrongly?
Nmea is a weakly specified file format. GPS chip manufactures provide documenttaion how they interpret the NMEA specification.
For example ublox and Sirf each have a chapter of about 40 pages describing how to interpret the NMEA format.
So if you write " Or do I read the specification wrongly?", then the question is which specification you are reading. That of the GPS chip manufacturer? The NMEA 0183 spec does not contain enough info to correctly parse the sentences.
Especially in your case: the NMEA protocol does not desribe how to handle empty values vs invalid ones.
In your case the receiver theretically expects to see 16 satellites, but found only 13.
I would expect that the missing 3 sats would have empty ",,,,,,,,". But obviously the manufacturer decided to just stop and append the checksum string. (Its simply not speciefied that it is mandatory to print out empty semicolons for the missing 3 sats.
Unfortunaetly you have to expect to write a NMEA parser for each CHPS chip manufacturer.
Therfore I always recommend to use the binary format of the Chip manufactureres protocol. (e,.g uBlox bianry or Sirf binary because these are exactly specified).
You can further look at the docu for GpsBable: they show how different manufacturres produce different GSV data sets.
Update:
As you now told that it is a ublox receiver:
The answer is, yes the NMEA sentences are valid. Look at the ublox protocol spec. i use spec for ublox 5:
On page where the GSV sentence is described look at the "Message Structure":
{,sv,elv,az,cno}*cs
the curly braces enclose the sequence that is repeated.
And below look at "1..4": this means 1,2,3 or 4 blocks. There is not written "4", its "1..4" therefore satelite info is optional, and has not to be empty.
If you further look at the example ublox gives, then you see, that the last GPGSV message contains less than 4 satellites, exactly as you are showing in your question.
Yes, it's inconsistent; the last message should have described more than one satellite (four, actually) so as to total the 16 advertised. The GPS receiver should have reported at least the satellite IDs (PRN), even if their viewing direction in the sky and SNR were unknown at the time, e.g.: {,01,,,}.
That being said, it's better to write programs tolerant against ill-formed messages; in this case, updating the number of satellites in view to 13, as counted.
(I've checked the checksums and they're okay.)