Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 20-02-2017, 06:06   #1
bzs
Registered User

Join Date: Feb 2011
Posts: 38
kplex on Raspberry Pi --howto

Hi All!

I need your help, my friends..

I'm try this kplex-configuration:

# cat /etc/kplex.conf

[serial]
filename=/dev/ttyAMA0
direction=in
baud=9600

[tcp]
mode=server
port=1001
direction=both

...and starting.

My Raspberry Pi is an NMEA multiplexer without opencpn.
The NMEA sentences go my clients, the OCPN settings:
TCP:192.168.12.1:1001
(All systems is lunux system.)

I would like make on raspberry pi an NMEA-logger, but the {gpsd, gpspipe, gpscat} don't working with the kplex, because the /dev/ttyAMA0 is working. I'm try minicom:

minicom -b 9600 -o -D /dev/ttyAMA0 -C /opt/gps.minicom

...and the sentences is demaged:

34343.810,,,M,,MGPGSA,A,,,,,,,,,RMC,1343,,,,,0.000 217,,,PZDA,13420,02,20
34344.810,,,M,,MGPGSA,A,,,,,,,,,RMC,1343,,,,,0.000 217,,,PZDA,13420,02,20,,*41
$345.814,34346.811,,,,,,,00217,,,$GPGGA,14,,,,,0,, ,*43
$1,,,,,,,*1E

(on the clients the opencpn is correct, the NMEA sentences is good!)


Question: what is my problem?
I don't understand...
bzs is offline   Reply With Quote
Old 20-02-2017, 06:32   #2
Registered User

Join Date: Aug 2009
Location: between the devil and the deep blue sea
Boat: a sailing boat
Posts: 20,437
Re: kplex on Raspberry Pi --howto

Why not use a file?

If R3 then some things explained here:

Using the UART – Raspberry Pi Projects

They say (R3): "...

mgarcia0175210 months ago Wanted to update this a how to test. If you are using PI model 3, you need to do 2 things.
1.Do not use /dev/ttyAMA0 this is assign to bluetooth, use /dev/ttyS0.
2.You need to disable serial via the GUI. I did not research how to do this via CLI.
minicom -b 115200 -o -D /dev/ttyS0
sudo chmod a+rw /dev/ttyS0

..."

So I would swap that AMA thing and try ttySo up first.

But for logging I use a file interface, not serial.

b.
barnakiel is offline   Reply With Quote
Old 20-02-2017, 06:42   #3
bzs
Registered User

Join Date: Feb 2011
Posts: 38
Re: kplex on Raspberry Pi --howto

My adafruit GPS on the /dev/ttyAMA0

# ls /dev/tty
tty tty15 tty22 tty3 tty37 tty44 tty51 tty59 tty9
tty0 tty16 tty23 tty30 tty38 tty45 tty52 tty6 ttyAMA0
tty1 tty17 tty24 tty31 tty39 tty46 tty53 tty60 ttyprintk
tty10 tty18 tty25 tty32 tty4 tty47 tty54 tty61
tty11 tty19 tty26 tty33 tty40 tty48 tty55 tty62
tty12 tty2 tty27 tty34 tty41 tty49 tty56 tty63
tty13 tty20 tty28 tty35 tty42 tty5 tty57 tty7
tty14 tty21 tty29 tty36 tty43 tty50 tty58 tty8


My Rpi is model 2 (armv6), and don't use GUI. My system is Arch Linux on RPI.

# ls -l /dev/ttyAMA0
crw-rw---- 1 root uucp 204, 64 Jan 1 1970 /dev/ttyAMA0
bzs is offline   Reply With Quote
Old 20-02-2017, 08:07   #4
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: kplex on Raspberry Pi --howto

openplotter gives you an easy graphical window setup for kplex, plus gives you signalk as well.
Sailing with free hardware | Sailoog

I log mnea using a small bash script called from openplotter to run a rrdtools command. Openplotter lets you call a script using any nmea data as an argument. Works fine, stable so far. Also the newer raspian release has node-red installed which makes all of this so much easier, you could use node-red to take either nmea or signalk data and append it into a file.
Also easy to add some very cheap thermometers to the pi and log those plus beam out as a web page to anything onboard capable of displaying one.

ENgine data from openplotter/node-red


SOG data from RDDTools with a simple web page in php to choose the data/date range to display.



Something for you to play with I hope
conachair is offline   Reply With Quote
Old 20-02-2017, 10:05   #5
Registered User

Join Date: Aug 2009
Location: between the devil and the deep blue sea
Boat: a sailing boat
Posts: 20,437
Re: kplex on Raspberry Pi --howto

Quote:
Originally Posted by bzs View Post
My adafruit GPS on the /dev/ttyAMA0

(...)
So, how about creating another kplex interface now - one of the 'file' type. Make it in and out interface and then read from the resulting file. (?) No do?

So, now you would have three rather than two kplex interfaces defined. (gps@AM0, net, file)

Maybe the read method you are using from the ttyAMA0 is not valid with this style of interface / data?

I think your challenge is wrong choice of methods.

Data read from a ttyUSB and dumped into a file looks normal when read from this file. I have tried this method before.

BTW If your cat tty looks normal, the data is fine (as confirmed by opencpn reading it fine too). Cat tty see what happens.

Let us know how it develops.

I can run some tests later on my hardware here.

If you cannot use a file interface, let us know why not.

b.
barnakiel is offline   Reply With Quote
Old 20-02-2017, 12:32   #6
Registered User

Join Date: Oct 2012
Location: Brighton, UK
Boat: Westerly Oceanlord
Posts: 513
Re: kplex on Raspberry Pi --howto

Some alternatives...

create a file interface as barnakiel suggests (but output only: file interfaces can't be bi-directional with kplex). Adding a timestamp (timestamp=s for 1 second resolution) is often useful for log files, but if you're only logging RMC the time is in that.

[file]
direction=out
filename=/var/tmp/gpslog
append=yes

You may also want to think about sticking a rate-limiting output filter on if, say, you only want RMC every 5 minutes.

If you rotate this file remember that kplex doesn't currently do anything like rotating its own files on SIGHUP but many linuxen offer ways to rotate files which include copying the log file then copying /dev/null to a file being written. Or you may want to update the startup script to move aside an existing log file when kplex restarts.

If you want to use gpsd you can also try getting kplex to create a pty then have gpsd read from it.

Or alternatively you could use file interfaces to create a FIFO which another logging process could read from.

kplex google group is here
https://groups.google.com/forum/#!forum/kplex
muttnik is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NSW Australia Postal Address Boat Howto? charliehows Liveaboard's Forum 6 14-07-2016 16:34
Howto enter waypoints in a Hydra 2000 B&G system Four_winds Marine Electronics 11 31-08-2015 11:58
nmea WPL for APRS , howto show MMSI roozeboos Navigation 5 06-04-2014 03:44
HOWTO: Northern Great Lakes-Michigan Raster Chart Display Workaround GreatLakesBoatr OpenCPN 1 11-07-2012 06:12
howto rebuild SVG icon ? manuprenlair OpenCPN 2 17-12-2011 11:35

Advertise Here


All times are GMT -7. The time now is 03:30.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.