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.
VNC server is part of the OpenPlotter package and is used to run the remote desktop. To get the OpenPlotter desk top on the remote device download the VNC app from here: https://www.realvnc.com/en/connect/download/viewer/ the app store or iTunes.

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.

We set up the Tide function with tcdata files that have world wide tide stations in OpenCPN here

Transferring files from your PC to OpenPlotter is very quick  and easy here is how we do it here

Setting up the layers directory so OpenCPN doesn't get bogged down with lots of routes tracks and waypoints here

Initial testing of the fresh install, GPS and AIS connected, comparison with our trusty laptop. Looking very good.

6 comments:

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

    ReplyDelete
  2. Thank you for the great write up. With your guide, I was able to get OpenPlotter running on my Raspberry Pi. Question, how do I download charts onto the Pi/Charts directory? I've tried inserting a flash drive into the Pi but it doesn't recognize it. Thank you. s/v Full Cry

    ReplyDelete
  3. Thanks for the great walk-through. I'm in the process of installing OpenPlotter on a RP 3, and I haven't been able to find out how to configure email so that the GRIBs plug-in in OpenCPN can send email requests to sailmail, etc. Can you point me in the right direction?


    tia,

    Andrew

    s/v Sueno Azul

    ReplyDelete
  4. A good detailed, step by step walk-through! I went through some of these pains myself recently. To get adequate power to the RPi, I've used a 5A lithium battery charger with adjustable voltage, used blank micro USB plugs to solder in thicker wires (AWG18). This got rid of the yellow flash symbol.

    I am still having problems updating OP to the latest v1.2 with SD cards larger then 16G. I'm of the opinion that it's down to the quality of the SD card and degree of data compression. I have a small SSD on order. Once here I intend to use this as the boot drive to have better reliability than an SD card.

    I'm using an IMU for magnetic heading for now as a backup to my non-rate compass. If properly calibrated, it's accurate and stable when compared to the boat's analog compass. Had a lot of frustrating and yet interesting fun linking data with USB convertors. I've now ended up with 3 types as one type would work on the AIS for example, but not inputs from the AP. Or outputting nmea0183 data to the AP. Still have not found the reason. Tried every permutations of cable connections. I think my setup is now baked well enough to be reliable as a good chartplotter. Yet to get the radar working and I hope it's a ethernet cable issue.

    Bottomline, to those still undecided about such a project.... it's doable. Bought my first RPi (3B+) just 2 months ago and worked on it when time permits. I do not have any formal computing or electronic training. If you can follow instructions you can do this.

    Well written, Bruce & Deb. Love your blog.

    S/V Micasa

    Ben

    ReplyDelete
  5. Hi, I made the mistake of spending £150 on a Moitessier HAT for the RPi, and as they have already got your money, they dont supply any instructions, or guides that explain how to make it work beyond installing the HAT. Spent several days and nights now trying to get the GPS to show my position on openCPN. Ready to GIVE it away and buy the dongles, as despite being seperate pieces there is documentation that can be followed such as yours so it may "ONE DAY" work. I would advise anyone considering the Raspberry Pi to follow your method and forget the Rooco.eu rubbish. Not sure weather Ive been scammed or the part is faulty, but openCN on my phone worked out of the box, but the specialist "Moitessier HAT" just seems to be a waste of time and money, as Im not the only person experiencing the same problem that this addon (which is 5 times more expensive than the pi) is supposed to avoid, and its endorsed by sailoog.org and openplotter.
    Yours sincerely balding(from pulling hair out),
    Brian.

    ReplyDelete
  6. I made 4 different 32 gig cards three different NOOBS downloads, Each time I would get a box to select the OS but no OS visible. I finally did the image and used BalanaEtcher to flash it onto one of the cards. Worked perfect. I ordered the heatsinks but looking for a fan that uses a separate supply.

    Thanks for all the photos and screen shots. they helped a lot.

    M

    ReplyDelete