Anscheinend kann/darf ich keine Datein (txt) hochladen, also wie ist es hiermit …
Das „2nd Chapter“ müsste noch fertig geschrieben werden.
#######################################################
##################### 1st Chapter #####################
#######################################################
##################### Preparation #####################
-
download/install the „Raspberry Pi Imager“ from the web page for your operating system (MS-Win or macOS)
Raspberry Pi OS – Raspberry Pi
-
open the „Raspi Imager“ and choose under the operating system
Raspberry Pi OS Lite (64-bit) Bullseye
Published: 2023-02-21
0.3 GB
-
under the settings (cogwheel) i would enter the following
→ these are only examples and you please choose your own!
- the hostname (umbrel-test.local)
- use SSH (active) and password for authentication
- username (umbrel) password (what you prefer)
- for now no wfi
- set language setting, timezone and keyboard layout
- then flash the SD card with it
##################### Start #####################
4.0. start Raspi und open SSH connection
- insert your SD card with the flashed PI OS Lite (Bullseye) into the Rasverry Pi slot and turn on
information:
with my constellation, the fan has now immediately started to run. Should it not be the same for you, don’t panic.
- open the SSH connection to the Raspi, i use putty (MS-Windows) https://www.putty.org/
##################### check/set timezone/time #####################
5. check or set timezone and time
- timedatectl
- sudo timedatectl set-tizum beispielmezone Europe/Berlin (for example)
##################### observe temperature #####################
6. i am watching in a new putty window the temperature with
- while endless=0; do echo
date +%T
Uhr: vcgencmd measure_temp
; sleep 5; done
##################### check Debian Version #####################
7. which Debian version is currently used?
remember, since we are now updating
##################### upgrade OS #####################
8. upgrade Debian OS
- sudo apt update
- sudo apt upgrade
- sudo reboot
check again after reboot
- hostnamectl
##################### install/check tools #####################
9.0. install „Git“ run the following command
- sudo apt-get install git – installs 003 archives and requires about 37.7 MB of SD card space (selected for small SD cards)
- sudo apt-get install git-all – installs 280 archives and requires about 564.0 MB of SD card space
→ verify
- git version (git version 2.30.2)
9.1. Install „Modul Python Serial“
- sudo apt-get install python3
- sudo apt install python3-pip
- sudo pip3 install pyserial
–>verify
- python3 -m pip show pyserial
answer …
Name: pyserial, Version: 3.5, Summary: Python Serial Port Extension, Home-page: GitHub - pyserial/pyserial: Python serial port access library
Author: Chris Liechti, Author-email: cliechti@gmx.net, License: BSD, Location: /usr/local/lib/python3.9/dist-packages
Requires:, Required-by:
- sudo reboot
##################### install/check DeskPi-fan #####################
10.0 Install „DeskPi-fan“ For 64 bit Raspberry Pi OS (aarm64)
–>> Information: in case of installation problems or ERRORS execute
- cd ~/deskpi/
- chmod +x install-raspios-64bit.sh
- sudo ./uninstall-raspios-64bit.sh
10.1 configuration
- deskpi-config
select number 6 and enter your desired values, such as
25°-25%, 30°-50%, 45°-75%, 55°-100%
the fan runs for 15 min. and then it goes off, no panik.
to verify
- sudo systemctl status deskpi.service
- sudo systemctl start deskpi.service
- sudo systemctl stop deskpi.service
##################### Use Python File for DeskPi Service #####################
11.0. Destination directory
-
ls -l /lib/systemd/system/deskpi.service
needs root rights read/write/execute
-
ls -l /usr/bin/
needs root rights read/write/execute
-
ls -l /home/umbrel/deskpi/drivers/python/
needs user rights read/write/execute
11.1. Create new python file „pwmControlFan-v0.py“
Information: the following adjustments must now be made.
change directory
- cd /home/umbrel/deskpi/drivers/python/
create file „pwmControlFan-v0.py“ from file „pwmControlFan.py“
- cp pwmControlFan.py pwmControlFan-v0.py
or
copy file to directory
- cp pwmControlFan.py /home/umbrel/deskpi/drivers/python/pwmControlFan-v0.py
11.2. change file content and save
- sudo nano pwmControlFan-v0.py
Copy this script from the next line
#!/usr/bin/env python3
##############################################################################################################
The line above defines the format and must not be changed and must be the first line in the file
Before you import the library, you need to install pyserial library.
via „pip3 install pyserial“ in Python3.x or „pip install pyserial“ in Python2.x
origi. file name : pwmControlFan-mcb04.py
my file name : pwmControlFan-v0.py
Description : Control the fan on the Deskpi Pro
Author : Deskpi Team, modified by Mike Bartlet
modification Mike : 18/3/2022
version Mike : „1.4“
##############################################################################################################
import serial
import time
cpuTemp_config =
#Read the deskpi.conf file which contains temperature thresholds and fanspeeds. Assign default values if it doesn’t exist.
try:
with open(„/etc/deskpi.conf“) as deskpiConf:
configVals = deskpiConf.read().split()
for c in range(0,8,2): #Odd values are temperature thresholds. Even values are fan speed
cpuTemp_config.append((int(configVals[c]), int(configVals[c+1]))) #Rearrange them into 4 tuples of temperature, fanspeed
except:
cpuTemp_config = [(‚40‘, ‚50‘), (‚50‘, ‚75‘), (‚55‘, ‚100‘), (‚60‘, ‚100‘)] #Format is (temperature, fanspeed)
def openSerPort():
try:
serPort = serial.Serial(„/dev/ttyUSB0“, 9600, timeout=30) #Open the serial port (ttyUSB0). Deskpi uses it to communicate with the Deskpi Pro fan.
except Exception as errDetail:
#If there is a problem opening the serial port
deskpiError = f"{time.asctime()} - Unable to open serial port ttyUSB0. Error:{errDetail}\n"
deskpiLog = open(„/home/pi/Python/MyCode/MyProdCode/deskpi.log“, „a“) #Open the error log for append.
deskpiLog.write(deskpiError)
deskpiLog.close()
serPort = „ttyUSB0 Error“
return serPort
def readCPU_temp():
with open(„/sys/class/thermal/thermal_zone0/temp“) as cpu_temp_file:
cpu_temp = round(int(cpu_temp_file.read())/1000)
return cpu_temp
serPort = openSerPort()
if serPort != „ttyUSB0 Error“:
while True:
if serPort.isOpen():
cpu_temp = readCPU_temp()
if cpu_temp < cpuTemp_config[0][0]:
fan = "Off"
writeVal = bytearray("pwm_000", "utf-8") #Turn fan off if temp is below temp1
elif cpu_temp >= cpuTemp_config[0][0] and cpu_temp < cpuTemp_config[1][0]:
fan = f"{cpuTemp_config[0][1]}%"
writeVal = bytearray(f"pwm_{cpuTemp_config[0][1]:0>3}", "utf-8") #If temp is at or above temp1 but below temp2, set fan speed to speed1
elif cpu_temp >= cpuTemp_config[1][0] and cpu_temp < cpuTemp_config[2][0]:
fan = f"{cpuTemp_config[1][1]}%"
writeVal = bytearray(f"pwm_{cpuTemp_config[1][1]:0>3}", "utf-8") #If temp is at or above temp2 but below temp3, set fan speed to speed2
elif cpu_temp >= cpuTemp_config[2][0] and cpu_temp < cpuTemp_config[3][0]:
fan = f"{cpuTemp_config[2][1]}%"
writeVal = bytearray(f"pwm_{cpuTemp_config[2][1]:0>3}", "utf-8") #If temp is at or above temp3 but below temp4, set fan speed to speed3
elif cpu_temp >= cpuTemp_config[3][0]:
fan = f"{cpuTemp_config[3][1]}%"
writeVal = bytearray(f"pwm_{cpuTemp_config[3][1]:0>3}", "utf-8") #If temp is at or above temp4, set fan speed to speed4
serPort.write(writeVal)
else:
serPort = openSerPort()
time.sleep(5)
11.3. insert into important directory (required)
- sudo cp pwmControlFan-v0.py /usr/bin/pwmControlFan-v0.py
11.4. change directory and set rights
- cd /usr/bin/
- sudo chmod 755 /usr/bin/pwmControlFan-v0.py
11.5. Copy „deskpi.service“ file
change directory
- cd /lib/systemd/system/
copy file
- sudo cp deskpi.service deskpi-Original.service
or
copy file to directory
- sudo cp deskpi.service /lib/systemd/system/deskpi-Original.service
11.6. Change „deskpi.service“ file content and save it
Important information:
in the file the Python filename must be used and make sure that the write permissions are set correctly as described above!
- sudo nano deskpi.service
Copy this script from the next line
[Unit]
Description=DeskPi Fan Control Service
After=multi-user.target
[Service]
Type=simple
RemainAfterExit=no
ExecStart=/usr/bin/pwmControlFan-v0.py &
[Install]
WantedBy=multi-user.target
11.7. reboot and to verify
- sudo systemctl status deskpi.service
- sudo systemctl start deskpi.service
- sudo systemctl stop deskpi.service
Here is the original link to the implementation
→ Automatic Fan Control Stops Working - bytemeta
#######################################################
##################### 2nd Chapter #####################
#######################################################
##################### check, format, mount SSD Drive #####################
Information: this is the preparation and installtion of umbrel and
be careful if you use a SSD device that should NOT be deleted!
12.0. Check internal/external SSD
- sudo lsblk >> all recognized storage media
- blkid -o list >> all mounted storage media
- lsblk >> checking the Partitions
- lsblk -f >> list containing file system information
12.1. Formatting Disk Partition with ext4 File System
Important information:
Caution: we delete data NOW on the SSD device!
- sudo mkfs -t ext4 /dev/sda1 >> mkfs [options] [-t type fs-options] device [size]
12.2. Set Label name „umbrel“ (choose your own SSD label name)
- sudo e2label /dev/sda1 „umbrel_ssd“
12.3. Create a mount point by entering
- sudo mkdir -p /mnt/data >> creates a directory to mount the SSD there
- sudo mount -t auto /dev/sda1 /mnt/data >> SSD will be connected/mount to this directory
information: for umount
- sudo umount /mnt/umbrel_ssd
##################### install umbrel #####################