Saturday, 24 November 2018

Setting up our Raspberry Pi with OpenPlotter


What we did to install OpenPlotter on a Raspberry Pi to have a OpenCPN chart plotter running. 


A quick note about the Raspberry PI. Top of the list is the latest model of RPI (Raspberry Pi) and that is the Raspberry Pi 3 Model B+, there are still B models out there for sale but I spent the extra couple of dollars and purchased the newer B+ unit. No sense starting off with an older/obsolete model.

Shop around, we saw B models costing more than the later B+ version. If possible see if there is a package deal. We purchased a package and it turned out to be a good deal after adding together the cost of the individual items. About the only thing we didn’t need was the AC power adapter that came in the package.  We just put that away into a locker as we very rarely use AC power once away from the dock, and we certainly wont be using AC to run a chart plotter.

Raspberry Pi box almost the same size as the mini mouse. As you can see from the box the model B+ is well marked.

For power we use a 3 amp DC-DC USB charger that plugs into a 12 volt cigarette lighter socket. We tracked down a heavy duty USB charge cable with micro connector to run the RPI. It took a little time to track down the 3 Amp output DC-DC USB charger. As usual there are traps for the uninitiated.  Before handing over your hard earned cash make sure the output of the power unit will supply 3 Amps to a single USB socket, there are some rated as 3 Amp but only supply 1 Amp to each of 3 sockets, or for 2 socket units, 2.1 Amps to one socket and .9 Amps to the other.

After booting up and running the unit, if you happen to see a small icon in the shape of a yellow lightning bolt in the top right hand of you screen your power supply likely isn’t supplying enough power (amps). Or perhaps the cable you have isn’t sufficiently heavy enough. When purchasing a power cord look for cords aimed at being designed for tablet charging, these are marked as being good for 3 amps continuous.

The RPI 3 B+ does have built in Wi-Fi on board. However to get the most out of the installation we also purchased a Wi-Fi USB Dongle. Why you may ask? To have 2 Wi-Fi units running on the OpenPlotter RPI. On board Matilda we have a 4G Huawei mobile Wi-Fi E5577 router which connects to the internet (that is when we are in range of the cell phone towers). The Wi-Fi USB Dongle plugged into the OpenPlotter RPI allows it to connect to the E5577 router (as a Client) so we (OpenPlotter RPI) have an internet connection. Of course you could hotspot your phone and connect to the internet that way. The built in Wi-Fi on board the RPI is then available as an access point (AP) so other computers, tablets and smart phones can log on to the OpenPlotter RPI (as clients). If you don't want to purchase the second WiFi dongle you could USB tether your phone. The main reason to get the RPI on line first up is to update the operating system and OpenPlotter software. After the initial update the internet connection is nice so you can get GRIB files and tide data from the internet.
E5577  4G Huawei mobile Wi-Fi  router

You will need at least these items and this is what we used to run the software.

Monitor option
    1 x Raspberry Pi 3 Model B+ (Prices start at AU$60)
    1 x 16GB or larger Micro SDXC card, ours was a 128GB  (A class 10 or better  100MB per second)
    1 x 5V 3A, Power Supply Adapter, we are using a cig lighter socket 3 amp USB tablet charging unit
    1 x Heat Sink Set (3 piece pack get the better quality copper heat sinks)
    1 x Casing with Fan
    1 x 1.5 Meter HDMI Cable (or length you need, short is better)

The monitor we are using is the vessels 12V LED TV which has 2 HDMI input ports.
Logitech MK240 Nano Wireless Keyboard and Mouse Combo
Wireless adapter (150Mbps WiFi USB Dongle)

Any laptop or desktop computer for the initial prep work, I have numbered the summary to match the work list.
Most of the bits we used, Keyboard and Mouse, Raspberry Pi board, heat sinks, SD Card, HDMI cable and WiFi dongle, not in the photo is a case and the 12V 3 amp USB charger. 

Summary
1. Get the software, NOOBS (New Out Of Box Software)
2. Format the micro SD card for use in the RPI (Raspberry Pi)
3. Extract the files from the NOOBS download on to the PC
4. Load the NOOBS software on the SD card
5. Get ready for the initial boot

1. Download the latest NOOBS installer version of OpenPlotter RPI, on to your PC. It’s a compressed 1GB file so it may take a while. The file is available here:
http://www.sailoog.com/blog-categories/openplotter-rpi/


Screen shot of the OpenPlotter download page, we downloaded the NOOBS

NOOBS zip file downloaded, the directory NOOBS_v2_8_1 is where the contents has been extracted to.

2. If you have a SD card 32GB and under visit the SD Association’s website and download SD Card Formatter 4.0 for either Windows or Mac. https://www.sdcard.org/downloads/formatter_4/index.html/

Screen Shot of the SD associations SD card formatter

Or if you have a Micro SD Card over 32GB like we did with our 128GB SD card, follow the instructions at https://www.raspberrypi.org/documentation/installation/sdxc_formatting.md/

Software to format a SD card of more than 32GB running on a Windows is here. http://www.ridgecrop.demon.co.uk/index.htm?guiformat.htm/

Screen shot of the guiformat FAT32 SD card formatter from Ridgecrop


For Windows (32GB cards and under)
      i. Download the SD Formatting Tool
      ii. Install and run the Formatting Tool on your machine
      iii. Check that the SD card you inserted matches the one selected by the Tool
      iv. Click the "Format" button

For a Mac (32GB cards and under)
      i. Download the SD Association's Formatting Tool   
      ii. Install and run the Formatting Tool on your machine
      iii. Select "Overwrite Format"
      iv. Check that the SD card you inserted matches the one selected by the Tool
      v. Click the "Format" button

For Linux
      i. Its recommend to use gparted (or the command line version parted)
      ii. Format the entire disk as FAT32

Once the initial prep work is done on the SD Card and you have downloaded the NOOBS zip file.

3. Extract the files in the NOOBS zip file into a directory on your PC.

Contents of the extracted NOOBS zip file
4. Copy the extracted files onto the SD card that you just formatted so that this file is in the root directory of the SD card. Please note that the files have been extracted into a folder. Open the folder and copy across the files from inside the folder into the root of the SD card rather than copy over the folder itself.


For those not accustomed to the term root directory, as an example the files would look like the screen capture. Showing the folders and files copied on to the SD card G:\

5. Fit the heat sinks as per the attached diagrams.

Heat sink placement is straight forward, peel the backing of the adhesive and apply in the place as marked above

Heat sink placement is straight forward, peel the backing of the adhesive and apply in the places as marked above

Insert the SD card into your RPI, attach the HDMI cable, and insert the Keyboard and Wi-Fi dongle into the USB ports, now connect the micro USB power supply cable and plug it into the power.

Left to right, SD card in, power cord connected, WiFi, Keyboard and Mouse dongles in the USB slots

Raspberry Pi is installed into its case ready to go


After applying power your Pi will now boot into NOOBS



First boot screen, software is being installed on the SD card.

The screen after the install OpenPlotter is all set to go

 Now is the time to set up the network, change the passwords for the system and network. Then it will be time to add the GPS data dongle or data cable.

Documentation  from the OpenPlotter web site will help guide you through the set up process. https://docs.sailoog.com/openplotter-v1-x-x/

OpenPlotter Network Configuration Page

We are running OpenPlotter on a RPI B+ so we pick RPI3+ from the drop down menu, we can also connect with a network cable so the bridge eth0 is also selected. The picture shows our setup with network dongle (Client), cable connectivity(bridge eth0) and the RPI running as an Access Point (AP). Change the password here or forever be reminded during boot up you need a new password.


Before configuration of the network, hover over the network connection arrows, only onboard WiFi active , (this could also mean the 4G Huawei mobile Wi-Fi E5577 router is not on)

Top right: Network configured the network arrows have been replaced with the WiFi symbol. Both onboard(AP) and WiFi dongle (Client) are working.

Serial connection page

Added the serial data input, we have AIS and a GPS both running at 38400 baud. The setup is easy with the system selecting the correct port and data rate, plug in a cable and press auto, once correct you will be asked to press apply to save. 

 

USB To RS485 USB-485 Converter Adapter


We purchased Arduino brand USB To RS485 USB-485 Converter Adapter to connect our serial data. Our data is differential NMEA0183.   Ours were purchased on Lazada as we are in Malaysia, but a quick search on Ebay (USB To RS485 USB-485 Converter Adapter) turns up lots of them starting at about $2.99 each plus postage. Warning the polarity marked on the board connectors is wrong. connect the A+ wire to B- terminal and the B- wire to A+ terminal. It only took me about 6 hours to sort this one out. I see these units are for sale all over the web and I think most of them are coming from the same supplier

OpenCPN running on the RPI as part of the OpenPlotter Package

Using the remote desktop on the phone or tablet over the WiFi access to the chartplotter/Openplotter functions is available anywhere on the vessel.

Helpful links
OpenPlotter Web Site, the list of  features are not active links, this had me confused first visit. Scroll to the bottom of the page for links to documentation, donations, support, shop. 
http://www.sailoog.com/openplotter

Documentation  from the OpenPlotter web site.
https://docs.sailoog.com/openplotter-v1-x-x/

Support web site, sign up to view diagrams and pictures.
http://forum.openmarine.net/

This concludes our install and initial startup. Follow our journey as we set up layers, add charts, instruments, GPS and  some very cool sensors.
Initial testing of the fresh install, GPS and AIS connected, comparison with our trusty laptop. Looking very good.

1 comment:

  1. Well done Bruce! I think this would be an excellent addition to the OpenCPN manual. Terry

    ReplyDelete