Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

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 17-02-2021, 10:41   #1
Registered User

Join Date: Aug 2017
Location: Cape Breton, NS, Canada
Boat: Cape Islander - tour boat
Posts: 68
OpenCPN as repeater/aggregator with virtual COM ports

Hello All,
I currently run OpenCPN on a Toughbook which has only one accessible USB port. I am in the process of using a rPi 4 as a NEMA aggregator. It receives data from the sounder, GPS, AIS, and an Arduino heading sensor.

The GPS data is modified slightly (time & date) by my own Java program running on the Pi. https://github.com/ian5142/nema0183_aggregator/
(ignore the Readme, I haven't updated it). The program outputs the updated serial data on a virtual COM port. In this case I have it hard coded to /dev/ttyS20. On boot the rPi has the following to create a COM port bridge:
/usr/bin/socat pty,raw,echo=0,link=/dev/ttyS20 pty,raw,echo=0,link=/dev/ttyS21 &

In OpenCPN on the rPi, I have configured all of the inputs and the single output (115200 baud). The only problem is that the GPS modified input does not show up in the OpenCPN port dropdown list or work when I type it in manually. Baud rate is correct. I know my Java program works correctly because I can see the output of it using screen (on /dev/ttyS21).

Any ideas?
ian5142 is offline   Reply With Quote
Old 18-02-2021, 11:09   #2
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: OpenCPN as repeater/aggregator with virtual COM ports

Use UDP or TCP between your Java program and OpenCPN (And between the RPi and the Toughbook) and save yourself the endless headache with serial ports.
Especially if all you need the RPi for is the multiplexer, there are probably better options than OpenCPN, like kplex or SignalK server.
nohal is offline   Reply With Quote
Old 18-02-2021, 13:13   #3
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,806
Re: OpenCPN as repeater/aggregator with virtual COM ports

OpenPlotter does run not only on RasPis but as well on other Linux distros. With kplex and SK installed. Plus a user community to support that part.
OCPN is the plotter of course...
bcn is offline   Reply With Quote
Old 18-02-2021, 16:20   #4
Registered User

Join Date: Aug 2017
Location: Cape Breton, NS, Canada
Boat: Cape Islander - tour boat
Posts: 68
Re: OpenCPN as repeater/aggregator with virtual COM ports

The toughbook only has an accessible USB port, no ethernet. Just the difficult place it is mounted. I am not using wifi for this, not reliable enough. My java program is setup to output on a virtual serial port, created using socat. That part works fine.


I started to setup kplex today. I still want to output via serial, actually UART from the Pi, to UART-USB device on the toughbook. I can't get kplex to output anything yet though.
The output serial section on the kplex config file is:
[serial]
file=ttyAMA3
baud=115200
direction=out

name=output


Above it are all of the serial inputs. I have abandoned the OpenCPN on the Pi idea.

Anything I am missing?


PS: Anyone know how to have an arduino connected via USB output serial on boot, plugged into the Pi. Every time I reboot the Pi, I have to go and click the reset button the Arduino in order for it to output serial data to the Pi. This won't work when it is all mounted.
ian5142 is offline   Reply With Quote
Old 18-02-2021, 18:23   #5
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: OpenCPN as repeater/aggregator with virtual COM ports

I would probably still prefer USB-to-Ethernet over USB-to-UART.

I am also from personal experience not exactly convinced wi-fi is any less reliable than a cascade of physical, virtual and media converted serial ports at distances found on an average boat.

You can reset the Arduino from the RPi whenever you need via its reset pin connected to one of the GPIO pins on the Pi (See for example https://electronics.stackexchange.co...-a-atmega3285v if by Arduino you mean some of the 5V ones) or perhaps you can make the Arduino reset itself when it detects the communication with the Pi is not working.
nohal is offline   Reply With Quote
Old 19-02-2021, 08:32   #6
Registered User

Join Date: Aug 2017
Location: Cape Breton, NS, Canada
Boat: Cape Islander - tour boat
Posts: 68
Re: OpenCPN as repeater/aggregator with virtual COM ports

I have got Kplex and my java program working on the Pi. Now the only problem left is why the Arduino won't output serial until the board is reset either by pressing the button or uploading new code to it. It is recognized by the Pi before then though. Just no serial output.
ian5142 is offline   Reply With Quote
Reply

Tags
enc, opencpn, ports


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
OpenCPN 5 does not connect to virtual COM ports spirare OpenCPN 6 02-03-2020 17:55
Best sailboat listings search engine? Aggregator site? Paul-Arr General Sailing Forum 1 07-07-2016 12:06
Replacing Ports with New Found Metals Ports Papa Joe Construction, Maintenance & Refit 10 04-06-2016 14:34
Sending Data from GPS to two Virtual Ports in Ubuntu 12.04 Sail323 OpenCPN 1 19-07-2012 12:59
Virtual OpenCPN - 'OpenCPN on a Stick' r.fairman OpenCPN 23 16-10-2011 19:51

Advertise Here


All times are GMT -7. The time now is 17:04.


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.