Showing posts with label open plotter. Show all posts
Showing posts with label open plotter. Show all posts

Sunday, 17 February 2019

Raspberry Pi OpenPlotter Making a System BackUp

I recommend to make a copy of your system when you are happy with the configuration. SD cards are usually reliable now days but like any thing electronic they can fail. Having a copy of your set up allows you to easily replace your system, just swap your failing SD for the backup SD.

Put a Fat32 formatted SD card in a USB SD card reader/writer and plug it into your Pi USB port.

Read how to format a SD card with Fat32 Here scroll down to the format section.

To start the process open a Terminal window from Accessories menu.
Terminal window ready to go.


In the open a Terminal window type: df -h

The out put of the df -h command showing the list of mounted devices

You will get a list of mounted devices. Check the device name, in my case /dev/sdc1. Ignore the last character that is a number, in my case 1. As can be seen this card has been formatted with a Volume name of SITE.

In the screen capture its listed as /dev/sdc1  120G 128k 120G /media/pi/SITE  which makes sense because its a 128Gb SD card and has 128k used, and has 120Gb free.

Open SD Card Copier from Accessories menu.
Selecting the SD Card copy tool from the Accessories menu


In Copy From Device select the internal SD card /dev/mmcblk0
In Copy To Device select the device that matches the device from the terminal list, in my case /dev/sdc
Do not check New Partition UUIDs or it may not work correctly on your copy.

The /dev/mmcblk0  selected as copy from device and the /dev/sdc selected as copy to device
Press Start,
If your happy with your choices press the yes button

Getting the new SD card ready for the copy 

Just about ready to start the copy of data

Copy under way the first four partitions went by quickly

Your done 

After waiting 10 to 15 minutes you are done. I shutdown and remove the SD card carrier. Now put the copied SD into a safe place.


If you do not have an USB card reader/writer you can use the same method you would use to write an image to a new card.  Here is a link to the Raspberry Pi org site detailing how to use your Windows PC to install operating system images. Here is how to do it using a MAC.
-----------------------------------------------------


If after you are up and running and have made some changes and need to back up your system again you can write over the SD card you have made as a backup (as above). The first step ( df -h command) is the same but the out put on the screen looks different. The steps are the same, you are still copying to the sdc (SD Card). You will still copy to /dev/sdc


The window below is the output of the df -h command, showing the different partitions, of the same sd card (sdc).

The df -h command out put on the screen showing the different sdc partitions 

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.

A Raspberry Pi running OpenCPN

While having an afternoon coffee on a neighbors boat I noticed a small printed circuit board connected by HDMI cable to the monitor/TV on the bulkhead. I was intrigued, what is that board? I asked. At first glance I thought it was a video casting device, TV tuner or power adapter of some sort. Turning it on he explained it was a Raspberry Pi running OpenCPN and was a very powerful small computer. He had been using this one or previous models as a navigation aid running OpenCPN for a year or two and he was very happy with its performance.

Raspberry Pi in its case running OpenCPN which is part of the OpenPlotter install package

Later in the afternoon we did passage planning using OpenCPN running on the Raspberry Pi.  I didn’t notice any performance issues and was most impressed with this micro sized computer.  We looked over anchorages zooming in and out, making routes and updating waypoints. We revisited anchorages we had used when we had explored the areas he and his wife were about to travel to and I must say I that if I didn’t know OpenCPN wasn’t being run on a laptop I would not have been any the wiser. We also down loaded some layers containing our old tracks and routes, and added some .KAP files to his electronic chart directories. All these worked just like OpenCPN we use on our laptop. 

Unfortunately we didn’t get time to talk more about the Raspberry Pi. We had an early night as we had to leave the next morning early to catch the tide. Then getting busy with our own passages I didn’t really give the Raspberry Pi another thought for several months until I was updating OpenCPN and saw the link for the Raspberry Pi software.
https://opencpn.org/

I did a little research and not surprisingly found there is a large community of sailors using these small powerful computers to handle a vast range of tasks on board.

We run a laptop with open-source OpenCPN navigation software and it does have some nice features, written by sailors for sailors. The laptop works fine as does the OpenCPN software. Like most electronics they have a limited life span and our laptop is getting long in the tooth and it always sits in the middle of the chart table on passage which can be annoying. It would be nice to have a built in integrated system networked to the rest of the boat. Until recently we would have to plug in the serial to USB converters to supply the OpenCPN with GPS and AIS data. After installing a small Wi-Fi access point to send the serial data streams to OpenCPN on the laptop we found it was a lot easier to use. While this is good we still need to supply power via cable to the laptop.
OpenPlotter remote desktop display on the mobile phone.

We think it is time for an upgrade. So for our next system we would like a low cost option while having a big range of features reserved for the more expensive chart plotters. You know things like Wi-Fi connect ability, data quality analysis, the ability for remote desk tops, and an access point for sharing the navigation data with smartphones and tablets.

So following the lead of the large community of sailors using Raspberry Pi’s I have started to build my next chart plotter using one as a core. As I have said before Raspberry Pi is a low cost, low power consumption computer when compared to a standard laptop, or chart plotter. An added benefit is that additional boards and sensors don’t cost a lot either. If you have a trailer sailor and want a chart plotter with big features that won’t bleed your battery(s) or wallet dry this may be something to look into. There are several display/monitor options for the RPI that should work on the trailer sailor that wont require massive power reserves.
Running a comparison between OpenPlotter rear screen with our trusty laptop looking very good.
So I had a couple of decisions to make, should I buy a Raspberry Pi and just install OpenCPN and use it as a bare bones unit. Or should I start from scratch and build an integrated system. I decided the build from scratch would be way too time consuming. The reality is I cannot really remember the last time I used UNIX with purpose or wrote code, and I wanted a chart plotter this century. I know I could have and was prepared to use some of the shared code offered on several web sites. Unfortunately upgraded operating systems could mean this shared code was no longer valid.

So after reading a quote from the author on a site I had been following with interest as he built a system from scratch, “well that’s it for me I am going to use OpenPlotter”. 
OpenPlotter install running on a Raspberry Pi

So what is OpenPlotter? After some more research I found out that it’s a combination of software and hardware to be used as a navigational aid on small and medium boats. It is also the hub of an on board vessel automation system. It runs on the Raspberry Pi and is open-source. The design is modular, so once you have the core system up and running you can start to implement what your boat needs. For lists of the current OpenPlotter software features visit.  http://www.sailoog.com/openplotter/


To see our install Click this link to see what we did and how we did it.  I step through our install with screen shots. OpenPlotter, and with it OpenCPN was up and running on our new Raspberry Pi in a short time.