2020-09-08, 01:10 AM
As promissed, this is the solution I developed for sending seatalk1 datagrams generated by signalk (In this case the signalk-autopilot plugin) to the seatalk1 bus (ST2000+).
First, a little about the hardware:
I used the bidirectional interface published by Thomas Knauf:
http://www.thomasknauf.de/rap/seatalk3
In particular I assembled this version because it was easy for me to get those transistors, but it should be the same:
https://berreizeta.blogspot.com/2016/08/...rface.html
This interface is desing to be connected to a RSR232 interface and is not compatible with the RPi GPIOs, so I used a MAX3232 level adapter in between the interface board and the RPi.
https://www.amazon.com/Mini-RS232-Conver...B01DAR1ZOY
The TTL input of the adapter is connected to the GPIO23 pin and configured as a seatalk1 GPIO standard connection in signalk.
Now, for the output, I connected it to the GPIO14 (TXD0), you have to enable the UART on that ping to be able to use the hardware serial output (This disables the bluetooth on the RPi, I’d like to try sometime if it’s posible to use a software serial output with some other GPIO but 9bit logic is tricky).
Finally, there is a very simple Nodered flow, the first node is a Signal-app-event-node with the same value in the event name as you put in the signalk-autopilot “NMEA 0183 outputEvent for the Seatalk Connection” config. The second node is a python function node with this code:
https://github.com/dnegrotti/seatalk1_ou...lk1_out.py
You can import the flow directly into Nodered with this code:
With this setup you can have bidirectional communication with the ST2000 and the autopilot app is fully functional, I have a very long ToDo list to keep adding functionality, as I mentioned before the ST40 emulation and also the OpenCPN waypoint navigation. This can be extended to any signalk event provided you translate it to a seatalk1 datagram and inject the message into the “Seatalk1 Out” node.
If you (or any other member) need any further details feel free to enquire.
Cari20
First, a little about the hardware:
I used the bidirectional interface published by Thomas Knauf:
http://www.thomasknauf.de/rap/seatalk3
In particular I assembled this version because it was easy for me to get those transistors, but it should be the same:
https://berreizeta.blogspot.com/2016/08/...rface.html
This interface is desing to be connected to a RSR232 interface and is not compatible with the RPi GPIOs, so I used a MAX3232 level adapter in between the interface board and the RPi.
https://www.amazon.com/Mini-RS232-Conver...B01DAR1ZOY
The TTL input of the adapter is connected to the GPIO23 pin and configured as a seatalk1 GPIO standard connection in signalk.
Now, for the output, I connected it to the GPIO14 (TXD0), you have to enable the UART on that ping to be able to use the hardware serial output (This disables the bluetooth on the RPi, I’d like to try sometime if it’s posible to use a software serial output with some other GPIO but 9bit logic is tricky).
Finally, there is a very simple Nodered flow, the first node is a Signal-app-event-node with the same value in the event name as you put in the signalk-autopilot “NMEA 0183 outputEvent for the Seatalk Connection” config. The second node is a python function node with this code:
https://github.com/dnegrotti/seatalk1_ou...lk1_out.py
You can import the flow directly into Nodered with this code:
Code:
[{"id":"c964b9cf.79b678","type":"signalk-app-event","z":"46419c75.a897b4","name":"NMEA0183 Out","event":"seatalkOut","x":110,"y":140,"wires":[["4633789b.f5aac8"]]},{"id":"4633789b.f5aac8","type":"python-function","z":"46419c75.a897b4","name":"Seatalk1 Out","func":"#!/usr/bin/env python\n#Sends seatalk1 datagrams to serial output\n#By Cari20 (2020) loosely based on Marco Bergman ST2000 RPi remote\n\nimport RPi.GPIO as GPIO\nimport serial\nimport binascii\n\nmsg2 = msg['payload']\nlst = msg2.split(\"*\")[0].split(\",\")\nlst.append(msg2.split(\"*\")[1])\n\nif lst[0]=='$STALK':\n with serial.Serial('/dev/serial0', 4800, timeout=10, writeTimeout=0) as ser:\n ser.parity = serial.PARITY_MARK\n ser.write(binascii.unhexlify(lst[1]))\n ser.parity = serial.PARITY_SPACE\n for i in lst[2:-1]:\n ser.write(binascii.unhexlify(i))\n ser.close()\n\nreturn msg","outputs":1,"x":290,"y":140,"wires":[[]]}]
With this setup you can have bidirectional communication with the ST2000 and the autopilot app is fully functional, I have a very long ToDo list to keep adding functionality, as I mentioned before the ST40 emulation and also the OpenCPN waypoint navigation. This can be extended to any signalk event provided you translate it to a seatalk1 datagram and inject the message into the “Seatalk1 Out” node.
If you (or any other member) need any further details feel free to enquire.
Cari20