hello, could someone send me a copy&paste of a decoder for the LGT92 that works.
I tried many things during several days, but I always get a 0 for the longitude.
Firmeware installed is the V 1.6.7
Thank you
Here you go.
//The function is :
function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var latitude=0;//gps latitude,units: °
if(bytes[0] !== 0)
{
latitude=(bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3])/1000000;//gps latitude,units: °
}
else
{
latitude=0;//gps latitude,units: °
}
var longitude = 0;
if(bytes[5] !== 0)
{
longitude=(bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7])/1000000;//gps longitude,units: °
}
else
{
longitude="";//gps longitude,units: °
}
var alarm=(bytes[8] & 0x40)?“TRUE”:“FALSE”;//Alarm status
var batV=(((bytes[8] & 0x3f) <<8) | bytes[9])/1000;//Battery,units:V
if(bytes[10] & 0xC0==0x40)
{
var motion_mode=“Move”;
}
else if(bytes[10] & 0xC0 ==0x80)
{
motion_mode=“Collide”;
}
else if(bytes[10] & 0xC0 ==0xC0)
{
motion_mode=“User”;
}
else
{
motion_mode=“Disable”;
} //mode of motion
var led_updown=(bytes[10] & 0x20)?“ON”:“OFF”;//LED status for position,uplink and downlink
var Firmware = 160+(bytes[10] & 0x1f); // Firmware version; 5 bits
var roll=(bytes[11]<<8 | bytes[12])/100;//roll,units: °
var pitch=(bytes[13]<<8 | bytes[14])/100; //pitch,units: °
var hdop = 0;
if(bytes[15] > 0)
{
hdop =bytes[15]/100; //hdop,units: °
}
else
{
hdop =bytes[15];
}
var altitude =(bytes[16]<<8 | bytes[17]) / 100; //Altitude,units: °
return {
Latitude: latitude,
Longitude: longitude,
Roll: roll,
Pitch:pitch,
BatV:batV,
ALARM_status:alarm,
MD:motion_mode,
LON:led_updown,
FW:Firmware,
HDOP:hdop,
Altitude:altitude,
};
}
Thank you very much for your reply.
Unfortunately I still face the same issue, i.e. no longitude
Any idea what it could be?
],
“received_at”: “2022-01-27T21:26:38.039052124Z”,
“location_solved”: {
“service”: “frm-payload”,
“location”: {
“latitude”: 46.467504,
“altitude”: 492,
“source”: “SOURCE_GPS”
}
}
},
Hello,
I use this one:
/*function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var value=bytes[0]<<16 | bytes[1]<<8 | bytes[2];
if(bytes[0] & 0x80)
{
value |=0xFFFFFF000000;
}
var latitude=value/10000;//gps latitude,units: °
value=bytes[3]<<16 | bytes[4]<<8 | bytes[5];
if(bytes[3] & 0x80)
{
value |=0xFFFFFF000000;
}
var longitude=value/10000;//gps longitude,units: °
var alarm=(bytes[6] & 0x40)?"TRUE":"FALSE";//Alarm status
value=((bytes[6] & 0x3f) <<8) | bytes[7];
var batV=value/1000;//Battery,units:V
value=bytes[8]<<8 | bytes[9];
if(bytes[8] & 0x80)
{
value |=0xFFFF0000;
}
var roll=value/100;//roll,units: °
value=bytes[10]<<8 | bytes[11];
if(bytes[10] & 0x80)
{
value |=0xFFFF0000;
}
var pitch=value/100; //pitch,units: °
return {
Latitude: latitude,
Longitud: longitude,
Roll: roll,
Pitch:pitch,
BatV:batV,
ALARM_status:alarm,
};
}*/
//The function is :
function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var latitude;//gps latitude,units: °
latitude=(bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3])/1000000;//gps latitude,units: °
var longitude;
longitude=(bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7])/1000000;//gps longitude,units: °
var alarm=(bytes[8] & 0x40)?"TRUE":"FALSE";//Alarm status
var batV=(((bytes[8] & 0x3f) <<8) | bytes[9])/1000;//Battery,units:V
if((bytes[10] & 0xC0)==0x40)
{
var motion_mode="Move";
}
else if((bytes[10] & 0xC0) ==0x80)
{
motion_mode="Collide";
}
else if((bytes[10] & 0xC0) ==0xC0)
{
motion_mode="User";
}
else
{
motion_mode="Disable";
} //mode of motion
var led_updown=(bytes[10] & 0x20)?"ON":"OFF";//LED status for position,uplink and downlink
var Firmware = 160+(bytes[10] & 0x1f); // Firmware version; 5 bits
var roll=(bytes[11]<<24>>16 | bytes[12])/100;//roll,units: °
var pitch=(bytes[13]<<24>>16 | bytes[14])/100; //pitch,units: °
var hdop = 0;
if(bytes[15] > 0)
{
hdop =bytes[15]/100; //hdop,units: °
}
else
{
hdop =bytes[15];
}
var altitude =(bytes[16]<<24>>16 | bytes[17]) / 100; //Altitude,units: °
return {
Latitude: latitude,
Longitude: longitude,
Roll: roll,
Pitch:pitch,
BatV:batV,
ALARM_status:alarm,
MD:motion_mode,
LON:led_updown,
FW:Firmware,
HDOP:hdop,
Altitude:altitude,
};
}
The longitude part is different from the other code.
This code is from:
Dragino LGT-92 decoder
@HB9IIU
Do you have a USB to TTL adapter and can you check the output?
regards
ThomasD
Thank you Thomas. Issue solved after supplying the module with 5V via USB instead as of using the supplied 2 x 1.5 V battery holder…
Dear all,
I am new to TTN and I can’t manage to get valid data for latitude and longitude for my LGT92. I only receive “0”. I have tried payload formatters “Repository” and Javascript with the code from MoLaender. All I get is “0”. Just for one time I received the correct value tor latitude, the rest of the time is only zero. If I can trust the FW output, Firmware is 164.
Any idea what I have done wrong?
Regards
Peter
This is what i get at the moment:
"received_at": "2022-02-05T15:28:08.031895546Z",
"uplink_message": {
"session_key_id": "AX7Jl+iq7+TkUgez7zfajw==",
"f_port": 2,
"f_cnt": 44,
"frm_payload": "AAAAAAAAAABPuWQ=",
"decoded_payload": {
"ALARM_status": "TRUE",
"BatV": 4.025,
"FW": 164,
"LON": "ON",
"MD": "Disable",
"Pitch": 0,
"Roll": 0,
"altitude": 0,
"hdop": null,
"latitude": 0,
"longitude": 0
Go outside then switch the device on and leave it there (no motion, no alarm button). Still no GPS information ?
In the user manual 1.67 Draqino mentions : “If you have GPS position fix problem and the device serial number is between LGT92341971 ~ LGT92361311. If the device cannot be located, please set PDOP to 7 to fix it in a short time. The default PDOP of the device is 3.00.”
You need 1.67 for PDOP fix.
This exactly what I have did an hour ago. I went outside, put it on the ground and waited. Since then I get more or less a valid signal for the latitude. Longitude still delivers “0” or both (longitude and latitude) devlier exactly the same value e.g 37.000372, 37.000372. But these values are completly wrong.
The serial number of my device is 92432157, so unfortunately no in the mentioned range
Anyhow, do you have a manual for the update process? Do I need a special hardware for the update.
Thank you for your support!!!
You find AT commands, decoders for different firmware versions, manuals and firmwares here : Index of /downloads/downloads/LGT_92
Update process is described on page 4 of AT command reference. You need an USB-TTL. Those are available in different flavors. I use this one because of the blinking lights : https://www.amazon.de/gp/product/B07BBPX8B8/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1
If you are in a AU915/US915 regions read page 42 paragraph 7.1 of manual version 1.65. Maybe this is your issue.
Try to power the unit via the USB port with a 5V power bank for instance. I read somewhere that the unit will deliver zero’s for lat and lon in case voltage is too low (and this is what I experienced). Connecting the unit to a serial terminal will also allow you to see whats going on inside the device.
Thanks for the hint. I tested it also while the device was connected via USB to my laptop - same behavior
Since yesterday evening it complete stoped sending. After reseting I still get only values for latitude. Battery SOC seems to be ok, it’s bit above 4V.
I have ordered a ST LINK V2 to update the FW, hopefully it is working then.
But thanks your support!
Hello,
a ST LINK V2 is good to have one, in your case I would get a TTL adapter.
So you can see what the LGT-92 is doing and configure him.
If you have an Arduino with USB, you can also use this as a TTL adapter.
reards
ThomasD
Moderator clarification: TTL = Serial adapter, most likely a USB to Serial - see section 3 of the manual: https://www.dragino.com/downloads/downloads/LGT_92/LGT-92_LoRa_GPS_Tracker_UserManual_v1.6.8.pdf#page=33
Hi Thomas,
today I received a ST Link V2 from DSD Tech. I connected the device as mentioned in the tutorial and tried to connect with Putty. All I get is an error.
Then I tried to to update the tracker, but the ST Link V2 has no SWCLK and no SWDIO So updating is not possible at the moment.
Hello,
for PuTTY Connection, you neet the usb-ttl Adapter.
What kind of ST LINK V2 adapter do you have?
Is there a photo or link.
regards
ThomasD
Hi, I followed the explanations I found on the below page, and managed. But you will also need a USB-ttl adapter as mentioned by Thomas to monitor the traffic.
Good luck
Daniel
I used this one:
https://www.amazon.de/gp/product/B07BBPX8B8/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1
Now I see what I’ve done wrong. I thought USB-TTL is the same as ST Link V2 - shame over me
Anyhow I could not get a connection. I downloaded the the D2XX-Driver form ftdichip.com, installerd them. Then connect the Tracker to the USB2TTL and tried to connect with Putty as described in the manual.
Little progress: the connection with putty works - I have entered the wrong COM-Port
Now I could read out some values. Is Image-Version the same as FW-Version? Because in Putty it shows 1.6.7 in the “TTN Live data” I get 164. So I am little confused now. 1.6.7 is already the latest FW I can find on dragino.com
I would only rely on what you see via Putty. Now wait sometime, and you should also see Lat and Lon coming. In the meantime I encourage you to get familiar with the AT commands.
Just a remark, be carefull when posting critical info such as DevEui…
@pewe1835 put it outside with clear view of sky (not in side behind trile glazing ) to accelerate the process…
Thank you guys
Now it is working, I get valid values for lon and lat. It is -5°C at the moment, I will test it outside tomorrow
Do you have any idea why I can’t see the correct values in TTN Live data?