==============================================================================================
GENERAL INSTALLATION OF THE RASPBERRY PI SOFTWARE
The preferred installation is Python 3!!!
==============================================================================================	
Download from https://www.raspberrypi.org/ the NOOBS package. Follow the instructions to format your card and to install the operating system.
Installation is done with the NOOBS package.

Insert the SD card into the Raspberry, connect it to the internet with an UTP cable and 5 volt power supply.

After startup of the Raspberry Pi 2B, select at the bottom the language and keyboard.

Select for the installation the first choice "Raspbian [RECOMMENDED]" and press install.

After a while, the file system will be extracted and a message will be displayed that the Operating System is installed successfully.
Press OK and the Raspberry Pi will be booted.

Open the Terminal window ("Monitor" on the Taskbar or "Menu" --> "Accesories" or "File Manager" --> "Tools") and give the following command (+ Enter of course):
 
sudo raspi-config

Select 2 if you really want to change the default password "raspberry" to one that you do not forget!
Select 3 to choose the boot option B4 to Desktop GUI automatically logged in as 'pi' user.
Select 5 to choose Internationalisation Options
  Leave I1 for what it is
  I2 Change Time Zone to your time zone and nearest city
  I3 Change Keyboard Layout to "Microsoft Natural" and "English (US with euro on 5)" etc. for your preferred settings
Select 9 Advanced Options and then A1 Overscan and "Disable" the overscan so that you will have the maximum screen size on your flat screen monitor

Press "Finish" and "Reboot"

Press with your right mouse button on the taskbar at the top and select "Panel Settings" and "Position at Bottom" if you want to have the Taskbar at the bottom as with older versions of the software.

Press with your right mouse button on the taskbar and select "Add / Remove Panel Items" press "Add" and add the "CPUFreq frontend" and also "Temperature Monitor"

Make an update of the system. Open the Terminal window ("Monitor" on the Taskbar) and give the following command (+ Enter of course):

sudo apt-get update

There is a difference with previous versions of the software, as in the File Manager, the option "Tools" and then "Open Current Folder as Root" was removed.
But there is a simple solution, you can open the File Manager at the Taskbar and select "Tools" --> "Run a Command in Current Folder" and type the following command to have Root Access with the file manager: "sudo pcmanfm". Or "sudo leafpad" to have Root Acces when you want to edit a script or configuration file.

And change the Default view of the file manager. Otherwise you will have to wait ages till a directory with many files is displayed.
Open the file manager and select "Edit" --> "Preferences" and set the "Default view" to "Detailed list view"

==============================================================================================
MAKE THE RASPBERRY PI READY FOR USE WITH AUDIO, PYTHON AND LOPORA
==============================================================================================
Now we have to do the installation and configuration for use with Audio, Python and Lopora.

/usr/lib/pythonX/dist-packages  is the location for external modules like numpy and pyaudio, X is the Python version number.

(The command "sudo" will give you the required rights to install the software as administrator,
"apt-get install" is the command to download and install the software.)

Open the Terminal window ("Monitor" on the Taskbar) and type the next commands (if asked, press "Y" uppercase!):

Installation of Numpy, type the following commands:

sudo apt-get install python2-numpy

(Was not necessary for my Raspberry Pi, a message was displayed that it was already installed)

Installation of the PIL library has been changed, type the following commands:

sudo apt-get install python2-pil
sudo apt-get install python2-pil.imagetk

Installation of pyaudio type the following commands:

sudo apt-get install python2-pyaudio

We are going to use PulseAudio for the downsampling of the audio stream from 48000 samples/s to 6000 samples/s.
Installation of pulseaudio and its volume control, type the following commands:

sudo apt-get install pulseaudio
sudo apt-get install pavucontrol

Press with your right mouse button on the Taskbar and select "Add Remove Panel Items"
Press "Add" and then select "Volume control". Now you will have the PulseAudio volume control on the bottom Taskbar.

Now we have to edit the configuration file "/etc/pulse/daemon.conf" as a root to modify the resample method.
Open the File Manager at the taskbar and go to the folder /etc/pulse/
Select from the top selection bar of the File Manager "Tools" and then "Run a Command in Current Folder".
Type the following command to edit the configuration file "daemon.conf" as a root:

sudo leafpad

Open the configuration file "daemon.conf", it can now be edited as a root with the leafpad editor, find the line:

;resample-method=speex-float-3

and change it to:

resample-method = src-sinc-fastest (remove the semicolon!)

DO NOT SELECT: resample-method=src-linear or trivial!!!
Those resample methods are not band limiting and are sensitive for frequencies above 50% of the sampling rate. When I selected "trivial", a 4500 Hz signal was displayed just as strong as the wanted 1500 Hz signal. With src-sinc-fastest, this 4500 Hz signal was fully suppressed.
The "src-sinc-fastest" method has a cut off frequency of 80% of half of the sample rate of the audio stream. For 6000 samples / sec, the cut off frequency is 2400 Hz and that is well above the wanted signal frequency.
The "src-sinc-best-quality" and "src-sinc-medium-quality" have a higher cut-off frequency of 97% and 90% and do require much more CPU time. We do not need that extra bandwidth and it is even better to have a lower bandwidth! So do not use them, use the "src-sinc-fastest" method!
For more information about pulseaudio, open a Terminal window and type "pulseaudio -h".

Activate also the following setting in the "daemon.conf" file:

flat-volumes = no
 
Note that you need to remove the semicolon at the beginning of the line! With the "flat-volume = yes" setting, the Recording volume control and volume control of the Input Devices are influencing each other.

Save the file and close the leafpad text editor.

Then I did not have to do anything extra for Pulse, the file "pulse-alsa.conf" was already installed. If not, do it as follows:
Add a configuration file "pulse-alsa.conf" in the directory "/usr/share/alsa" to make pulseaudio the default sound card. 
And perhaps that you have to change some other configuration files in "/usr/share/alsa" and "/usr/share/alsa-base".
All those configuration files of my Raspberry Pi can be found in this "lopsource.zip" file.

To modify them, see the procedure for the configuration file "daemon.conf"

DO NOT COPY ANY OF THE SCRIPTFILES FROM THIS ZIP FILE, TYPE THEM OVER!!!

===============================================================================================================
RUNNING LOPORA ON THE RASPBERRY PI (LOPORAv03d.py is the last version for Python v2, newer ones use Python v3!)
===============================================================================================================
Make a new folder "/home/pi/QRSS" and save all the (unzipped) files in this ZIP file into this directory. Use an USB memory stick to transfer the files.

On your Menu at the Taskbar under Programming  you will find the "Python 2 (IDLE)" and you can open and modify the Lopora program with it. The first lines of Lopora do also contain some specific Raspberry Pi settings. 
You can start Lopora when opened with IDLE by selecting "run module". But it is also possible to have the scriptfile with the name "startlopora.sh" on your Desktop, you can find it in the ZIP file.

Make it executable (click the file with the right mouse button, select "Properties" --> "Permissions" --> "Execute" and set it to "Anyone"). And of course you have to modify the script file a little depending on your Directory and program names.

Select the audio device "pulse" when starting Lopora.
Select the example configuration file "30MeterBeaconband.cfg" but change the setting "Tuning frequency of the receiver in Hz" to the tuned frequency of your receiver. And also the setting "Start frequency, reception frequency at bottom of screen in Hz".

Lopora does also work in Terminal mode. Many ALSA messages will be displayed, just ignore them. I start Lopora with the script file. Go in the Terminal mode to the directory of the script file and type: ./startlopora.sh (with ./).

We will use the Raspberry Pi 2B in "normal" mode without Overclock and a sample rate of the audio stream of 6000 samples/sec. 
In 1000 MHz overclock mode, the Raspberry Pi is faster when required. Not necessary for Lopora. But nicer if you want to browse the Internet for example.

Start Lopora and Select from the Taskbar "Menu" --> "Sound & Video" --> "PulseAudio Volume Control". Or click with the right mouse key the volume control at the Taskbar and select "Device Settings".
Select "Configuration and set the "Audio Adapter" to "Analog Mono Input"
Select "Input Devices" and set the "Port" to "Microphone" or the input you want to use.
Select "Recording" and you will see that Python is recording (if Lopora runs!), the volume control is at 100% when "flat-volumes = no" in the /etc/pulse/"daemon.conf" configuration file.
Go back to "Input Devices" and set the volume to the desired value (20% in my setup)

==============================================================================================
AUTOSTART LOPORA ON THE RASPBERRY PI
==============================================================================================
Autostart can be a little problematic in Terminal mode, because you have to set the command in the file "/etc/rc.local". 
This file is executed while Linux is booting up and before any users have logged in. And if there is an error in your program, it might be that the Raspberry Pi does not boot anymore! But of course, we do not use the Terminal mode, but the Desktop mode as you do not have the display in the Terminal window.

So I did the Autostart in Desktop mode. Lopora starts now automatically, even after a sudden power failure!

Open with the File Manager the /home/pi directory .
Open the directory /home/pi/.config (Activate in the File Manager: View: Show Hidden!)
Make a new directory (folder) "autostart" and make a desktop file in this directory /home/pi/.config/autostart
The name of the Desktop file is "lopora.desktop" and you can find it in the ZIP file.
But it takes approximately 3 minutes to start Lopora with this script file due to the following reasons:
My Raspberry Pi starts much faster than my Internet modem. As the modem was not rebooted, it could not get the right time via the time server and did start to run with a wrong time. So in the script file, there is a pause of 90 seconds to give the Internet modem enough time to reboot. Then the NTP Network Time Protocol service is restarted, so that it can get the correct time from the Internet via the rebooted modem. Then there is another pause of 60 seconds to give the NTP application time to get the correct time and Lopora is started.

In my case, the scriptfile "startlopora.sh" is located on the Desktop and is called. Of course you have to modify the Exec=.. so that it runs your scriptfile.
Make the Desktopfile "lopora.desktop" executable (click the file with the right mouse button, select "Properties" --> "Permissions" --> "Execute" and set it to "Anyone") and when the Raspberry Pi reboots, Lopora will start after the mentioned 3 minutes. Just wait, it looks as if nothing happens.

==============================================================================================
SOME MORE
==============================================================================================
And always that screen that goes blank after 30 minutes... We do not want that, we have our monitor as a painting on the wall in the shack! There is a solution. The only one that works is also the most simple solution! Open a Terminal window and type the following command to install a screensaver application:

sudo apt-get install xscreensaver

At the Taskbar, press "Menu" --> "Preferences" and you will find the Screensaver application. Select the Mode "Disable Screen Saver" if you do not want to have the screensaver active, or a short time to activate it if you want to have it active to reduce for example radio interference.

And I did something that everybody does once and could not change the desktop background anymore. 
When right-clicking the desktop, I selected under Desktop Preferences - Advanced the "Show menus provided by window managers when desktop is clicked". From that moment, I had a strange menu when right clicking the desktop and could not change the Desktop Appearance anymore... Is a problem when you want to have a black desktop background. Was solved as follows:

Launch a terminal and enter "pcmanfm --desktop-pref". 
When the desktop preferences window pops up, click on the "Advanced" tab and deselect "Show menus provided by window managers when desktop is clicked".

Copying the grabber pictures can be done with an USB stick. Enough USB ports on the Raspberry Pi 2B. 

Only with special software it is possible to read the SD card in a Windows PC. More can be found on the internet. Also about how to make an image of your SD card.


