August/September 2019: updated as RaspBIAN has changed version to Buster (RaspBIAN 10), and current versions of CumulusMX (v3044 and later) no longer require workarounds to install an older version of mono for certain USB weather stations. Mono has now been updated to version 6.0.0.334.
01 Mar 2020: I have been making minor changes in response to comments and fixes when system changes meant something did not work quite as before. Please continue telling m of any apparent bugs/errors. We seem to have a community who will help!
Buy equipment
• Raspberry Pi Zero W
o A faster Pi is NOT needed for running Cumulus. Pi Zero W has WiFi and one USB port which is all that is needed for headless running.
o Using a faster Pi might speed parts of the installation process, but are overkill for actual ‘production’ running. A faster Pi will work fine though if you have one going spare and don't mind the extra power use.
o Case if desired
• Micro SD card eg 16 GB, decent quality. Adapter if needed to put Micro SD card in PC
• OTG cable (micro USB plug to standard USB socket) to connect a USB weather station to Raspberry Pi [you may have got one free with a mobile phone or tablet] if it's a USB weather station. Not needed if you have a WiFi or ethernet weather station. An Ethernet weather station will need connected to your router, not the Pi.
• Suitable Micro USB power supply (it does not need to be a high power 2.5A version for Pi Zero W with only the weather station attached; it will be powered on 24/7, so a low power consumption ‘switched mode’ type is preferred – ie one that does not become warm when plugged in with nothing attached. You may have a suitable one from a mobile phone.
Download useful PC software and install on your PC
These instructions are for a Windows PC. Steps would be similar on a Mac, but programs and details would differ. Should also be possible with an Android tablet.
• SD Formatter (the Windows Format facility will NOT do)
o https://www.sdcard.org/downloads/formatter_4/index.html
• balenaEtcher (for unzipping and burning images to SD cards) [Previously named 'Etcher']
o https://etcher.io/
• Win32DiskImager (for backup & restore of SD card images)
o https://sourceforge.net/projects/win32diskimager/
• PuTTY (an SSH client for Windows)
o https://www.putty.org/
• FileZilla (an FTP file transfer program for Windows)
o https://filezilla-project.org/download.php
Download Raspbian Pi Operating System
• Save it on your PC, from https://www.raspberrypi.org/downloads/raspbian/
• "RaspBIAN Buster Lite" is probably OK, but other than small file size it offers no advantage over installing the full version of RaspBIAN Buster. These instructions are being tested using "Raspbian Buster with desktop and recommended software", the largest of all, which could allow you to do other things more easily.
• Just click on “Download Zip” (torrent might be faster if you have the ability, but not worth installing just for this)
• Do not unzip it
• These instructions have been tested with kernel version 4.14, released 18 April 2018 and with kernel version 4.14, released 13 November 2018 [March 2019] and kernel version 4.19 released 10 July 2019
Install Pi Operating System onto Micro SD card
Format the SD card
• Put Micro SD card in PC (use adapter if needed)
o If re-using a previous Pi SD card, click ‘Cancel’ on the warning about needing to format the card
• Run SD Card Formatter (click Yes to ‘Allow to make changes to your device’).
o Need to use this program rather than the Format tool in File Explorer, because Pi SD cards end up with a very small ‘Windows accessible’ partition and a large partition containing Linux. SD Card Formatter allows reclaim of the large partition.
• Your SD card should automatically populate in the ‘Drive’ box. In case you have another SD card in your PC, ensure the correct card is selected!
• Click ‘Format’ and check and accept the Warning messages
Copy the Pi Raspbian Operating System onto the card
• Run balenaEtcher on your PC
• Click ‘Select Image’ and choose the ‘Raspbian Buster’ operating system zip file that was downloaded earlier
• SD card should be automatically populated. In case you have another SD card in your PC, ensure the correct card is selected!
• Click ‘Flash!’. The operating system will be copied to the card. This takes about 10 minutes, followed by another 8 minutes to ‘Verify’
• Cancel any messages about needing to Format the card - they are just indicating that Etcher has installed the partition that cannot be read by Windows
• On completion, the card is ‘ejected’ from the PC. Physically remove it and then straight away reinsert it so that the content can be viewed in File Explorer
• TWO drives will now be visible for the SD card. You will likely see a warning that one of the drives needs to be formatted before it can be used. ‘Cancel’ that warning and ignore that drive.
• View the other drive, which is named ‘boot’ in File Explorer
• On the View tab, ensure the ‘File Name extensions’ is ticked
• Right click and select ‘New’, ‘Text document’. Change its name to SSH (deleting the .txt extension; you need to make an empty file called SSH not SSH.txt). Click ‘Yes’ to ‘Are you sure you want to change the extension?’
• Right click and select ‘New’, ‘Text document’. Change its name to wpa_supplicant.conf (deleting the .txt extension; you need to make a file called wpa_supplicant.conf not wpa_supplicant.conf.txt). Click ‘Yes’ to ‘Are you sure you want to change the extension?’
• Right click on this new file and select ‘Open with Notepad’ or ‘Open with …’ then select Notepad. Enter the following content exactly as below (copy and paste) then edit your country code (if needed), WiFi network’s SSID and password: NOTE: Change GB as needed to be the code for your country. The quote marks should appear in the file, that is ssid="YourNetwork" not ssid=YourNetwork . Same for psk.
Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="YourNetwork"
psk="YourNetworkPassword"
key_mgmt=WPA-PSK
}
• The function of these 2 files is to connect your Raspberry Pi to your network as soon as it boots, and allows you to connect to and control it from your PC by SSH using PuTTY. This avoids needing to connect a keyboard, mouse and monitor to the Raspberry Pi. It is particularly useful for Pi Zero W (or Pi Zero) which hasn’t got enough USB connections and no Ethernet (wired network) connection. This is called ‘Headless operation’.
• Right click on the ‘boot’ SD card in left pane of File Explorer and ‘Eject’ it safely.
Setting up the Raspberry Pi
• With nothing plugged into the Raspberry Pi, take the Micro SD card from your PC and put it in the Pi.
• In a later step, you will need to find out the Raspberry Pi’s IP address by looking at your network router’s web interface. I can’t help you with doing that. If you don’t know how to, an alternative is to connect a keyboard, mouse and monitor to the Raspberry Pi at this stage
• Plug the power supply into the Raspberry Pi. It will boot up (note flashing red and/or green LEDs depending on model).
• On your PC, log into your network router’s web interface and identify the Pi’s IP address, which will be in the form xxx.xxx.xxx.xxx, for example 192.168.1.123
o NOTE: If you will be switching from a faster “build” Raspberry Pi to a “production” Raspberry Pi Zero W, the IP address will change, so you’ll need to repeat this step later
o While in your network router for the ‘production’ Pi you will be using, set up some port forwarding that will be needed later.
o Forward port 8998 to your Pi’s IP address for TCP protocol if you want to be able to access the Cumulus web interface from the external internet (this brings potential security risk though). [Forwarding port 8002 as well was previously needed].
• Start PuTTY on your PC. In the box for ‘Host Name or IP address’, enter the Pi’s IP address from above. In the adjacent ‘Port’ box, enter 22. Connection type should be SSH. Click ‘Open’.
• A window opens. The first time you do this you will probably see a long message asking to confirm it is OK to connect to a not-previously-known device. Click ‘Yes’.
• Login to the Pi. Username is pi [lower case] and password is raspberry [lower case]
• You will see a warning that SSH is enabled but the password has not been changed, which is a security risk. We will change the password in a moment
• Type
Code: Select all
sudo raspi-config
• As needed, adjust the following settings:
o Change the password to something you will remember. Leaving it at raspberry is a serious security risk – exposes your whole network to hackers
o In Network Options,
change the name of your pi to ‘Cumulus’ or something you prefer
WiFi network and password have already been set by the wpa-supplicant.conf file added earlier
o In Boot Options, Desktop / CLI, select ‘Console Autologin’
o In Localisation Options,
change ‘Locale’ if you need something different to en_GB.UTF-8. [Changing this takes quite a while on a slow Pi]. [As of Sep/Oct 2019, there is some kind of incompatibility between RaspBIAN Buster, mono v6.0.0.314 and locales other that en_GB - so unless you NEED another locale, it would be better to leave it as en_GB. The alternative is to force load an older version of Mono, for example v5.18]
Change Timezone.
Change Keyboard Layout if needed
WiFi country has already been set by the wpa-supplicant.conf file added earlier
o In Interfacing options, SSH server has already been set to be enabled by the empty SSH file added earlier
o Select ‘Finish’. There is no need to reboot at this stage. But until you do, you will see messages "sudo: unable to resolve host raspberrypi", but these can be safely ignored (it's just because you renamed the Pi - will disappear after next reboot)
In the steps below, you will need to press y to agree to proceed at various times
If you have been building the Micro SD card on a fast Pi, now is the time to switch to the 'production' Pi, for which a slower Pi Zero W is more than adequate.
Shut down the Raspberry Pi safely.
Code: Select all
sudo halt
Power on the Pi Zero W. Your SSH (PuTTY) session will close out and you'll need to reconnect after the Pi has rebooted. Use username pi and the new password you chose earlier.
Add the ‘Mono’ package
• Simplification: Mono is a package which allows programs to be written cross-platform so that they will run on Linux (including Raspberry Pi), Windows and Mac OS, similar to the Windows ‘.NET Framework’.
• The previous anomaly with the USB library not working with later versions of mono, affecting Fine Offset stations and the later Oregon Scientific stations (WMR88/100/200 etc) has been fixed (in CumulusMX build 3044 onwards) and these and other stations should now be fine with later/current versions of mono. I am currently using a Fine Offset with mono v5.18
• Process is to install a security certificate, add the mono server to the list of software sources [sources.list] that the Pi searches, then install the mono-complete package:
Code: Select all
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 -y mono-complete
sudo apt autoremove
NOTE: 29 Feb 2020: added -y into the line sudo apt-get install -y mono-complete . This makes the install bypass the usual 'Continue Y/n?' prompt¨which was causing starnge problems for some, eg worked if just pressed 'Enter' to accept default 'Y', but aborted intallation if pressed 'Y Enter'. Bizarre.
Reboot your Raspberry Pi
This would be a reasonable time to reboot your Pi:
Code: Select all
sudo reboot
Install Cumulus on the Raspberry Pi
The download link is at the end of the (long) first post in https://cumulus.hosiene.co.uk/viewtopic.php?f=27&t=12908 but you must sign up and log into the forum to see it. It’s a file called CumulusMXDist3050ip [August2019, maybe a later version]. Download it to your PC, unzip on your PC which makes a directory named CumulusMX. Remember where that directory is located then on PC run FileZilla
o In the ‘Host’ box, enter the Raspberry Pi’s IP address eg 192.168.1.123
o In Username, enter pi
o In Password enter your pi’s password
o In Port, enter 22
o Click ‘Quickconnect’. Raspberry Pi’s directory structure appears on the right and your PC’s directory structure is on the left.
o 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
o 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)
o 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
o Close FileZilla
On Raspberry Pi PuTTY window:
Code: Select all
sudo halt
If you have an ethernet or WiFi linked weather station then you won't need to do this - I don't have one so I don't know exact details. Steve below says you need to enter the IP address during Cumulus setup, but then also adjust a disconnect period if you are also using Weatherlink software.
Running Cumulus
On PC, run PuTTY again and log in to the Pi as before (note you can save the IP address between sessions)
Code: Select all
cd ~/CumulusMX
sudo mono CumulusMX.exe
To make Cumulus run each time the Pi is rebooted (and force reboot in the early hours each day)
On the Pi, type:
Code: Select all
sudo crontab -e
Then add the following lines at the end of the file:
Code: Select all
# Start Cumulus as background task 30s after reboot (delay to allow WiFi to startup)
@reboot (sleep 30;cd /home/pi/CumulusMX;sudo mono CumulusMX.exe) &
# Reboot each day at 0253
53 02 * * * sudo reboot
type
Code: Select all
sudo crontab -e
Ctrl-X to save the change to crontab and reboot using
Code: Select all
sudo reboot
To revert to normal auto-running of CumulusMX, go through the same again, but this time edit crontab to remove the # from the start of the line "@reboot...". Save changes and reboot - CumulusMX will be running.
Updating a version of CumulusMX is easily done as follows:
1. Stop CumulusMX running (it locks files while it is running)
2. Install the updated CumulusMX version into a new directory - I call mine CumulusMX3050 so that I can easily see which build it is
3. copy the following from the old CumulusMX directory to the new CumulusMX3050 directory:
- your CumulusMX/Cumulus.ini file
- your CumulusMX/data directory
- your CumulusMX/twitter.txt file (if you have personalised it)
- your CumulusMX/web directory (if you have personalised any web files)
4. Change your startup instruction to use the version in the new directory eg cd /home/pi/CumulusMX3050;sudo mono CumulusMX.exe
With that method you can easily revert back to the old version if something has gone wrong. If all is well, you can delete the old directory after a few days/weeks/months/if you need the space.
Updating mono version
First, stop CumulusMX as above by editing crontab.
Then remove the present version of mono:
Code: Select all
sudo apt-get purge libmono* cli-common mono-runtime
sudo apt-get autoremove
Code: Select all
sudo apt-get install mono-complete
and finally
Code: Select all
sudo reboot