Logic Machine Forum
GPS for LM-IoT-Edge - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: GPS for LM-IoT-Edge (/showthread.php?tid=4173)



GPS for LM-IoT-Edge - hummelsystemhaus - 03.08.2022

Hey,

I want to read the current GPS position from the GPS antenna that is attached to the controller.
How do i install the necessary gpsd package, it doesn't work with opkg.


RE: GPS for LM-IoT-Edge - admin - 04.08.2022

The only solution at this moment is to read the data using Lua serial library and then parse it. This library can be used for parsing: https://github.com/1nv1/luaGPS


RE: GPS for LM-IoT-Edge - hummelsystemhaus - 04.08.2022

(04.08.2022, 06:53)admin Wrote: The only solution at this moment is to read the data using Lua serial library and then parse it. This library can be used for parsing: https://github.com/1nv1/luaGPS

And how do i read from the device? A quick test with:
Code:
require('serial')
port, err = serial.open('/dev/ttyUSB1')
log(port, err)
-- script will wait for 10 characters for 20 seconds
data, err = port:read(10, 20)
log(data, err)
Only gave me this output:
Code:
test 04.08.2022 16:41:51
* arg: 1
  * luaserial
* arg: 2
  * nil
test 04.08.2022 16:42:11
* arg: 1
  * nil
* arg: 2
  * string: timeout



RE: GPS for LM-IoT-Edge - admin - 04.08.2022

You need to start GPS by sending AT+CGPS=1\r\n to /dev/ttyUSB2. This has to be done on every system boot. You can also try sending AT+CGPSAUTO=1\r\n to enable automatic GPS start.