OpenMarine

Full Version: NMEA0183 to Node-red
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am stuck trying to get "raw" NMEA0183 sentences into Node-red.  When I try to listen to TCP:10110, I get the following message: 

unable to listen on port 10110, error: Error: listen EADDRINUSE: address already in use :::10110

I am able to see messages using the SignalK subscribe node without issue. For example, naviagation.datetime is providing time every second consistently. However, I need the raw NMEA0183 messages such as $GPZDA,hhmmss.ss,dd,mm,yyyy,xx,yy*CC so that I can pass on sentences on to my VHF and ST6000 autopilot.  I am using the Pi as a multiplexer.  The Pi will receive message from my wind sensor and AIS and then share them with the VHF and autopilot wirelessly.  

In the terminal, I am able to use sudo cat /dev/ttyACM0 and can see the NMEA sentences coming in.  However when I try to use a Serial In node in node-red, I receive the following message:

"[serialconfig:8de97bce.607f8] serial port /dev/ttyACM0 error: Error: Error: No such file or directory, cannot open /dev/ttyACM0"

I was hoping that this plug-in:  https://github.com/vokkim/nmea0183-to-nmea0183  would be the answer however I am lost at the first step.  How does one Add NMEA0183 provider to SignalK configuration with a SentenceEvent option?

My node-red flow is here:

Code:
[{"id":"747f7d52.c16794","type":"tab","label":"NMEAtoLittlefish","disabled":false,"info":""},{"id":"ca23868f.91c048","type":"debug","z":"747f7d52.c16794","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1050,"y":520,"wires":[]},{"id":"5678c25036126b3c","type":"signalk-subscribe","z":"747f7d52.c16794","name":"navigation.position","mode":"sendAll","flatten":true,"context":"vessels.self","path":"navigation.position","source":"","period":1000,"x":270,"y":180,"wires":[["899e7b9d9c1cbcb0","3f4076b11cd86cd8"]]},{"id":"3f4076b11cd86cd8","type":"function","z":"747f7d52.c16794","name":"Parse latitude","func":"msg.payload = msg.payload.latitude;\nif (msg.payload == null) {\n    msg.payload = 0.0000;}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":160,"wires":[["43701776c094db98"]]},{"id":"899e7b9d9c1cbcb0","type":"function","z":"747f7d52.c16794","name":"Parse longitude","func":"msg.payload = msg.payload.longitude;\nif (msg.payload == null) {\n    msg.payload = 0.0000;}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":240,"wires":[["a507887d3a1f697b"]]},{"id":"43701776c094db98","type":"function","z":"747f7d52.c16794","name":"To 4 Decimals","func":"num = msg.payload;\nmsg.payload = (Number(num.toFixed(4)));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1120,"y":180,"wires":[[]]},{"id":"a507887d3a1f697b","type":"function","z":"747f7d52.c16794","name":"To 4 Decimals","func":"num = msg.payload;\nmsg.payload = (Number(num.toFixed(4)));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1140,"y":280,"wires":[[]]},{"id":"8f629daa34ae3b01","type":"signalk-subscribe","z":"747f7d52.c16794","name":"navigation.datetime","mode":"sendAll","flatten":true,"context":"vessels.self","path":"navigation.datetime","source":"","period":1000,"x":310,"y":460,"wires":[[]]},{"id":"e5c1b046ade9a232","type":"tcp in","z":"747f7d52.c16794","name":"","server":"server","host":"","port":"10110","datamode":"stream","datatype":"utf8","newline":"","topic":"","base64":false,"x":290,"y":640,"wires":[["ca23868f.91c048"]]},{"id":"f3056d9b82df405b","type":"serial in","z":"747f7d52.c16794","name":"","serial":"8de97bce.607f8","x":300,"y":780,"wires":[["ca23868f.91c048"]]},{"id":"8de97bce.607f8","type":"serial-port","serialport":" /dev/ttyACM0","serialbaud":"38400","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"}]


Thank you for any help you can offer!  I have been trying solutions for the last three hours and am banging my head.
Code:
[{"id":"ca259f8ad7f8b7e6","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"9777383259da91e3","type":"debug","z":"ca259f8ad7f8b7e6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1030,"y":420,"wires":[]},{"id":"e8faa3c4af72fd81","type":"tcp in","z":"ca259f8ad7f8b7e6","name":"","server":"client","host":"localhost","port":"10110","datamode":"stream","datatype":"utf8","newline":"","topic":"","base64":false,"x":670,"y":420,"wires":[["9777383259da91e3"]]}]

I had to change the TCP node from "Listen on" to "Connect to" and now I can see all the NMEA 0183 on 10110. 

Still not sure why I can't use the Serial In node.
(2022-04-03, 09:25 PM)La Zorra Wrote: [ -> ]Still not sure why I can't use the Serial In node.

Usually best to let signalk take care of all the connections then if you want to get at the data node-red can get it from signalk. So all serial connections get configured in signalk/connections. 

If you want to control what data goes to a different serial port then signalk events is usually better. Signalk does all the multiplexing you likely need. 

https://github.com/SignalK/signalk-serve...tting-Data

Events can be a little confusing at first, might be better thought of as "channels"? I send gps pos data like this - 
USB GPS in> 
[Image: DF5ufp7.png]

USB serial output to VHF (shares with wind data coming in) >

[Image: 58TCssD.png]

So anything coming in from the GPS gets labeled as gps-nmea and sent out again through the 'wind' usb/serial. All incoming  nmea sentences get sent out again over tcp 10110.
The port addresses above were created by openoplotter with the serial app.