Raspberry Pi computer page: Difference between revisions
m (Existing text moved onto this page) |
m (add link) |
||
Line 470: | Line 470: | ||
Use of FTP or SFTP was described earlier at [[#using file transfer]]. |
Use of FTP or SFTP was described earlier at [[#using file transfer]]. |
||
=Web Server and Database Server= |
|||
As this is quite technical it warrants its own [[Your Own Server]] page. |
|||
[[Category:Cumulus MX]] |
[[Category:Cumulus MX]] |
Latest revision as of 17:33, 17 May 2021
The Raspberry Pi micro-computer
The Raspberry Pi computer (RPi) is a small board of electronics. The board can be bought separately to the micro-SD card that it will boot from. There is a choice of operating system (OS) that can be processed by the board. The available OS choices include Windows, Mac OS, Chrome OS, various Linux distributions, or the Raspberry Pi OS (based on Ubantu Linux).
On this Wiki page, the focus is on the last OS, Raspberry Pi Operating System, because that is easiest to install, and includes extra features specially designed to make using a RPi easier.
If you want to install a different OS, you may use a micro-SD card that includes Novel Out of Box Software (NOOBS), as that (when your RPi has a wired Ethernet connection to internet) can download and install a variety of OS.
If your micro-SD card does not have a pre-installed OS, and it don't have NOOBS, then please use a search engine to find an operating system thatsuits you, and instructions on how to install it on a micro-SD card.
The article will give you some guidance on:
- Choosing a Pi model to buy
- Setting up a Raspberry Pi,
- Installing OS (the NOOBS described here can install various OS, you choose which one you want)
- Installing Mono (needed on any Linux based OS, but can even run on Windows!)
- Installing MX
- Running MX (these notes apply to any Linux OS, but some hints need consideration even in Windows)
It also covers some included functionality and some optional extras for you RPi.
There are relatively few posts in the Cumuus Support forum from people struggling with setting up the Raspberry Pi, and several posts reporting success with using MX on this small computer.
Linux is better than Windows
It is recognised that some people might be experienced Windows PC users, and perhaps scared of learning Linux; this page may persuade people that actually a Raspberry Pi (RPi) computer can be used instead of their Windows PC for all their tasks. Here are a few facts:
- The Raspberry Pi is a simple computer that is far easier to learn than a complicated machine like a Personal Computer (PC) running Windows.
- There are various operating systems (OS) that you can use on a RPi
- It can run a small version of the Windows operating system, the same as the one that is pre-installed on certain modern white goods.
- This page focusses on the simpler Raspberry Pi operating system (based on debian Linux) as it works on a RPi.
- You don't need to learn much Linux, but this article does cover some commands.
- A RPi is small in size so does not intrude into your home
- A RPi uses much less power than a PC, and so can be left running, while a PC wastes a lot of electricity if left running.
- The Raspberry Pi is a computer that is better for the environment during manufacture, its single board has just a small number of components, unlike a PC manufactured with lot of components.
- A Windows computer is frequently interrupted by Microsoft software updates, most of which require a reboot. Linux computers don't do automatic updates, software can be upgraded, or replaced, by manual instruction without (except for kernal updates) a reboot.
- A RPi can do word processing, spreadsheets, database tasks, drawing tasks, display images, play sounds and videos, let you use email, play games etc.
- It is simplest to connect keyboard and monitor to the Raspberry Pi so all actions are done directly on it.
- Another option discussed is using a PC to control a "headless" Raspberry Pi (i.e. one without keyboard and without monitor).
- A RPi is the ideal device to run Cumulus MX, and (if you want) the same RPi can run a database server and/or web server (on which you can run the example web pages provided, or create your own variants)
- Downloading the MX release distribution, and unzipping the files, is effectively the same on any device.
- On Linux you need to (simply) manually install one extra component (Mono-complete) to run the executables included in MX, (the equivalent component (.NET) is automatically pre-installed on Windows).
- Running MX is same on any device (precise command syntax to start it varies, but what MX does when running is largely independent of device)
Image alternative
If you have a spare Raspberry Pi, and a spare micro-SD card, that are not being used, there is an alternative to following the detailed guidance later on this page.
Instead, all you need to do is download one image file onto the micro-SD card before you insert it into your RPi and let it boot. The single download file is available at Software page Current_Release section.
This image includes the "lite" edition of RPi OS, it also includes a mono-complete package, and includes a modified MX distribution, all on that single download.
Choose it if:
- you are never going to use a keyboard nor TV (or other monitor) with your Raspberry Pi,
- and you don't want to use any other software on your RPi.
Read about using it on Raspberry_Pi_Image page:
- If you are new to MX, after booting from image, you will need to use the admin interface to define station type, your choice of units, and some other settings, before MX can start recording data from the connected weather station.
- If you are migrating from another computer, after booting from image, you need to add (using an external memory stick or file transfer from your other device to the RPi), the following:
- (mandatory) Cumulus.ini,
- (optional) strings.ini,
- (mandatory) all files from old data sub-folder,
- and any (optional) files from old Reports sub-folder.
Setting up RPi manually
You can find, online, instructions (and videos) about setting up a Pi, these describe all the necessary steps that are described below from buying a suitable micro-SD card, through installing the operating system, and adding additional software. If you use a search engine, then you can find a variety of different sets of instructions, including some that are very simple but basic; and others that are a little more complex so they can explain any options!
- The obvious place to look is the manufacturer's web site, the manufacturer actually also publishes the same documentation on their github page.
- If you have brought your Pi from a distributor, their web site (e.g. 'getting started' instructions provided by this distributor) might have simple instructions tailored to their product,
- or you can find the details at many general forum type sites with "how to" advice.
In the sections that follow, each step in buying and installation is covered. It is difficult to decide how much detail to include, a novice, and someone who wants to plug holes in their existing knowledge, have different ideas of exactly what detail is needed.
I did experiment (in an earlier version of this page) with including a Précis, then going into more detail. I found that made navigation harder than relying on the multiple sub-section approach now used.
Anyone who feels able to improve these sections is welcome to do some editing, provided the page remains relevant to both novice and established user wishing to look up these notes.
What to buy
You can buy a kit that includes several of the separate items listed below, or buy the components separately. Generally buying as a kit is cheaper than buying items individually. A typical kit includes the Pi board (with components and interfaces on it), a power supply (with a plug suitable for your mains sockets), a micro-SD card (see later sub-section), some connection leads, and a case (designed for board in kit).
The Raspberry Pi board
The Raspberry PI is just a circuit board. As time passes, new models are released, generally each offers more functionality than earlier models. Some retailers may only have latest model available. However, many retailers will still sell older models.
The information in this section was up to date in January 2020, future developments may make parts of the text here obsolete. Maybe you are a contributor who can edit some sections to bring the facts up to date.
A standard desktop computer (running Microsoft Windows) consumes at least 200 Watts of power (that is when it is idle, it will increase as more peripherals are attached and increase depending on any processing being done) all the time it is switched on.
A Pi Zero W consumes half a Watt when idle, and up to 1.78 W when running tasks or connected to peripherals that take power from RPi.
A Pi model 4 B consumes 2.85 to 80 W depending on whether it is idle or working hard; also consumption is higher if peripherals are being powered from the RPi.
When MX interrogates some weather station types, only the current values are available; in this case if you stop MX, you lose any readings during the time MX is not running. For these staion types, normally MX must run all the time (24 hours a day, 7 days a week; i.e. 24/7).
MX may be able to get historic (archive) readings from some weather station types, but these will only be available at an interval such as every half an hour (or every 10 minutes), so you still miss any readings from inbetween times. For these station types, it is an advantage to run 24/7, but not essential.
When MX is actually running, the frequency at which it obtains readings depends on the weather station type, but it is typically either every half-minute to every couple of minutes. Consequently, if MX is run all the time, derived values like highest, lowest, average, and so on, will be more accurately calculated if MX is left running, than when it is sometimes stopped.
Although the Pi is not the only small computer model available, than can safely be left unattended to run all the time, it is probably the most popular and the easiest one to use. Its low power consumption implies it will not wreck the planet by running all the time, in the way a larger computer would! It is obviously much cheaper to buy and much cheaper to run.
If you do a search on the support forum, you will find a lot of different opinions about which model you should buy, but in the end you decide! The following sub-sections contain just suggestions on how to decide, there is no intention to force any single decision.
Which Raspberry Pi to buy
If you want to own 2 computers, and will run your Pi headless by sending commands from your other computer, see Raspberry Pi Image article instead of reading any further here.
The following sub-sections are worth reading, if you want to buy a Raspberry Pi as a small computer. As a novice, you are likely to connect a screen and keyboard. You can use such a RPi for those word processing tasks you need to do, for maintaining a spreadsheet on your expenditure against budget, for looking at photos from your mobile phone, for a database that lists your CD or book collection, and even for playing games.
First make a list of what you need
- It is possible to buy a RPi model sold with the component board inside a keyboard, this means all you need to add to make it a usable computer is to add a TV or other monitor with HDMI input, this might be ideal if this is to be your only computer.
- At time of writing only the latest RPi board is sold integrated within the keyboard, so subsequent bullet points are irrelevant.
- Do you want to buy a RPi board on its own, then add a box to hold it? You can buy a mouse and key board (or use existing hardware), so that you can use your Raspberry Pi, with a TV (or computer monitor), as a computer for tasks like browsing the web and word processing, not just for CumulusMX?
- If so, a model with multiple USB sockets is advisable (like 3 B+ or 4)
- Multiple USB sockets also allow you to use a memory stick, or external drive, to run MX on, eliminating wear on the micro-SD card that contains the kernal and other boot up software (MX is constantly creating or updating many files (mostly in /data and /web sub-folders)
- Multiple USB sockets are also useful if you want to be able to plug in a USB stick and then remove it, (perhaps for transferring files between devices, e.g. Cumulus configuration and data folder files; this saves using slow file transfer, or removing the micro-SD disc)
- Do you want a wired connection to your hub or router?
- Maybe you are going to update external sites, a wired connection may provide a faster and more dependable communication than a wireless link
- If so, a model including an Ethernet socket is advisable (like 3 B+ or 4)
- You can add a USB hub and Ethernet dongle to model Zero, but by the time you have done so would have been better to start with a 3 B+ or 4)
- Remember that if you are operating the RPi in headless mode, a wired or wireless connection to your LAN is needed for your other device to communicate with the RPi
- Will your MX need to update a database, feed data to a web site, upload to external sites, or control other devices?
- If so, a model ZeroW will have to do each task in turn, and you will see some delay in information updates, plus you will need to set a larger time interval between updates.
- If so, a model 3 B+ (or 4) will be noticeably faster, and support all options in MX, and can update external sites more frequently
- What interface does your weather station use?
- If your station communicates to MX via wireless, then you choose a model that supports wireless at the right frequency, all models support basic wireless
- If your station communicates via Ethernet, then either a wired, or wireless, connection is possible between router/hub and Pi as the station will be plugged into your hub or router
- If your station communicates to MX via USB, then tou might prefer to buy the model 3 B+ with 4 USB sockets, so you have spare USB ports without buying a hub
- If your station uses another communication port (such as serial interface), then you need the additional components that support that interface
Now research how the various models relate to your needs
You can look up online what features are included in the various Pi models, and how they differ in power consumption, and cost. But your decision also needs to consider what you need as discussed in last sub-section.
Here, I will compare just 2 (Pi Zero W and 3 B+) for simplicity. Your research above might lead you to choose an older or newer model, and models available may change, so the folowing comparison is just an example written based on what was avaialble in January 2020.
The model Zero W is appealing as it has very low power consumption, it is perfectly adequate for running MX (but has limited speed, it runs the various threads MX uses sequentially) especially if you only use standard MX functionality and don't ask MX to do all the optional extras, and has limited interfaces for wired peripherals.
The model 3 B+ is appealing as it has medium power consumption, but can cope better with the multiple threads that MX starts, and has more physical interfaces built in, such as 4 USB 2.0 ports (useful if you want to connect a weather station using USB, connect a memory stick, and connect a keyboard).
While both models support WiFi and Bluetooth, the latter model also allows a wired Ethernet connection, and that may be useful if that is how you connect to your weather station (an Ethernet connection is also advisable if your WiFi connection is not dependable where you choose to install your RPi).
Having an Ethernet connection, as explained later, makes it possible to easily install any Operating System on your Raspberry Pi on first boot. Without that Ethernet connection, you can only install the operating system already on the micro-sd card (that might be obsolete).
- Raspberry Pi Zero W
- Pi Zero W has WiFi, one micro USB port and an HDMI output. Because it has WiFi, it is good for headless running, and this leaves the micro USB port free to connect a USB weather station.
- If you need more physical connections than that
- Installing onto a faster Pi might speed parts of the installation process, but for actual ‘production’ running this slower, and simpler, Pi will be perfectly adequate.
- It could run a web server, but that might really slow it down.
- If you run this headless, all updates are done remotely, for example using an SSH terminal program like PuTTY and a file transfer program like FileZilla on your PC.
- Raspberry Pi 3 B+ (or 4 B; considerations are very similar)
- The faster speed of this Pi although NOT necessary for running Cumulus MX, will cope better if you are asking MX to do lots of processing (e.g. updating database tables or external sites as well as standard processing).
- Pi 3 B+ has a socket for an external power supply, Ethernet socket (supports wired link); a HDMI socket for audio/video to TV, or computer monitor; a standard jack audio socket for external headphone, or speaker; 4 standard USB type 2 sockets for weather station, mouse, keyboard, USB stick, or other storage device; plus other connections (e.g. camera).
- This might be better if you also want to run a web server, and if you want to do other tasks (e.g. word processing - Libre Office is installed as standard on a Pi) on the same Pi.
- Also consider this model if it is to be used on a remote site so when you visit it is useful to be able to plug in other peripherals, and to spend as little time on updating as possible.
Other models are available, but you need to check their specification against your needs. For example, the current model 4 B has more capabilities, but may be less appealing as it also consumes more power.
A micro-SD card
You will need a micro-SD card (preferably class 10, the class number indicates the relative speed of read/write compared to original design, so this class is 10 times faster).
- A Pi will work with both a class 4 (only 4 times faster), and a class 10, micro-SD card.
- Just for the standard RPi OS (with GUI) install you need a card with a minimum of 8 GB.
- Given we are going to add Mono and Cumulus MX to the card, I advise you buy a card with at least 16 GB (the default operating system installation takes up almost half of that),
- but you might prefer to buy a 32 GB or 64 GB (or add an external USB drive or USB memory stick) if you intend to keep a lot of data on the Pi.
I won't mention manufacturer names here, but one well known brand (that uses descriptions like extreme) is the market leader, and does have greater reliability than cheaper cards from other manufacturers.
Setting up a Pi is simpler if you buy a micro-SD card that is:
- either pre-installed with NOOBS (Novel Out of Box Software),
- or pre-installed with the latest Raspberry Pi operating system (check you won't get an obsolete OS).
NOOBS makes it easy to install (by default) Raspberry Pi operating system, as if you insert such a micro-SD card into a new Raspberry Pi computer, when you power up the Pi, the operating system will be installed during that first boot.
If you have a Raspberry Pi model with an Ethernet connection, and you connect your Pi to your hub/router before you first switch it on, then at that first boot, NOOBS will offer you a choice of latest downloads available for several operating systems, with Raspberry Pi as first choice.
Various suppliers offer cards of 16 to 64 GB with NOOBS pre-installed ready for use in a Pi (I bought from a firm in Haverhill, Suffolk, UK).
My advice is to buy your micro-SD card from a firm that specialises in selling Raspberry Pi computers and accessories. That should ensure you buy a card with the latest version of NOOBS (or Raspberry Pi Operating System).
Having pre-installed software on the card will make your life simpler than buying a blank micro-SD card and having to down load and add the operating system yourself. But if you are technically skilled, you may prefer starting with a blank card, creating the necessary partitions, some in Ext4 that suits Linux, and doing all the downloads and installations yourself.
If you want to be able to use the micro-SD card in other devices (like your PC), you may need to also buy an adapter which allows the micro-SD card to be plugged into a standard SD socket. This may be included if you buy a micro-SD card not sold specifically for the Pi, or may be available with the Pi micro-SD under a special offer for buying two items together.
Finally, you may wish to buy a second micro-SD unit as a spare. Providing you have a suitable holder, and sufficient capacity, the RPi GUI even has an option that allows you to produce a back-up of the internal micro-SD card with all the partitions (e.g. recovery, system, user).
A case to protect the board
You may want to buy a case, that will protect your Pi from accidental damage. A case specifically designed for your Pi model will have cut-outs in the right place for each interface connection, and will have sufficient ventilation for the electrical components to not over-heat. Some designs have additional holes for securing peripherals.
A power supply
Unless you already have a portable unit that can output power to a micro USB connector (USB type C), it is likely you will want to power your RPi off the mains electricity where you install your RPi.
You may need to buy a power supply.
- This could be an official Raspberry Pi power supply. That will have a suitable plug for your nation, that plug clips onto the transformer (that will reduce the voltage and rectify it to direct current), an inbuilt leads to a USB C plug (that can connect to your RPi).
- Alternatively, other power supply units that have a (micro) USB C connector will often suffice, as the power consumption of a Pi (whichever model) is fairly small.
- Remember, the power consumption varies depending on model, and on how many tasks are running concurrently on the RPi, and if the RPi has to power additional peripherals.
- As it will be powered on 24/7, a low power consumption ‘switched mode’ type is preferred – i.e. one that does not become warm when plugged in with nothing attached (not that you should be disconnecting your RPi from its power source, you should do a tidy shutdown first)
- You may have a suitable power supply unit left over from an earlier mobile phone.
Connection leads used with a RPi
You may need to buy connection leads:
- You may need a HDMI lead to connect your PI to your TV or a spare computer monitor.
- You may need a USB lead ([1]) to connect to your weather station, your station probably has a USB A end connection (the Pi model Zero requires a USB C end, the Pi model 3 requires a standard USB A end).
- If your weather station connects by Ethernet, you will need one lead to connect the station to the router and possibly another to connect the hub or router to the Pi.
USB peripherals
- If you do choose a model 3 (or later), consider whether you want to buy a USB mouse and USB keyboard to use with your RPi.
- Next consider if you want to buy any external disc or stick storage. You might use this for running MX on (MX does lots of inputs and outputs, creating files particularly in "/data" and "/web" sub-folders) to save wear on internal micro-SD card. You might want to connect external storage simply to do regular back-ups (file transfer to another computer over LAN, or to the cloud, is a slow alternative).
The Raspberry Pi Operating System
The Raspberry Pi Operating System comes in both full and lite variants, and these will be explained here:
- Full edition supports a Graphical User Interface (GUI), as well as a Terminal interface
- A graphical interface means you can attach a keyboard and TV (or other monitor), plus optionally a mouse. With these you can have a "Windows" like experience, where you select an icon (on desktop or in task bar), which brings up a menu that you scroll through and drill down until you have selected option required. Many people find this easy to use, and a novice using the GUI does not need to learn all the different Linux syntax.
- A terminal interface, resembles the old teletype experience (if you are old enough to have met those machines) lets you type in commands, back space is treated as a control character (it does not remove the previous character, just cancels it out). When you press ENTER, the system types back a response. This gives more flexibility, as you can issue instructions that are not present in the GUI menu dropdown. One example is a chain of commands, another is being able to specify different parameters to a command. However, you do need to develop a good knowledge of Linux commands to achieve progress using a terminal interface, and that can be difficult for a novice, but much qyuicker than a GUI for someone who has used Linux before.
- The lite edition of the OS, excludes the GUI, and is normally installed for a RPi that depends on a separate device (such as a Windows PC) to send all the commands via terminal sessions over a Local Area Network (wired or wireless), so the RPi does not have a keyboard, mouse, nor monitor attached. All the comments above for terminal mode still apply, but you also need some understanding of Secure Shell Protocol (SSH) which is the way any remote terminal session connects to the RPi. The lite edition is used in the single download file available at Software page Current_Release section.
Is the operating system obsolete or up to date?
It is important that your Raspberry Pi (or other device) has the latest operating system version installed. If the Operating System installed is an obsolete one, then each package it includes (e.g. Libre Office), and each package you add (e.g. Mono or PHP), will also be obsolete versions. In the worst case scenario, any attempt to install a package might fail giving an error message that the relevant Raspberry Pi repository is archived.
If you have a micro-SD card pre-installed with NOOBS, as described above, the first boot will install the operating system. It is the version of NOOBS that is included on the micro-SD card that determines which Raspberry Pi Operating System version it offers to set up.
Here are the names of Linux operating systems as at mid-2020:
- Wheezy (7) released in 2013
- Jessie (8) dating from 2015
- Stretch (9) released in 2017 (up to this called Raspbian Operating System)
- Buster (10) available from 2019 (the first to be called Raspberry Pi Operating System)
- Bullseye (11) under test in 2020, and expected to become available sometime in 2021
Be aware that many NOOBS pre-loaded and pre-formatted cards include an obsolete version of NOOBS.
- You may find your card installs the obsolete Raspbian Jessie (version 8 of Debian from 2015),
- a few install the old Raspbian Stretch (Version 9 of Debian, dating from 2017),
- a good supplier sells a card that installs latest Raspberry Operating System Buster (Version 10 of Debian, released in 2019).
How to add Raspberry Operating System to a card yourself
You can boot up a RPi:
- if it has NOOBS pre-installed, at first boot the NOOBS will load,and then you choose the OS to install from options listed
- more options will be listed if your RPi has wired ethernet connection to internet and can find various available OS as well as the full and lite versions of RPi OS
- without wired internet, you might only see two options; the full, and lite, versions of Raspberry Pi OS
- A micro-SD card where NOOBS is used to install the RPi OS, will have multiple partitions created
- the boot partition will ensure RPi OS is loaded in future, together with settings
- a recovery partition is created, this allows you to return to NOOBS and do a clean install
- partitions are created for different parts of the Linux file structure
- optionally a partition can be inserted in any free space and this final partition by default is mounted as "data" under "media" in the Linux file structure
- if you press shift key while your RPi is booting from an operating system, it will load from the recovery partition, and that might offer NOOBS options as at first boot
- if the RPi has Raspberry Pi OS already installed, a normal boot will load up as defined for a normal boot
- there are Linux commands to change the partitions on any storage attached to RPi (including the micro-SD card)
- as an alternative gparted provides a GUI way to edit partitions (as a super-user), you will need to use apt-get to install gparted.
If you cannot boot up your RPi (perhaps you have a blank micro-SD card)
- Decide whether you want
- the full version of the operating system that supports a graphical user interface (choose this if you want to connect a TV or other monitor to your Raspberry Pi),
- or the lite version of the operating system that only supports SSH or terminal mode (choose this if you will operate headless - explained at end of this article)
- Download, on another device (like a PC or tablet) the latest version of the Raspberry Pi operating system you have selected from https://www.raspberrypi.org/downloads.
- the latest Raspberry Operating System is version Buster at time of typing
- That Raspberry Pi download page has full instructions.
- However, the supplier who sold your RPi may also have guidance, e.g. those at this supplier's tutorial guide
- Some people may prefer to look in the Cumulus support forum, e.g. those in Cumulus support forum.
- To save you looking any of those up, this summarises what you need to do.
- You download the O.S as an imager file onto say your pc,
- Using imager software (such as belenaEtcher) you select that download image, and then you select write to save it onto the micro-SD card (don't forget this overwrites anything already on the card).
- This should work without a need to format the card first, (but if you do need to format it, do so using a SD card formatter downloaded from https://www.sdcard.org/downloads/formatter_4/index.html, not for example Windows format tool).
- After this image has been stored it will have created two (or three) partitions on the micro-SD card (one the boot partition is a FAT partition that can be accessed by Windows (so you can edit files in this partition), the larger Linux EXT4 partition is invisible to Windows, the optional third partition is also formatted as Linux EXT4 and uses up most of any space left on a larger micro-SD card and this final partition by default is mounted as "data" under "media" in the Linux file structure).
Setting up Wireless Network
There is a way to set this by creating a file in the partition that Windows can see, if you are preparing your micro-SD card on a PC before moving the card to your RPi. See the Raspberry_Pi_Image page.
How this is set up on your RPi (see instructions here for RPi OS), depends on the model, and the operating system that is loaded on it,
- it may on first boot ask you to enter your wireless network details,
- it may list the wireless networks it finds, and ask you to choose from the listed SSID,
- it may not prompt you
- in this case, with RPi OS, you need to use the terminal mode configuration tool (see next sub-section) sudo raspi-config (select 1=configure system settings, then select, then S1=Wireless LAN)
- or you might need to click on an icon with two red crosses.
If you have had to enter wireless details into a mobile phone, you will realise what is needed:
- Most wireless networks will use Wi-Fi Protected Access (WPA) or (from 2006) Wi-Fi Protected Access II (WPA2) protocols, so WPA-PSK setting here is correct for you.
- Some hubs or routers or wi-fi extenders may create multiple wireless networks, and there are two possible frequencies for these.
- 2.4 GHz frequency group contains 14 channels, the 802.11 Wi-Fi standards specify a bandwidth of 22 MHz, and most channels are 5 MHz apart (but there is a 12 MHz gap between channels 13 and 14). You may get interference from a microwave oven as these use a channel in this group. The early RPi models only support this frequency group.
- 5.8 GHz (sometimes abbreviated to 5 GHz) frequency group provides additional bandwidth so 802.11a & n say it carries 23 non-overlapping channels, and being at a higher frequency gives a shorter range than 2.4 GHz. There is less interference as fewer devices (including newer RPi) can afford to use the equipment that can transmit/receive at these higher frequencies.
- The Service Set IDentifier (SSID) is the name that is used for your wireless network.
- As mentioned above, you may see a list of those that have been found.
- You may have typed this into your mobile phone. Your mobile phone probably displays the SSID under any wireless icon, when it is connected to your wireless network
- It may be shown on a card that slips into a slot on your hub or router (you may have changed it from that initial setting).
- It can be up to 32 characters (letters, numbers, and symbols.
- Some routers come with a default SSID that is the manufacturer's name, if left unchanged it might conflict with a neighbour, so it is left to you to pick a SSID that is unique to you using up to 32 characters to personalise it.
- You also need to enter whatever Pre-Shared-Key (password) is used for your wireless network.
- You will have typed this into your mobile phone, so that can automatically connect to your network.
- You should have changed it (for security reasons) from whatever was shown as the initial password on the card that slips into a slot on your hub or router (possibly all you have done is add a prefix or suffix that means something to you).
- Note that your Pi is only able to use these protocols.
- Note on the Raspberry Pi 3B+ and Raspberry Pi 4B, which use channels in 5.8 GHz group, there is also a Wi-Fi network country which might be set by default, or might need to be set using GUI configuration tool Localisation tab.
- The earlier Wired Equivalent Privacy (WEP) was officially withdrawn in 2004 as too easy to crack, so it is not supported on a new Pi.
Other configuration
There are various other configurations you need to do on your PI. You need to use the raspbian configuration tool raspi-config,
- this can be accessed on your Pi either in a Graphical User Interface (GUI) where fewer options are available,
- or by running a command
sudo raspi-config
in Terminal where more options are available.
Mandatory configurations
Within either Raspberian configuration utility, you will see an option to change password. You will want to do this so nobody can hack into your Raspberry Pi computer. You will need to enter the new password twice before it replaces the old one.
The default network (host) name for your Pi is raspberrypi, that will cause a conflict if you have more than one RPi!
Anyway, we need to replace the host name to personalise it to you, and make it harder for a hacker to know what device is represented by that network name.
- The name can most easily be changed within either Raspberian configuration utility, you will see a Network Options option, it is there that you change the network name.
- but it can also be edited by opening the file where it is stored using
sudo nano /etc/hostname
.
Some network options can sometimes (depends on permissions) be configured by clicking an icon on the Pi (this icon might be two red crosses if network settings are missing, two parallel arrows if the network settings are not correctly set, or the wireless symbol if your wireless network is working).
Recommended configurations
The default locale for a Pi is normally en_GB.UTF-8, as they are designed by a company based in UK. Within the configuration option, you can add additional locales (in most cases there is a UTF-8 option which is preferred and at least one other encoding), there are also a number of special alternative locales, but I am not going to explain all the options, look it up if the default locale is not acceptable.
- Whatever locale you use, if you have already been using Cumulus (1 or MX), you need to ensure the locale matches the one used for your log files. The versions of MX released from the middle of 2020 onwards are very fussy that all dates use the same delimiter (see Cumulus_MX_formal_release_versions), so you need to check the chosen locale continues to use the same date separator as before. The locale is also affected by the version of Mono you install and whether you use the locale parameter when starting MX, so I cannot cover all options.
- Anyway, the default locale is fine if you are in the UK, you use decimal points for real numbers, you use commas for list separators, and you don't have dates with month first!
- To change the locale, enter Localisation Options within the configurator provided in RPi O S in terminal mode.
In the same option area, there are some more options:
- Change Time-zone, by default UTC is used all year round.
- In the UK if your Cumulus MX is set to roll over at 10am in summer, you will wish to change the time-zone to UK time, because MX uses system time for many of its actions, and you want rollover at 10am BST, not 10am UTC.
- Change Keyboard Layout if needed, keyboards can support different numbers of characters, and can have different currency symbols, so select whatever is relevant to you
To leave configuration
Select ‘Finish’.
Operating your Raspberry Pi in headless mode
The terminology "headless" means using another device to send commands to a Pi via a wired or wireless network, instead of connecting a keyboard and monitor (or TV) directly to the Pi so you make all selections directly on it.
For a novice, the easiest way to set up your Pi (as described above) requires (at least temporary) a keyboard and a monitor (can be a TV) to be connected to it. You might also want to connect a mouse. Depending on the Raspberry Pi you bought, and whether you bought a keyboard (or can borrow one from any PC you have), the ease of making these connections will vary. Once your Pi is set up, and you have started MX running, you can disconnect these peripherals, and leave your Pi running.
The options described in the rest of this article cover all aspects of using a PC to do actions on your Pi, including how to change some settings on your Pi without ever connecting a keyboard and monitor to the Pi. For a novice, there are lots of opportunities to make errors in the following options, so remember the cricketer who said "If at first you do not succeed, try and try again, if you continue to fail, give up".
Remote access
There are various different ways that another device can access the Pi over networks. The most popular lets a Terminal mode on your other device connect to your Raspberry Pi using Secure Shell Home, and the commands you type in on your other device are just the same ones you would type directly into the Raspberry Pi terminal mode. The responses you get are also the same. What is likely to be different is
- any control sequences,
- any copy and paste operations,
- and any other actions that are specific to the terminal mode on the other device.
You can use the browser on your PC to connect to the web server created by the MX engine to run the admin interface (all that needs is that the Pi and the PC are both connected to your hub or router, so they are on the same local network):
- to change settings
- or to look at the web pages provided in that interface.
Your PC can be used (as well as your Pi) to look at any web pages updated by MX (all that needs is your device to be able to connect to whatever web server runs your web pages).
Ways of using PC to do what can be done on a RPi
On your Pi, there are various applications that you can run with graphical interfaces, these let you achieve what you want by on screen selections, without having to learn what Linux commands to type in. You might wish to use these when you are operating your Pi in a headless state (without keyboard or monitor), so you want to see these graphical interfaces on your PC. See this tutorial for one way to do this. Although this article does not cover such options that let you see graphical user interfaces, these let your other device see selection screens, browsing screens, and similar, just as you would see them if you had a monitor connected to your Pi.
An alternative way to work on your Pi is its its terminal mode. This lets you use sudo to overcome the fact that the default user does not have root rights, and can therefore allow you to achieve tasks where a graphical interface fails because of the ownership of the part of the file structure where your action is taking place. The commands you type into a terminal screen on a Pi can also be typed into a terminal screen on your PC, and you will see the same responses. For this to work, you need to switch Secure Shell Home (SSH) on as that is what controls access over a network. This article explains most aspects of SSH in the next few sub-sections.
What is Secure Shell Home?
Secure Shell Home (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. If you have two devices (your Pi and another computer), SSH will allow the two devices to exchange commands and responses between a terminal and a computer over the wireless or Ethernet (or mixture) network that connects them.
You may be too young to remember when communication with a computer was often done (remotely) using a Teletype (or similar device) acting in terminal mode. Just 4 decades ago this would have been a familiar experience for anyone working with computers, now it may seem strange for you.
It is possible you have remote connection from home to a computer at your work (although that probably uses a different protocol as the network is likely to be better secured as it passes over the internet).
SSH is switched off by default on a standard Raspberry Pi set up.
You can if you have a keyboard and screen attached to your Pi, go into the configuration screen it offers and switch SSH on. The easiest way is using the Raspi-config tool, either from the main menu (raspberry Pi icon inside a square) or in terminal mode with sudo raspi-config (choose option 5 = Interfacing Options, look for SSH). This will enable you to later access your Pi from your PC and might be useful later on. While you are in the configuration tool choose option 1 = Change User Password, and set the password you will use for your SSH session; the default password is raspberry, but you don't want to let hackers into your Pi, so you will choose something hard to guess.
The next sub-section describes how you can switch SSH on during the first boot, by creating a file on the micro-SD card before you insert it into your Pi, the file is removed as part of the boot process, so this only works once.
Pre-configuring the Pi for headless operation
If you want to set up your Pi headless (without monitor, keyboard, mouse), then you must ensure SSH (which is off by default) is switched on as your Pi boots up. Otherwise you have no access to do any setting up, and you cannot even close down the Pi tidily! The only way to achieve this, is by adding a file SSH to the boot partition before the micro-SD card is put into the Pi. If you don't do this you cannot get headless operation, and you will need to move a monitor or TV, mouse, and keyboard, across to the Pi.
The file, you add to the boot partition (there is a second partition that may be invisible), must be named "SSH" with those three letters in capitals, but with no file extension. You can create the file with whatever text editor you have available.
- On a Windows PC, if you right click (while viewing the boot directory on the card) there is an option called New and if you select a text file it will create an empty file with the extension .txt. (In windows there is an option to hide extensions which is on by default, so you may need to deselect this option [New menu -> Options] to see this extension). On Windows you can open the file using Notepad to verify it is empty, if you gave accidentally created a file of another type like word processing it will be full of characters some of which do not display. Anyway, you must remove any extension from the file name so it is really just SSH.
Type into the file touch ssh
, but nothing else, no empty lines, no end of line characters.
When the card is inserted into your Pi, on boot this file will be removed and the SSH option will be enabled. The default password is raspberry, once you have successfully got SSH working. You should then use sudo raspi-config (choose option 1 = Change User Password, and set the new password you will use for your SSH session next time).
How to use SSH?
If you have a Windows PC, this will allow you to open a Command prompt, Power Shell, or Terminal window (the selection you have available depends on certain settings).
If you have a Linux or Mac device, open Terminal.
Next, (assuming your Pi is running, and that your other device is on the same local network), type ssh pi@raspberrypi
to get access to default user in your Pi.
(As an alternative for Windows operating system, you can install PuTTY, this has the advantage that you can enter the connection settings into it, and configure various other options, and these are remembered, so might make it easier to use. As mentioned earlier, PuTTY and winSCP work well togther because they share settings. PuTTY software (an SSH client for Windows) can be downloaded from https://www.putty.org/
).
When you are using a terminal, it is a sequential device, each line is either a string of characters that you type in (these might include a backspace character) or something sent back in response. The action that result from any key combinations depend on your terminal application, not just whatever you are running on your Pi. Your mouse can't affect cursor location, but the mouse might be needed to select text, the left click might copy what is selected, and the right click might paste (what is in your PC's clipboard) at current cursor position.
You can use SSH access from your PC:
- when you need to edit a file on your Pi,
- or do a file transfer between Pi and PC or vice versa.
Running MX installed on a RPi by issuing commands from your PC
If you choose to use the simple sudo mono CumulusMX.exe
command in a terminal (or command window or Powershell) session on your PC, remember MX will detect if that session is ended and will shut down MX. This means if you want to keep MX running you need to keep your session on your PC running and you loose the advantage of saving electricity by running MX on a PI because your PC remains on.
As I type this a new release 3.8.0 is to allow MX to run as a service, and a future release is planned to change the associated script, so anything I write here might become obsolete, and the next sub-section gives you some links to the support forum about alternatives to the new feature. Hopefully, someone will edit this article, when instructions have settled down and won't change on next release. Basically, the ability to run MX as a service, means that MX actually runs independent of the session that starts or stops the service; and therefore implies you can shut down your PC without stopping MX.
Hopefully someone will add notes to this article about the running as service option. I have not tried it, so I cannot add such notes.
Older information about using a PC and a RPi
In the Cumulus Support forum, there are articles about a stop/start routine, a backup routine, and how to run MX as a service. I will let you hunt for and read the relevant topics, as you may find details in more than one place. This article currently avoids describing these to try to keep content simple. Here is just a list of some alternatives to having to leave your terminal session running:
- Use start/stop routine (see earlier link), this effectively starts a separate session for MX to run in and leaves the standard terminal session free.
- Run MX as an init service (see the earlier post in the service link above), be aware that this is a new feature in the new release of MX 3.8.0, again this starts MX outside your terminal session
- Use Screen software to start up a separate session that you can log off from without MX stopping (see how to run using screen}
- Run MX as a systemd service (see the more recent posts in the service link above), be aware that at time of typing this is planned to be incorporated in a future release but the MX developer has no knowledge in this area
Headless Wireless Network set up
If you don't connect a keyboard and monitor to your Raspberry Pi, you can't set up the wireless network configuration on your Pi using one of the provided configuration tools as described in the earlier wireless network sub-section.
You can use the SSH approach described immediately above to access the Raspi-config tool and in that do the necessary configuration.
There is one further, complicated, way to set up the wireless configuration so that the wireless network will work when you first boot up your Raspberry Pi. If you have brought the Zero model, that does not allow Ethernet connection, you might decide to follow this complex approach that involves creating a text file in the boot partition of your micro-SD card, and store it in the boot directory on your micro-SD card with a file name wpa_supplicant.conf before you insert that card in your Pi and do its first boot.
A note of caution here, it is easy to make mistakes, and you may find this does not work. It is presented here just to cover all options, to use this does require some technical skill, a novice will be better off avoiding this.
Ensuring you are using a text editor that won't add any unwanted control characters, add the following text using UTF-8 encoding:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=GB network={ ssid="YourNetwork" psk="YourNetworkPassword" key_mgmt=WPA-PSK }
- Obviously, if you are not in United Kingdom, you will replace GB by the country code that applies to you.
- Within the first set of quotes, replace YourNetwork by whatever Service Set IDentifier (SSID) is used for your wireless network.
- You may have typed this into your mobile phone.
- It may be shown on a card that slips into a slot on your hub or router, but you may have changed it from that initial setting.
- Whatever it is, and it can be up to 32 characters (letters, numbers, and symbols), type it within the double quotes.
- Some routers come with a default SSID that is the manufacturer's name, if left unchanged it might conflict with a neighbour, so it is left to you to pick a SSID that is unique to you using up to 32 characters to personalise it.
- Within the next set of quotes, which relate to the key (or password) that protects access to your network, replace YourNetworkPassword by whatever Pre-Shared-Key (password) is used for your wireless network.
- You will have typed this into your mobile phone, so that can automatically connect to your network.
- In this case, you should have changed it (for security reasons) from whatever was shown as the initial password on the card that slips into a slot on your hub or router (possibly all you have done is add a prefix or suffix that means something to you).
- Most wireless networks will use Wi-Fi Protected Access (WPA) or (from 2006) Wi-Fi Protected Access II (WPA2) protocols, so WPA-PSK is correct for you.
- Note that your Pi is only able to use these protocols.
- The earlier Wired Equivalent Privacy (WEP) was officially withdrawn in 2004 as too easy to crack, so it is not supported on a new Pi.
Should you wish to set up your Pi with several network definitions, please see Notes by ExperiMentor (a contributor, in Switzerland, to the Cumulus support forum).
Downloading MX distribution on PC
If you download MX on your PC, then you will probably unzip the distribution there, and use a tool like winSCP to copy the installation to your RPi.
Use of FTP or SFTP was described earlier at #using file transfer.
Web Server and Database Server
As this is quite technical it warrants its own Your Own Server page.