31 December 2010

A simple forwarder for AIS and NMEA 0183 data over TCP/IP

I've recently moved the NMEA 0183 HS serial port from my Windows PC input to the central Linux micro computer, and written a small script that retransmits the serial data out over TCP/IP.

This has a number of advantages in my particular install:
  • It allows me to log the AIS data stream.
  • It allows me to view the AIS on both Expedition and Nobeltec software at the same time.
  • It allows me to simultaneously access the AIS stream from my iPad. I've tested it with Digital Yacht's iAIS app, but it should work with other apps running on the iPad.
So instead of being able to use the AIS data only on a single Windows application I can now use it on all navigation hardware access that I have on the boat. Quite an achievement for moving one plug and writing a little bit of PHP code.

The code really is very simple - it reads an entire line from the serial, detects any new clients and then forwards it to all TCP clients that have connected to it. Then loop. As a bonus it will cache the last received 200 AIS messages and send those immediately to any client that connects. This in the hope that this contains a number of VDM type 5 and 24 messages so that the client can show static AIS data immediately.

You can download the nmea_to_tcp script here. I'm releasing this under the GPL v3.

To use this code you must have a computer that has a PHP5 CGI interpreter. On Microsoft Windows you may want to remove the first line of the nmea_to_tcp script, as this instructs a Linux system to use the PHP interpreter. You may need to install the DIO direct I/O package.

Connect you AIS receiver to a serial port, and then start the script with the name of that serial port as it's first argument, for instance nmea_to_tcp /dev/ttyUSB0 on Linux; it is probably something like nmea_to_tcp //./com1 on Microsoft Windows.

That's all. You should now be able to connect to the system at TCP port 2000.

Nobeltec and TCP streams

By the way, to get Nobeltec to use the TCP stream -- you can't rely on the built-in Glass bridge functionality. You have to convert the TCP stream back to serial data, for instance using the open source com0com and com2tcp software.

Are you unable to find the website for Expedition navigation software?

I recently attempted to download an update to the awkwardly named but excellent Expedition navigation software written by Nick White. Apparently Nick was getting a little bored with running a website, as the former site at the original site www.iexpedition.org is no longer in existence. At the time I was redirected to the new distributor, Tasman Bay Navigation Systems.

Today I was looking up that new address for a different post I was making, and noticed that iexpedition.org is now no longer in function and has been clobbered by one of those domain squatters.

For that purpose I am writing this post in the hope that you may find the new site for Expedition software more easily at: Tasman Bay Navigation Software.

26 December 2010

Collision on the North Sea

A few days ago two cargo ships collided in the North Sea in the beginning or just before the TE Traffic Separation Scheme, the 395 m (1200 ft) long CMA CGM Laperouse and the 90 m (300 ft) Thebe, luckily with little damage. Conditions were not great, 3m swell with a 40 - 45 knot wind, but not completely atrocious either.

You can see where the accident happened on MarineTraffic's AIS log of the Laperouse's track.

Here is a scanned recording of the VHF transmissions of the the Dutch Coastguard and rescue services (from scannernet.nl).

Now both of these vessels are mandated to have AIS on board, but that doesn't say both had fully integrated AIS sets that would warn them about an upcoming collision. Even so, it's hard to understand why these accidents still happen even with all this tech aboard.

It shows that although AIS is a great help to all parties there is apparently still enough room for error such that a large(ish) cargo vessel is able to collide with one of the largest container vessels in the world.