-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallation
92 lines (67 loc) · 3.21 KB
/
installation
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
# Installation notes
Guide and tips for installation
OS
Use RPi Imager to install Legacy RPi OS 32-bit if used with a Adafruit TFT display. For other applications newer versions (also 64 bit) can be used.
## Client
Code for client program is maia.py
************ DEPENDENCIES *******************
guizero: Check that you have the newest version at https://lawsie.github.io/guizero/#upgrading-guizero
Make sure to copy mypi.py to same directory as maia.py
Using Bookworm you have to install GUIzero manually by copying the guizero directory from GitHub. See their installation notes there
For MAIAserver these should be installed as well in order to support weather data sensors:
pip3 install Adafruit_DHT
pip3 install BMP280
ALL dependencies to be installed with PIP3 for Python3 compatibility
*************** DISPLAYS **********************************
The screensaver can be disabled by installing:
sudo apt install xscreensaver
Goto desktop and open the new screensaver. Preferences/Display Modes/Mode: "Disable Screen Saver" will keep the screen on at all times
7" RPi TFT:
Control of brightness (0-255) from command line eg set to 50%:
sudo sh -c 'echo "128" > /sys/class/backlight/rpi_backlight/brightness'
Same as Python code in MAIA if RPibrightness=128:
subprocess.run(['sudo','sh','-c','echo ' + str(RPibrightness) + ' > /sys/class/backlight/rpi_backlight/brightness'])
Adafruit PiTTFT:
Installation of PiTFT display driver from AdaFruit
cd ~
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
chmod +x adafruit-pitft.sh
sudo ./adafruit-pitft.sh
Answer n to console
Answer y to HDMI mirroring
Answer y to REBOOT
PiTFT to be configured with HDMI mirroring and autostart of Python-file after desktop LXDE load:
Test PiTFT display on/off from command prompt:
sudo sh -c 'echo "0" > /sys/class/backlight/soc\:backlight/brightness'
sudo sh -c 'echo "1" > /sys/class/backlight/soc\:backlight/brightness'
PiTFT Display commands in Python. Enable Pulse Width Modulation:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 1000)
pwm.start(50)
*************** AUTOSTART MAIA IN GUI *****************************************
Option 1 (seems to be the best method)
mkdir /home/pi/.config/autostart
nano /home/pi/.config/autostart/maia.desktop
[Desktop Entry]
Type=Application
Name=MAIA
Exec=/usr/bin/python3 /home/pi/maia.py
Option 2 (tested but disables the RPi desktop)
edit startfile without sudo:
nano ~/.config/lxsession/LXDE-pi/autostart
@sudo /usr/bin/python3 /home/pi/maia.py
#@thonny /home/pi/maia.py
#@python3 /home/pi/maia.py
@xset s noblank # disable blanking
@xset s off
@xset s -dpms
For debugging this procedure (method 2) can be used in order to read the background shell
https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/all
********************************
## Server
The server is based on a standard RPi (Zero is fine) and some components for interfacing with peripherals. Check the PDF schematic for explanation
Code: MAIAserver.py
## Simulator
Code: MAIAsimulator.py