Setting up Meteo-Pi (Part 2)

Part 1 of this blog post can be found here. If you’ve arrived directly here at Part 2 then you might wish to read part 1 first for some extra background and especially for advice on selecting the best Pi version and SD cards.

Detailed instructions for setting up Meteo-Pi

Overview

Note: The main support resource for Meteo-Pi is on this WXForum thread. If you have a problem please make a post to this forum (you will need to register (free) if you’re not already a member).

Almost all of the preparatory work in setting up a new Meteo-Pi revolves around preparing the SD card and installing your preferred weather station software (ie CumulusMX or weewx or a Pi-compatible version of Weather Display or something else). Actually fitting the Meteo-Pi and making the console connection is pretty straightforward.

Setting up the SD card for a new Pi + Meteo-Pi unit from scratch involves several steps, including loading the Raspbian operating system, checking for updates and installing the weather station software (for which we’ll use CumulusMX as an example). However, many users will not need to perform all of the steps because, for example, you can buy SD cards with the Raspbian operating system already loaded. Or, if you’re an experienced Pi user then you will likely have some suitable SD cards already prepared.

And then there are different ways in which the Pi can be run, ie headless or not. And, of course, different weather station programs will each have their own installation instructions. It’s tricky therefore to write a single set of instructions to cover all possible scenarios. So the notes below aim to cover most parts of the set-up process, but you’ll need to pick and choose according to what’s relevant to your experience and planned usage. The two main stages are:

  • Hardware assembly: This is described first because users often like to know how the pieces fit together, even though we suggest you do it after the Pi is up and running;
  • Configuring the SD card – the various steps, some of which may not be needed, are detailed below;

It’s perhaps worth adding that if you’ve never set up a Pi before then the instructions can seem unfamiliar and a little long and daunting. And it’s true that there’s something of a learning curve involved. But it’s honestly simpler than it may seem at first glance and can be a fascinating and rewarding project, with plenty of support available from around the web, given the popularity of the Raspberry Pi devices. Just please read the instructions carefully and take one step at a time.

Hardware assembly

Connecting the Meteo-Pi unit to a Vue/VP2 console is simple. The only important caveat is that connections to the console and Pi are performed with both fully powered off. We would suggest getting the Pi and SD card up and running first and then powering off and fitting the Meteo-Pi unit, but this is really up to you and your experience with Pi’s.

For orientation, the top surface of the Meteo-Pi has the RJ11 socket and coin battery uppermost.

[Image to be added]

  • Meteo-Pi is supplied with two header/pin adapters: a male-to-female pin adapter with longer pins and the other a thinner one with pins on both sides. Most users will need only the male-to-female one and the thinner one can be set aside**. The long pins of the M-F adapter need to be pushed through the header on the Meteo-Pi unit from the underside of the MP unit so that the excess pin length protrudes above the header body. (These pins are then available for extra pass-through connections to the Pi underneath, should these ever be needed.)  So, carefully line up the long pins on the M-F adapter with the underside of the header on your Pi and press firmly home until the adapter body butts up the the Meteo-Pi PCB. this will leave the female body of the adapter on the underside of the Meteo-Pi unit;
  • Fit the Meteo-Pi to the Pi itself, lining up the female adapter on the MP underside with the protruding header pins on the Pi. This provides a reasonably solid piece of hardware, but adding a spacer and a couple of screws, plus a small case makes for a neater overall product – suggested details on this will be added shortly;
  • Insert the console adapter into the console as with any Vue/VP2 logger and press firmly home;
  • Connect console and Pi with the cable provided. NB You’ll find that there are actually two cables provided, one with 4 conductors and one with 6 conductors. We suggest that you start with the 4-conductor one. The 6-conductor option allows the console to be powered from the Pi but we suggest that you only use this option if required and that the unit be set up initially with the 4-conductor cable.

** This thinner adapter is supplied for use with the basic Pi Zero version which has no pre-soldered header. This is not a version recommended for Meteo-Pi because the thinner adapter will need to be soldered in place by the user. Instead, the recommended Pi Zero version is the one called Pi Zero WH (W = WiFi; H = presoldered header). Pi versions other than the Pi Zero all have presoldered headers.

Configuring the SD card

What follows is the complete sequence of steps to set up a new Meteo-Pi unit from scratch and using CumulusMX as your chosen weather station program. But if, for example, you decided to buy an SD card preloaded with Raspbian and not to run the Pi headless then you could jump right in at step 3. And a different weather station program might not need Mono installation at step 4. So the sequence of steps will depend on exactly how you choose to configure Meteo-Pi.

  1. Create or buy an SD card loaded with Raspbian software;
  2. For headless running, add a couple of extra commands to the card;
  3. Prepare the SD card for use with Meteo-Pi by configuring the serial port;
  4. Install the SD card into the Pi, boot up the Pi and ensure Raspbian is updated to the latest available version;
  5. Begin installing CumulusMX by first installing the Mono library;
  6. Install CumulusMX itself;
  7. Configure CumulusMX and check for correct running;

NB It could be that in future someone will offer a Pi SD card preconfigured for a particular weather station program (or an SD card image ready for download) and essentially ready to roll as a turnkey Meteo-Pi solution. But until that day dawns then it will be necessary to run through at least some of steps above.

Below are the core steps in getting a new Meteo-Pi installation running. There is more detail and more explanation in the additional sections further below. There is also a detailed description of all the steps involved available online on the CumulusMX forum (the first post is kept up-to-date as a full description, the rest of the thread being various comments and questions that have been added over time). The notes below are an abridged version of these full instructions, also adapted specifically to Meteo-Pi.

Let’s start with the assumption that an SD card with Raspbian pre-installed has been purchased and that the Pi is being run with KVM (keyboard/video display/mouse) attached, ie not being run headless. Instructions for making the SD card and for running headless as an alternative will be found further below. So we’re effectively starting at Step 3 in the sequence above.

Key steps

We assume also that we’re working with the Pi alone:

  • The Meteo-Pi HAT is not yet installed (we can leave this step until later in the sequence);
  • The micro SD card is inserted into its holder;
  • KVM connections are all made;
  • A micro-USB power supply is connected but not yet switched on;

We’ll outline the key steps here, but more detailed instructions & explanations for initial switch-on are available for new users at the Raspberry Pi website. (But remember that we’re assuming that Raspbian has been preinstalled on the SD card, so the instruction steps about installing Raspbian or NOOBS can be ignored.) So:

Step 3 Set the serial port configuration for Meteo-Pi

Meteo-Pi is designed so that data is presented to the Pi on a serial port. But a slight change to the default serial configuration of the Pi is required which needs a couple of edits to text files in the Pi’s boot directory. These two files are both accessible from Windows so the necessary changes can be made with a simple text editor either eg on a Windows PC before the card is placed in the Pi or, if more convenient, on the Pi itself (in which case a reboot is needed after both edits are made). The two changes required are:

edit /boot/config.txt and add on the end
“enable_uart=1”

edit /boot/cmdline.txt and remove
“console=serial0,115200”

Step 4 Power-on and first configuration of the Pi

Modern versions of the Raspbian OS boot, after 20-30 seconds, into the GUI (graphic user interface) or desktop at first power-on. This is obviously a similar concept to Windows, but the layout and details are different.

After a short while, the configuration wizard should start, which asks for a series of configuration inputs like:

  • Language, locale etc;
  • A memorable new password – it’s strongly recommended to change away from the default password of ‘raspberry’;
  • Credentials for your WiFi network.Most users will prefer WiFi for their network connectivity and for Pi Zero W devices WiFi is the only easy option;
  • The final set-up step is to allow the automatic software update to run. This can take some time to complete, potentially 20-30 minutes, especially if you have a slow Internet connection or one of the slower Pi models;
  • When this last step is complete then accept the option to restart/reboot the Pi and check that all seems OK, including Internet connectivity;

Step 4A Pause for breath & orientation

At this stage, basic configuration of the Pi is complete and your Pi should be up and running with a new SD card. This is a good point for a pause to recap on a handful of important basic points for using the Pi:

Shutdown & Reboots: You will have noticed that the Pi has no on/off power switch. But, as with any computer, it’s never a good idea to turn off the mains adapter abruptly. Instead, if you’re in the main Pi Desktop, you’ll see a shutdown option on the main menu which gives you an option of shutdown or reboot. You’ll rarely want to use shutdown unless eg you’re moving the Pi or changing the SD card, but if you do want to power down the Pi this is the option to choose and allow some seconds for the Pi to close down all its processing. More often, you may want to reboot the Pi eg after making a significant change to the configuration and the reboot option is the obvious choice here. Note that to turn the Pi on again after a power-down you’ll need to remove the micro USB power input and then plug it in again. (There are other ways to trigger shutdowns and reboots from the Terminal – see below.)

Terminal utility: Traditionally, Linux-based computers like the Pi have used text commands (eg as in DOS or Windows Command Prompt) much more extensively than Windows. The utility that allows text commands to be entered in Raspbian is known as the Terminal and even if you prefer to interact with a Pi via its graphic user interface, it’s still a good idea to know a little about Terminal and its basic use – using Terminal for basic tasks is very straightforward but a powerful and sometimes essential way of performing certain maintenance tasks.

The terminal can be accessed in one of three ways: Many experienced users prefer a Pi to boot into the terminal rather than the desktop GUI interface, which is controlled by a simple setting in the Pi startup configuration. So for many users the terminal is automatically the first thing they see. Second, if you prefer to boot to the desktop GUI then the terminal can be started from the Terminal icon in the top toolbar or by selecting Terminal from the Accessories menu. This opens a smaller window running terminal functions. Finally, terminal mode can be accessed remotely from another computer on your network by using a a terminal emulator utility such as PuTTY – this is the commonest way of controlling a Pi when run in headless mode using remote access via SSH.

Installation of your preferred weather station software can now be carried out.

Step 5 Installation of Mono for CumulusMX

This step is included specifically if you are wanting to use CumulusMX software. Other weather station programs may well not need Mono (in which case this step is not required) or have different requirements.

Detailed instructions for installing CumulusMX are available on the Cumulus forum, which cover the full and complete process starting from a blank SD card. Users who have completed Step 3 above need only pick up the CumulusMX instructions from the step labelled ‘ Add the ‘Mono’ package’ –  the relevant instructions are repeated here.

CumulusMX is written in a language that requires a helper library called Mono to be installed, hence the need for this step 4. (But Mono also has the great advantage that it allows the same CumulusMX program to run on any operating system that supports Mono, which includes Windows.)

Installing Mono is perhaps the trickiest step in the whole of the Meteo-Pi set-up (but tricky only in the sense that a set of seven commands must be typed or copied in that are exactly accurate to the letter). The 7 commands must be entered one at a time and each step allowed to complete before entering the next step. It is simplest to copy and paste each command in sequence from an authoritative reference source. The 7 lines are as follows:

sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo “deb https://download.mono-project.com/repo/debian stable-raspbianbuster main” | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install mono-complete
sudo apt autoremove

Each line has a specific purpose and needs to be entered exactly (other than font colour) as shown here, followed by return/enter to allow the command to run and complete. Do not enter a new command until the previous one has completed – for the 6th step (which actually installs Mono) this can take a long time (eg 20-30 minutes) on a slow Pi – do not be misled into thinking that the Pi has hung, it is just taking a long time!

At the end of this step, the Pi should be rebooted with a check that no error messages appear.

Step 6 Installation of CumulusMX itself

The preceding steps have all taken advantage of the fact that standard Raspbian and Mono libraries have been accessible from what’s know as a Repository (or ‘repo’), which is an official secure source of the operating system and supporting libraries and which has standard commands like apt get etc to manage and install the downloads. CumulusMX does not yet have the privilege of residing in an official repo and so must be downloaded and installed via a different process.

The simplest approach for CumulusMX is first to download it to a different computer such as a standard Windows desktop and then to transfer all the component files to the Pi, as follows:

  • Download the latest version of CumulusMX from https://cumuluswiki.wxforum.net/a/Software to a known location on your main computer. At the time of writing the current version is v3053, but newer versions will be posted from time to time. This link should automatically download the latest available version;
  • CumulusMX will download as a zip file which then needs to be unzipped. The result should be a folder still on the main computer called CumulusMX and containing several hundred component files;
  • The next step is to copy this complete folder to the Pi computer. This needs to be done using a network file transfer utility – an FTP utility. There are several FTP utilities that can be used here but the recommended option is a free FTP client called FileZilla which can be downloaded from: https://filezilla-project.org/download.php?type=client (NB It is the FileZilla Client that you need, NOT FileZilla Server version.);
  • Filezilla is relatively easy and intuitive to use, especially for the very simple task of copying files to the Pi. But if you’ve never used Filezilla before then it will obviously feel unfamiliar and it might be worth reviewing a basic FileZilla tutorial on Youtube first, such as https://www.youtube.com/watch?v=adxmlHDim6c. FileZilla essentially transfers folders and files from one location to another. As you look at its interface the left-hand panes show files available on the source computer and the right-hand panes show files & folders on the target computer – the Pi in this case. So the basic task is to move files from left-hand to right-hand panes. FileZilla is a network file transfer utility which is typically used for uploading files to a web server with all the user authentication usually involved in that process. In this instance we’re simply moving files to another computer on the same network, but the target computer still needs to be identified by its IP address, port number and log-in credentials.
  • A key step in using Filezilla is that you must know the IP address of the Pi computer. There are various ways of approaching this, including looking at your router’s connectivity table (eg look for ‘Attached devices’) or another option is to use a free network scanner like AngryIP. But one way or another you must establish the Pi’s IP address;
  • Then, in Filezilla, enter the Pi’s IP address, the host as ‘pi’, the password for the pi, and set the port as 22. You should then be able to achieve a connection to the Pi.
  • In the LEFT window, navigate to where you unzipped the download of Cumulus MX earlier. Ensure can see the folder name ‘CumulusMX’ in the lower left window;
  • In the RIGHT window, ensure that the folder /home/pi is shown (see top right window; contents in bottom right window include .cache, .config etc);
  • Drag the folder ‘CumulusMX’ to an empty area in the lower right window (not onto one of the existing directories). Watch progress as this copies the whole CumulusMX folder and contents to directory ~/CumulusMX on the Pi. This may take a while – be patient!

This should complete the transfer of all CumulusMX files to the Pi’s SD card. When finished Filezilla can be closed.

Incomplete – further instructions yet to be added;

Supplementary SD card instructions

This section contains further detail on some of the steps listed above.

Create an SD card with the Raspian operating system loaded (Step 1 above)

This is a surprisingly easy process using some free software called Etcher. Detailed instructions can be found on the Raspberry-Spy website. At the time of writing, the latest version of Raspbian is called ‘Buster’ and we recommend downloading the ‘Raspbian Buster with desktop’ version.

Running headless (Step 2 above)

Running headless means controlling your Pi from another computer on your local network. If your Pi has WiFi onboard then absolutely no connection is needed to the Pi other than a mains adapter and (for present purposes) the Meteo-Pi connection. There are two separate aspects to setting up a headless Pi: ssh; and WiFi connectivity.

ssh is the key element in enabling control from another computer on your network using a terminal emulator utility like PuTTY. ssh is effectively a setting that needs to be enabled on your Pi.

WiFi connectivity is important as a potential Catch-22 tripwire. All Pi models other than the Pi Zero have cabled Ethernet connectivity as an option so this can be used remotely to enable WiFi connectivity. However, Pi Zero models have no cabled option and must rely on WiFi (where fitted, eg as in the Pi Zero W). So there’s an issue as to how you can configure WiFi remotely when no WiFi connection is available 🙂 . Fortunately there is a workaround for this based on placing a text file on the SD card before first start-up of the Pi.

Further details are available on the Raspberry Pi website.