-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.txt
152 lines (123 loc) · 7.53 KB
/
install.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Install Steps
DOWNLOAD NEEDED APPS:
Download Balena Etcher - https://www.balena.io/etcher/
Download Berrylan Unix Bullseye Image - https://berrylan.org/
Download Berrylan App from either Apple App Store or Android Play Store to your phone
NOTE: The Berrylan image is not strictly required. It provides an easy way to setup the WiFi and enable SSH on a headless RPi system such as this. There are many other ways to do this temporarily connecting a keyboard and monitor to the RPi to start. However, if you choose to give this to a friend then having the ability to change the WiFi network through the Berrylan phone app is very handy. If Berrylan is not desired, visit; https://www.raspberrypi.com/software/operating-systems/ to download the latest image.
WRITE BERRYLAN IMAGE:
Using Balena Etcher, write Berrylan image to Micro SD Card
Put SD card into RPi and boot-up completely
SETUP WIFI USING BERRYLAN:
Open Berrylan app on phone and select for 'BT WLAN setup' or 'BT WLAN' or 'raspberrypi' depending on what is displayed. The most common is 'BT WLAN'. If you see more than one, then pick the first one and go through the steps. If it ends up not being this particular RPi, then run it again and select the next one. You may have to give the app alittle time to find it however, so don't be too impatient.
Select WiFi SSID to use
Enter the WiFi password
Write down the IP address that is displayed. You'll need this later. You can tap it and copy it to clipboard
LOGIN USING SSH CLIENT:
Open a SSH Client and enter the 'pi@IP address' to start the login process, i.e. '[email protected]'
Login using username 'pi' and password 'raspberry'. If a normal image was used, then SSH must be enabled before these clients will work. Berrylan automatically enables SSH. Otherwise use raspi-config to do so.
Note: There are a number of SSH Clients. A few of the more popular are;
KiTTY.
PuTTY and other PuTTY versions
MobaXterm
WinSCP
SmarTTY
Bitvise SSH Client
Terminal (for Mac)
Chrome SSH extension
SETUP SPI INTERFACE:
At the cmd line prompt; 'pi@raspberrypi:~ $' enter the following;
sudo raspi-config
3 - Interface Options
I4 SPI Enable this? Yes
Note: You can change the hostname and password if desired at this point, but its optional
Answer 'Yes' when you exit raspi-config to Reboot the RPi
SETUP GITHUB ON RPI:
After RPi boots up and you login through your SSH client, enter;
sudo apt update
sudo apt-get install git
git --version
If you receive a git version number than you are good to go.
COPY FILES FROM GITHUB:
Enter;
sudo git clone https://github.com/markyharris/metar.git
cd metar
ls -la
This should list the files copied from github to verify it worked properly
DEPENDENCIES:
Install necessary dependencies needed for the software;
sudo apt-get install python3-setuptools
sudo apt install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install Flask
FONTS:
The code is written with 'NotoMono-Regular.ttf' and 'LiberationMono-Bold.ttf' in used, so at minimum these need to be installed. If not enter;
cd /usr/share/fonts/truetype/
sudo mkdir noto
sudo mkdir liberation2
cd noto
sudo wget https://github.com/markyharris/metar/raw/f1858d85ad3b79864fb6e082cd083346828661ef/fonts/noto/NotoMono-Regular.ttf
cd ..
cd liberation2
sudo wget https://github.com/markyharris/metar/raw/f1858d85ad3b79864fb6e082cd083346828661ef/fonts/liberation2/LiberationMono-Bold.ttf
TEST RUN METAR DISPLAY:
Enter;
cd ~
cd metar
sudo python3 metar_main.py
If all is well the cmd line will display debug data including a raw metar string. Watch your e-paper display to see if it starts to blink as it updates. The full refresh can take a number of seconds so be patient. After a bit a layout should be displayed showing the default airport from metar_settings.py
If so, you are good to go!
Now edit the metar_settings.py file as you wish. These values are defaults that the script falls back on.
# Default User Settings
airport = "KFLG" # enter default airport identifier to display. Be sure to use quotes
interval = 1800 # enter default time in seconds between METAR updates - 3600 = 1 hour, no quotes
use_disp_format = 7 # Choose which display layout to use. -1 = Random layout, -2 = Cycle layouts
use_remarks = 1 # 0 = display airport information, 1 = display metar remarks info
random_airports = ["KEYW","KDFW","KSEA","KORD", "KLAS","KCMR","KABQ","KDEN", \
"KPHX","KNBC","KBKV","KTTS"]
TEST CMD LINE CONTROL:
The script was written to except up to 4 cmd line arguments;
1st argument - airport identifier - must be 4 character ICAO format
2nd argument - layout number - will accept -2, -1, and 0-7
3rd argument - update interval in seconds - 60 = 1 minute, 3600 = 1 hour
4th argument - use remarks - 1 = display metar remarks key info, 0 = display airport information
They must be in the order shown, but not all of them are required. For instance only the Airport ID can be used, and the others will be filled in using the default settings in metar_settings.py
For example enter;
sudo python3 metar_main.py kflg 7 60 0
The display will show the Flagstaff Airport using Layout 7 for 60 seconds before updating using airport info.
Assuming this is works properly, then using the webapp.py and metar.html scripts below should work just fine.
TEST WEBAPP.PY:
From the metar directory enter;
sudo python3 webapp.py
This will run a Flask module that will start metar_main.py in last save configuration. Flask sets up a web server so we can also run an html file to control the display from any computer, tablet or phone that is on the same wifi network.
If all is good your display should be showing a layout of information.
Make note that when webapp.py starts, information will be displayed in your SSH client. You will need the URL that it provides. For instance; '* Running on http://192.168.86.71:5000/ (Press CTRL+C to quit)'
TEST METAR.HTML:
Using the URL from the previous step, open a web browser and enter it in the URL. If all is well you will see a web page that allows for easy configuration and change to the display.
SETUP RC.LOCAL FOR STARTUP:
This is optional, but if you would like the display to restart automatically after a shutdown, or accidental power outage then this is a good way to go. Also, the webapp.py must be running for the web interface to work properly.
Enter;
cd ~
cd /etc
sudo nano rc.local
Before the 'Exit' statement add;
sudo python3 /home/pi/metar/webapp.py &
Then to save and reboot;
ctrl-x
y
sudo reboot now
Note: There may be times when you don't want webapp.py to startup automatically, so simply open up rc.local again and comment out the line that was added then resave and reboot.
SETUP POWEROFF.SERVICE FOR SHUTDOWN:
This is optional as well, but its nice to blank the epaper display when the unit is shutdown. A power outage won't blank the screen, but once the power comes back on it will reset the display if you setup rc.local above.
Power Off Service installation:
Copy 'poweroff.service' into /lib/systemd/system;
cd ~
cd /lib/systemd/system
sudo wget https://raw.githubusercontent.com/markyharris/metar/main/poweroff.service
Enable the service by entering;
sudo systemctl enable poweroff.service
Copy the python script 'metar_poweroff.py' into /opt/metar_poweroff;
cd ~
cd /opt
sudo mkdir metar_poweroff
cd metar_poweroff
sudo wget https://raw.githubusercontent.com/markyharris/metar/main/metar_poweroff.py