Yacht Devices Python Gateway User Manual
Yacht Devices Python Gateway User Manual
Software version
1.00
2024
© 2024 Yacht Devices Ltd. Document YDPG-002. March 13, 2024 Web: https://www.yachtd.com/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the «Software»), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED «AS IS», WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Contents
Introduction 4
Warranty and Technical Support 5
I. Product Specifications 6
II. NMEA Basics 8
III. Installation of USB Drivers and Connection to PC 12
IV. Installation and Connection to NMEA 18
V. LED Signals 20
VI. Firmware Updates 21
VII. Programming the Device 23
VIII. Device Reset 27
Appendix A. Troubleshooting 28
Appendix B. Supported NMEA 2000 Messages 30
Appendix C. Device Connectors 32
Package Contents
Device 1 pc.
This Manual 1 pc.
Stickers for USB connector sealing 6 pc.
USB cable from Mini-B (M) to Type-A (M), 20 cm 1 pc.
Introduction
The Yacht Devices Python Gateway (hereafter referred to as Gateway or Device) is a Swiss Army knife for
connecting NMEA 0183 and NMEA 2000 devices. It is equipped with two serial ports (one for receiving
NMEA 0183 data and one for transmitting), a CAN bus interface (for NMEA 2000) and a USB port for
connection to a PC. The USB connection provides two interfaces at the same time: a virtual disk for
uploading user programs, and a serial port with interactive Python prompt for debugging user code or
monitoring its execution.
The Device allows the creation of gateways between NMEA 0183 and NMEA 2000, at UART and CAN bus
level with the standard Python library, or at NMEA level with the Yacht Devices library. It also allows to
connect NMEA 0183 devices working at different speeds, to process, filter and modify data on the fly. The
Device's internal disk can be used by user code to store logs and other data.
The Gateway hosts MicroPython (www.micropython.org). This is a very popular implementation of the
Python 3 programming language that includes a small subset of the standard Python library. The Gateway's
processing power is limited, and you may not be able to use resource-intensive libraries popular on the
PC, such as numpy, and you may have difficulty porting the code with the long list of imports designed
for the PC.
However, you will have all the flexibility and power of the Python language, and the Yacht Devices library
allows you to create tiny and elegant programs. For example, AIS decoding from NMEA 0183 to NMEA
2000 takes about 1.5 milliseconds per message. Therefore, the performance is sufficient for real-time
applications.
Please note that programming requires knowledge of the NMEA protocols. NMEA 0183 standard or NMEA
0183 standard can be obtained from the National Marine Electronics Association (www.nmea.org).
—4—
Warranty and Technical Support
1. The Device warranty is valid for two years from the date of purchase. If a Device was purchased in a
retail store, the sales receipt may be requested when applying for a warranty claim.
2. The Device warranty is terminated in case of violation of the instructions in this Manual, case integrity
breach, or repair or modification of the Device without the manufacturer’s written permission.
3. If a warranty request is accepted, the defective Device must be sent to the manufacturer.
4. The warranty liabilities include repair and/or replacement of the goods and do not include the cost
of equipment installation and configuration, or shipping of the defective Device to the manufacturer.
5. Responsibility of the manufacturer in case of any damage as a consequence of the Device’s operation
or installation is limited to the Device cost.
6. The manufacturer is not responsible for any errors and inaccuracies in guides and instructions of
other companies.
8. In the event of a failure, please refer to Appendix A before contacting technical support.
9. The manufacturer accepts applications under warranty and provides technical support only via
e-mail or from authorized dealers.
10. The contact details of the manufacturer and a list of the authorized dealers are published on the
website: http://www.yachtd.com/.
—5—
I. Product Specifications
Our devices are supplied with different types of NMEA 2000 connectors. Models with R at the end of the
model name are equipped with NMEA 2000 connectors and are compatible with Raymarine SeaTalk NG.
Models with an N in the model suffix are equipped with NMEA 2000 Micro Male connectors. See connector
drawings in Appendix C.
—6—
Device parameter Value Unit
Current consumption from USB (see note 1), maximum / average 90/37 mA
USB interface specification supported 1.1, 2.0 —
USB Device VID / PID 0483/A217 hex
Supply voltage from NMEA 2000 network 9..16 V
Current consumption from NMEA 2000 network (see Note 1), max. / avg. 68/32 mA
Load equivalency number 2 LEN
Galvanic isolation between NMEA 2000 and USB N/A
Galvanic isolation between NMEA 2000 / USB and NMEA 0183 2 500 VRMS
NMEA 0183 cable length 450 mm
NMEA 0183 receiver input resistance 96 kOhm
Internal disk space for user programs 16 MBytes
Device case length 54 mm
Weight 38 g
Operating temperature range —20..+55 °С
Note 1: the Device can be powered from USB or from NMEA 2000 interfaces, measurements
above are with 100 Ohm load connected to the NMEA 0183 port.
Yacht Devices Ltd declares that this product is compliant with the essential requirements of EMC
directive 2014/30/EU and radio and TTE directive 1999/5/EC.
Dispose of this product in accordance with the WEEE Directive. Do not mix electronic waste with
domestic or industrial refuse.
—7—
II. NMEA Basics
This section describes the basics of NMEA 0183 and NMEA 2000 networks. We recommend getting
familiar with this section before connecting the Device.
These networks are very different at the electrical and software levels. NMEA0183 also has made a long
evolutionary path, but thanks to its simplicity and cheapness, it is still very popular and widely used.
1. NMEA 0183
The default speed of a NMEA 0183 interface is 4800 baud. A high-speed interface is 38400 baud and was
designed especially for AIS, but usually chart plotters and instrument displays allow any data (not only AIS)
on a high-speed port. On a chart plotter, port speed can be configured in settings.
NMEA 0183 uses different wires for talking (transmitting, TX) and listening (receiving, RX) data. One
talker can be connected to multiple listeners, but a listener can have only one talker connected. Special
devices called «multiplexers» are used to join the output of multiple talkers to a single stream.
—8—
NMEA 0183, until version 2.0 (1992), used a «single-ended» RS-232 interface with one TX line and one
RX signal line (grey at Figure 2.a) and ground line (dotted at Figure 2.a) used as reference for TX and RX
signals. Therefore, old devices have only three wires.
Since version 2.0, NMEA 0183 has been based on a «differential» RS-422 interface, which has two RX
lines RX+ (can also be marked as «A») and RX- (or «B»), two TX lines TX+ (or «A», grey at Figure 2.b)
and TX- (or «B», dotted at Figure 2) and ground (not shown at Figure 2.b). Modern devices use five wires.
Devices of different versions can be connected, but with one caution. TX- («B») is not equal to a ground
line. Voltage on the TX- line (dotted on Figure 2.b) changes from 0 to 5V, and connecting this line to
ground line can cause a short circuit.
—9—
2. NMEA 2000
NMEA 2000 network runs at 250 kbps and allows up to 60 physical devices to be connected. Unlike NMEA
0183, there are no «talkers» and «listeners». All devices can «talk» and all devices receive all messages.
Many electronic manufacturers presented «branded» versions of NMEA 2000. Raymarine SeaTalk
NG, Simrad SimNet, FurunoCAN differ only in the type of connectors used. However, in recent years
manufacturers have been moving to NMEA 2000 connectors.
Data lines are «terminated» at both ends with a 120-Ohm resistor (see 2 at Figure 4). Therefore, resistance
between CAN lines is between 60 and 120 Ohms. Devices can be connected to any place of backbone
(between terminators). The cable from network backbone to the Device is called a drop cable (see 4 at
Figure 4). Our devices can be connected directly to a backbone.
All the above does mean that you can not simple connect the Gateway to a NMEA 2000 port of your chart
plotter to connect a NMEA 0183 sensor to it. You should establish a simple NMEA 2000 network first.
Many manufacturers offer a «Starter Kit» which contains all that is necessary to establish a basic network
and connect two devices:
— 11 —
III. Installation of USB Drivers and Connection to PC
The Device is connected to a USB port of a PC and is compatible with the USB 1.1 protocol (1998) and later.
It is therefore compatible with all modern laptops and PCs. The Device can be powered from the USB port
(as well as from the NMEA 2000 port) and you will see LED signals after connection (otherwise it means
that the cable or the USB port is damaged).
Note that the USB port is not galvanically isolated from the NMEA 2000 network. We
recommend that you switch off the NMEA 2000 network or disconnect the Device from it
when connecting to the PC. On the boat, we recommend that you run your laptop on battery
and disconnect it from the inverter if you need to keep the NMEA 2000 connection while the
instrument is connected via USB. Otherwise the potential difference to ground may damage
the USB port or the Device.
At the software level, the Gateway implements two devices that operate simultaneously:
• serial port (virtual COM port; USB device class 2, subclass 2).
Serial ports do not require a special driver in Windows 10, Windows 11, Mac OS X and Linux; these
operating systems automatically use a system driver. In older versions of Microsoft Windows, you should
install a driver (.INF file only, no code) that links the standard system driver to a Device.
— 12 —
1. Installation on Microsoft Windows 10 and later
The Device uses Windows drivers and should be installed automatically. To check the installation, you can
open the «Device Manager» from the «Control Panel» and check the presence of the YDPG-01 disk and
the USB serial device.
— 13 —
2. Installation on Microsoft Windows 7 and earlier versions
The USB serial port driver for Microsoft Windows can be found in the root folder of the mass storage
device (which does not require a driver and should be accessible immediately after connection) or in the
Downloads section of www.yachtd.com.
— 14 —
To check the installation on Microsoft Windows 7 and earlier versions of Microsoft Windows, run «Device
Manager» from «Control Panel». If the «YDPG-01 Virtual COM Port» is in the «Other devices» section
(see Figure 6), run «Update Driver Software...» from the context menu, then select «Browse my computer
for driver software» and on the next page click «Let me pick from a list of device drivers on my computer».
Then select «Show All devices» or «Ports (COM and LPT)» from the list and click «Next». On the next
page, select «Have disk...» and select YDPGDRV.INF from the Gateway's disk (see Figure 7).
At the end of the output, you will see the properties of the Device, the name of the serial port and the name
of the disk. To use the internal disk (see the Figure 8, line 605.082413), if it was not mounted automatically,
type the command:
sudo mount /dev/sdb1 /mnt
To connect the terminal to the Python interactive prompt, type (see Figure 8, line 604.002001):
screen /dev/ttyACM0
— 16 —
4. Installation on Mac OS X
Once the Device has been connected, click on the Apple icon and select the «About This Mac» menu item.
Click the «More Info...» and «System Report...» buttons in the window that opens. Locate «YDPG-01
Virtual COM Port» in the USB subsection of the Hardware section, as shown in Figure 9.
The Device requires no maintenance. When deciding where to install the Device, choose a dry mounting
location. Avoid places where the Device may be flooded with water, as this can damage it.
The Device has no galvanic isolation between NMEA 2000 and USB ports, please read the
Section III before connecting the Device to USB.
The Device can be connected directly to the NMEA 2000 network backbone without a drop cable. Switch off
the bus power supply before connecting the Device. Refer to the manufacturer's documentation if you have
any questions about the use of connectors:
• Technical Reference for Garmin NMEA 2000 Products (190-00891-00) for Garmin networks.
After connecting the Device, close the lock on the connection to ensure its water resistance and reliability.
The Device is powered from the NMEA 2000 network (or USB) and has a LED, that blinks red or green.
After powering up the NMEA 2000 network or connecting to USB, the Device's LED will flash green once
to indicate that it is on. If this does not happen, see Appendix A.
You can check the NMEA 2000 connection with LED signals, see Section V. You can also check that the
Device is present on the network and check the firmware version from a chartplotter. Please see Section
VI for details.
The connection to the NMEA 0183 network varies depending on the version of the connecting
equipment. Please, refer to Section II for connection schemas. The wrong wiring can damage
the equipment!
— 18 —
Note that many NMEA 0183 devices, including the Gateway, have different wire colors than specified in the
Standard. Please check the label on cable and/or documentation before connecting.
All connections should be made with the power off to prevent accidental short circuits during installation.
It is recommended to connect wires by crimping or twisting rather than soldering. Soldered connections
can break down quickly in the marine environment and require air insulation with paint or lacquer.
The Device is supplied with the serial port configured at 4800 baud (standard NMEA 0183 speed). When
the connected equipment sends messages at this speed, their reception is confirmed by LED signals (see
Section V). To change the speed in the Device settings, see Section VII.
— 19 —
V. LED Signals
The Device is equipped with a bi-color LED that indicate the Device’s state. The Device produces a short
single green flash after powering on, indicating that the Device is functioning.
3. Other signals
LED signals during firmware update are described in Section VI. Signals during hardware reset are
described in Section VIII.
— 20 —
VI. Firmware Updates
Open the downloaded archive containing the update and read the README.TXT file, which may contain
important information about the update.
The Device has no galvanic isolation between NMEA 2000 and USB ports, please read Section
III before connecting the Device to USB.
If the Device is connected to a NMEA 2000 network, switch it off or disconnect the Device.
Connect the Device to the USB port of a laptop or PC and copy the YDPG01.BIN file from the update archive
to the root folder of the Python Gateway internal disk. Disconnect the Device from the USB port.
After connecting to the USB port or powering up the NMEA 2000 network, the update will start. It will take
up to 30 seconds, no LED signals will be emitted during the update process. Do not disconnect the Gateway
from the power source (USB or NMEA 2000) during the update.
When the update is complete, the LED will alternate between red and green for 5 seconds. The boot loader
then deletes the update file from the Device's disk and transfers control to the firmware.
If the Device is already using the specified version of the firmware, or if the Device cannot open the file, or
if the file is corrupt, the boot loader will immediately transfer control to the firmware. This is done without
any visual indication.
Device information, including firmware version, is displayed in the NMEA 2000 device list (SeaTalk NG,
SimNet, Furuno CAN) or in the common list of external devices on the chartplotter (see Figure 10). This
list can usually be accessed from the plotter's «Diagnostics», «External Interfaces» or «External Devices»
menu.
— 21 —
Figure 10. YDPG-01 in the list of boat network devices on Simrad NSX MFD
— 22 —
VII. Programming the Device
The internal disk of the Device contains the boot.py file (which initializes the libraries and configures the
Device's peripherals, including the speed of the NMEA 0183 ports) and the main.py file (which is empty
and intended for user code). These files are executed sequentially by the Device when it is powered on.
Your software supplier will provide these files, and the software supplied may also contain libraries (other
files with a .py filename extension). Some libraries may be in subfolders. Copy all files and folders from the
archive containing the software to the root of the internal disk of the Device and agree to replace all files
with new ones.
Switch off the Device (disconnect it from USB and from NMEA 2000). The next time you switch it on, the
new software will start. As the LED signals can be controlled by user code, ask your software supplier how
to check the how to check the program status with LED signals (see also Section V).
The USB serial port of the Device provides access to the Python interactive prompt (REPL). There you
can check the status of the running program, check for execution errors, or abort the program to run your
own code.
You can use the serial port with the terminal program. For Microsoft Windows, we recommend the
freeware Putty (also available for Linux, can be downloaded from www.putty.org). In Linux and Mac OS
X, the screen command can be used. For the configuration shown in Section III, you can use the following
commands to connect:
screen -a /dev/cu.usbmodem00690001
screen /dev/ttyACM0
— 23 —
If the Device does not have a running program, you will see the Python prompt, as shown in Figure 11.
If you are using the terminal for the first time, use the help() command to get basic information about
working with the terminal and interactive prompt (REPL).
The running program or code can be aborted by pressing Ctrl+C and (after that) the Python interpreter
can be soft reset by pressing Ctrl+D. The soft reset is much faster than a Device reboot (power cycle) and
it does not interrupt the terminal session. Note that after a software reset, boot.py and main.py will be
executed. You can reset the interpreter with Ctrl+W instead of Ctrl+D to skip main.py at startup.
However, if you are a software developer, the most convenient way to interact with the Gateway is to use
the freeware Thonny application, available for Microsoft Windows, Linux and OS X at www.thonny.org.
To test a new installation, you may need to change NMEA 0183 speed in the boot.py file. Find lines with
the substring baudrate=4800 and replace the 4800 by the speed you need. To apply changes, you can cycle
Device power or soft reset the Python interpreter.
To add the sixth flash to the normal operation signals sequence (see Section V), type in the REPL or add to
the main.py the line led.green() or led.red() to select the corresponding color.
Documentation of Yacht Devices library for Python Gateway and code samples are published online at:
http://www.yachtd.com/products/python_gateway/lib.html
Please note that programming requires knowledge of the NMEA protocols. A copy of the NMEA 2000 or
NMEA 0183 Standard can be obtained from the National Marine Electronics Association (www.nmea.org).
— 26 —
VIII. Device Reset
There are two types of reset: hardware reset and software reset. The Device can also be rebooted by
switching it off (disconnecting it from both the USB and NMEA 2000 network, or switching off both NMEA
2000 and USB) and then switching it on again (from USB and/or NMEA 2000).
A hardware reset returns your Device to the state in which it was originally purchased. All settings will be
lost and firmware updates will be rolled back. Original files on the internal disk will be restored, all user files
will be deleted or overwritten. To reset the Device:
1. Disconnect the Device from NMEA 2000 or turn off the NMEA 2000 power.
2. Connect the Device to USB (to a laptop or just to the power cable) and disconnect during one second.
Repeat this four times with at least 2 seconds between connections. There should be no LED signals
during this procedure. If there are, it means that you have disconnected the Device too late and need
to start the procedure again.
3. Connect the Device to USB for the fifth time and the LED will turn red. Wait about 5 seconds for it to
change color to green and disconnect immediately. If you have changed your mind, do not disconnect
the Device and wait two seconds for the LED to turn off and the Device to return to normal operation.
4. If you disconnected the Device while its LED was green in the previous step, it will perform the reset
procedure the next time it is connected to USB or NMEA 2000 network. This can take up to a minute.
During this time, the LED will be red. Do not disconnect the Device until its LED starts flashing to
indicate normal operation.
Software reset is the term used for the Python interpreter. You can restart it without cycling the Device
and without breaking the terminal session. In the terminal session (see Section VII), abort the current
program by pressing Ctrl+C and then press Ctrl+D at the Python interactive prompt (REPL). This will reset
the interpreter, and after reset, boot.py and main.py will be executed. You can reset the interpreter with
Ctrl+W instead of Ctrl+D to skip executing of main.py at startup.
— 27 —
Appendix A. Troubleshooting
Chaotic or unrecognized The LED can be controlled by a user program. Contact your software
LED signals supplier for details. Perform a software reset (see Section VIII) with
Ctrl+W (to avoid running main.py on startup) to check the LED signals.
Odd behavior of the Device, The program can use callbacks, which means that its code can still be
even when the user program executed (control LED signals, read and send messages) when it’s main
is terminated cycle is interrupted and the user can type commands in the terminal.
Perform a software reset (see Section VIII) with Ctrl+W (to avoid running
of main.py on startup) to check the behavior of the Device.
— 28 —
Table 3 continued
Although the terminal 1. REPL is controlled by the user program. The program can request
program can access the COM input from the terminal program. Typed characters are not displayed in
port, REPL does not respond this case. Contact your software supplier.
to any key press. Software 2. The Device is stuck in an endless loop. The user program may
reset does not work. cause the machine to get stuck in an infinite loop. Try to remove the files
boot.py and/or main.py from the disk. Don't forget to back up the files to
a safe location.
— 29 —
Appendix B. Supported NMEA 2000 Messages
This appendix contains messages used in service communication with other devices on the network.
«No» in the table below means that the Gateway will not process or send these messages during service
communication with other devices. Note that service communications are not affected by user program.
— 30 —
Note 1: NMEA 2000 Device Instance, System Instance, Installation Description Field 1 and
Installation Description Field 2 can be changed with PGN 126208. It may be supported
by some models of chart plotters or this can be done with professional PC software
(with a hardware connector to the NMEA 2000 network). If you have Yacht Devices
NMEA 2000 Wi-Fi, USB or Ethernet gateways or routers, you can download our
free CAN Log Viewer software (runs on Microsoft Windows, Mac OS X and Linux) at
http://www.yachtd.com/downloads/.
Note 2: The «Equipment Status» field of the Heartbeat message is controlled by the user program
(class NMEA2000, method equipment(), see the link to library documentation in
Section VII).
Note 3: These messages are used for real time clock synchronization (class NMEA 2000,
method rtc(), see the link to library documentation in Section VII). The RTC can also be
synchronized by NMEA 0183 ZDA and RMC sentences.
— 31 —
Appendix C. Device Connectors
Figure 1. NMEA 2000 connectors of YDPG-01R (left) and YDPG-01N (right) models
The USB connector (type Mini-B female) and NMEA 0183 wires are shown in Figure 1 in the Section I.
— 32 —
NOTES
— 33 —