Open main menu

Changes

X735-script

13,985 bytes added, 13 September
{{GD Template Impl}}
==Overview==
This is script installation tutorial for [[X735]] v2.5 & v3.0, it will replace [[X735 Software | X735 Software installation tutorial]], although [[X735 Software | X735 Software installation tutorial]] is still available, but we strongly recommend that you use this script tutorial, which simplifies the installation process and reduces dependencies on third-party python libraries.


The core shell script of [[X735-script]] comes from from [https://github.com/pimlie/geekworm-x-c1 pimlie/geekworm-x-c1], pimlie implements the pwm fan shell script, which does not depend on third-party python libraries at all. Thanks to pimlie.


Now we think you have successfully flashed the OS Image into Micro SD and and power on the device, and you have also completed the operations such as creating new user required in some OS. You need to perform the following operations in <code>Terminal</code>.


'''[update]'''

1. Use '''gpiod''' instead of obsolete interface, and supports ubuntu 23.04 also


2. The script now supports the Raspberry Pi OS '''BOOKWORM''' version. You just need to '''uninstall''' the original script and '''reinstall''' it. Please refer to the following:

Open ternimal window, then run the following command:
<pre>
mv x735-script x735-script-old
git clone https://github.com/geekworm-com/x735-script
cd x735-script
chmod +x *.sh
./uninstall.sh
</pre>
Then just follow the installation process below.


3. Fix fan not working on Raspberry Pi 5 hardware

If you are using it on a '''Raspberry Pi 5''', make the following changes:

* Be sure to update the kernel to version '''6.6.22''' or more high version.
sudo apt update
sudo apt full-upgrade
sudo rpi-update
* Change the <code>PWM_CHIP_PATH</code> to <code>/sys/class/pwm/pwmchip2</code> on line 7 of '''x735fan.sh'''

==OS that has been tested==
* Raspbian
* DietPi
* Manjaro
* Ubuntu
* myNode
* Umbrel
* Volumio
* RetroPie
* Twister

==Install==
===Preconfigured <code>config.txt</code>===
To install pwm fan, first add <code>dtoverlay=pwm-2chan,pin2=13,func2=4</code> to <code>/boot/firmware/config.txt</code> under [all] or the end of file and <code>reboot</code>:
sudo nano /boot/firmware/config.txt
Save & exit.
sudo reboot

===Install gpiod package===
sudo apt install -y gpiod

If you need to use '''pwm_fan_control.py''' in some OS, need to install the following python dependencies
sudo apt-get install -y python3-rpi.gpio

===Clone the script===
Clone pruduct software script
git clone https://github.com/geekworm-com/x735-script
cd x735-script
chmod +x *.sh
'''PS''': For some OS such as ''Raspberry Pi OS Lite'', the '''''git''''' tool is not installed by default, if you get an error like ''error: -bash: git: command not found'', please run the following command to install the git tool.
sudo apt install -y git
<!--
2. Download xGPIO tool
wget https://github.com/geekworm-com/xgpio/raw/main/bin/ubuntu/xgpio_pwr
wget https://github.com/geekworm-com/xgpio/raw/main/bin/ubuntu/xgpio_soft
After the download is successful, there will be two files xGPIO_pwr and xGPIO_soft in the current directory.
-->

===Configuring Different GPIO Chip for <span class="tb_red">Raspberry Pi 5 hardware</span>===
If you are not using Raspberry 5 hardware(such as you are using pi 4 hardware), directly skip this step,or run the following command to set differnt chip and pwm number.

PS: Since 2024-09-02, Raspberry Pi has finally unified the gpipchip to 0 on all Raspberry Pis(Pi, 0, 1, 2, 3, 4, 5). Previously, the gpiochip on the Raspberry Pi 5 was 4.

So we comment out the following command line.
#sed -i 's/xPWR.sh 0 5 12/xPWR.sh 4 5 12/g' x735-pwr.service
PS: But on the Raspberry Pi 5 the pwmchip is still 2, not 0 as used on the Pi 0/1/2/3/4, so you still run the following command if you work on RPi 5 hardware.
sed -i 's/pwmchip0/pwmchip2/g' x735-fan.sh

===Create the x735-fan service===
x735-fan service is for pwm fan, the pwm fan will automatically adjust the runing speed according to the temperature of the cpu after the service is started.

Run the following command to install fan service script;
sudo ./install-fan-service.sh
Then the pwm fan starts running.

PS: If fan don't works, be sure to update the kernel to version 6.6.22, don't work on 6.6.20, it's a kernel issue.
sudo apt update
sudo apt full-upgrade
sudo rpi-update
Run the command '''''uname -r''''' to check kernel verson

===Create the x735-pwr service===
sudo ./install-pwr-service.sh

===Prepair software shutdown script===
1. Prepaid the xSoft.sh command
sudo cp -f ./xSoft.sh /usr/local/bin/
2. Then run the following command to create a alias 'x735off' command
echo 'alias x735off="sudo /usr/local/bin/xSoft.sh '''0''' 20"' >> ~/.bashrc
3. Run the following command to make the alias '''x735off''' effective
source ~/.bashrc
After the installation is complete, an <code>x735off</code> command will be created to safe shut down.Then you can run <code>x735xoff</code> to execute software shutdown.

==Uninstall==
Run the following command to uninstall all.
sudo ./uninstall.sh

==Test==
===Test safe shutdown===
'''Software safe shutdown command''':
x735off
<span class="tb_red">DON'T run the 'shutdown' linux command to shut down, otherwise the power of x735 shield will not be shut down.</span>

'''Hardware safe shutdown operation''':

You can verify the safety switch through the onboard switch, press and hold the switch for <code>3</code> seconds, then the blue LED will flash slowly and the shutdown is going then all LEDs will be off until the device is completely powered off.
* press on-board button switch <code>1-2</code> seconds to reboot
* press button switch <code>3</code> seconds to safe shutdown,
* press <code>7-8</code> seconds to force shutdown.

===Read fan speed===
<code>read_fan_speed.py</code> is a sample python file on how to read the speed of the pwm fan. Run the following command to get the speed of the fan:
cd ~x735-script
sudo python3 read_fan_speed.py

This `read_fan_speed.py` python file depends on the third-party python library `Rpi.GPIO`. In the official Raspberry Pi OS and most third-party OS, this library is installed by default. If you run this file and get some errors, try to run the following command to install the Rpi.GPIOy library.
sudo apt-get install -y python3-smbus python3-rpi.gpio

Or you can refer to [[How to Install RPi.GPIO Python Library]]

===Other===
<code>pwm_fan_control.py</code> is no longer used, and are reserved here for research and use by python lovers only.
==How to make the fan run after upgrading umbrel to 1.0==

Above X735-script mainly implements three functions of [[X735]] hardware:

1. '''Fan service''': Use shell scripts or other high-level languages such as python to control the pwm fan; (corresponding to [[#Create_the_x735-fan_service]])

2. '''Power management service''': Use the shell to detect the user's keystrokes in real time to perform a safe shutdown or restart; (corresponding to [[#Create_the_x735-pwr_service]])

3. '''Software shutdown service''': Provides a shell script to implement command line shutdown (corresponding to [[#Prepair_software_shutdown_script]])

Among them, the purpose of editing '''config.txt''' is to support the x735 fan service. Since the '''/boot''' directory of '''umbrel''' is read-only, we cannot edit the config.txt file, so we cannot use the method provided on our wiki page to install the x735 fan service. , that is, after you install the fan service, the fan of the X735 will still not run; but the other two functions can be used. You only need to follow the above steps on the current page to achieve '''pressing button to shutdown''' and '''software command line shutdown'''; (PS: After the installation is completed, you can '''press the key for 3 seconds''' to test whether the safe shutdown of the X735 is working properly).

Now let us solve the problem of pwm fan not running in umbrel 1.0:

We can use python code to make the pwm fan run. There is a '''pwm_fan_control.py''' file in the x735-script directory. You can run '''python3 pwm_fan_control.py''' to make the fan run, it's that simple.

After the fan runs successfully, we need to let the '''python3 pwm_fan_control.py''' command run automatically after booting, so we need to change the '''x735-fan.service''' file as follows:
cd
cd x735-script
nano x735-fan.service
[[File:X735-fan-service-umbrel.png]]

Press '''Ctrl + O''' to save this file.

Press '''Ctrl + X''' to exit nano editor.

Then execute '''sudo ./install-fan-service.sh''' to install fan service script.

It should be noted that since the '''pwm_fan_control.py''' file uses the '''RPi.GPIO''' python library, you need to install this python dependencies package in advance:
sudo apt-get install -y python3-rpi.gpio

Finally, as a reminder, please remove the local x735-script folder and then re-execute the above installation process.

==Support==
* https://github.com/geekworm-com/x735-v2.5/issues/6
* If you have some questions or suggestions, please contact to <span class="tb_red">support@geekworm.com</span>

==FAQ==

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q1: Why does running <code>python3 ~/x735-script/read_fan_speed.py</code> get errors?
</div>
<div class="mw-collapsible-content">
A: After upgrading raspberry if you launch the command: <code>python3 ~/x735-script/read_fan_speed.py</code> you may get the following error:
<pre>
pi@raspberrypi:~/x735-script $ python3 read_fan_speed.py
Traceback (most recent call last):
File "/home/pi/x735-script/read_fan_speed.py", line 29, in <module>
GPIO.add_event_detect(TACH, GPIO.FALLING, fell)
RuntimeError: Failed to add edge detection
</pre>
The reason is caused by the '''rpi.gpio''' library not being upgraded after the kernel upgrade, which can be referred to here https://github.com/raspberrypi/linux/issues/6037 to know more detail and solutions

The solution is as follows:

replace '''rpi.gpio''' with '''rpi-lgpio''' by running the following command:
sudo apt update && sudo apt install python3-rpi-lgpio --auto-remove --purge
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q2: How can I help you solve your issues?
</div>
<div class="mw-collapsible-content">
A: First of all you really need to read our wiki tutorial carefully and then carefully step by step, try not to type in the commands, you should copy our commands from the wiki page. If you can read linux shell scripts, reading them directly is the best way to go. One thing to note is that it requires you to git the new script again after remove the old x735-script fold first because we updated this page tutorial and github project in '''April 2024'''
If you still can't get the board to work, please provide the results of the following commands via email for us to troubleshoot:
cat ~/.bashrc
sudo systemctl status x735-pwr
sudo systemctl status x735-fan
history
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q3: How to login '''volumio''' via SSH?
</div>
<div class="mw-collapsible-content">
1. Enable SSH:

Visit http://volumio.local/dev/, then click '''ENABLE SSH''' button

2. URL connection is IP address, and the default user name is '''volumio''', default password is '''volumio'''
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q4: How to login to <b>myNode</b> via SSH?
</div>
<div class="mw-collapsible-content">
A: URL connection is IP address, and the default user name is '''admin''', default password is '''bolt'''
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q: How to login to Umbrel via SSH?
</div>
<div class="mw-collapsible-content">
A: ssh umbrel@umbrel.local (or ssh umbrel@). the default user name is '''umbrel''', default password is '''moneyprintergobrrr'''
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q5: How to login to DietPi via SSH?
</div>
<div class="mw-collapsible-content">
A: URL connection is IP address, and the default user name is '''root''', default password is '''dietpi'''
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div style="font-weight:bold;line-height:1.0;">
Q6: Is LibreELEC supported?
</div>
<div class="mw-collapsible-content">
A:No support for LibreELEC

We have tried installing the script on LibreELEC but with no success. You will get the following message
<pre>
LibreELEC:~ # apt-get install -y gpiod

There is no working 'apt-get'.

'apt-get' is a command to install, update and remove software which
is stored in a non local repo. 'apt-get' does nothing then connecting to such
repo, downloads the software, unpacks the software, updates a big
local database with all filepaths and other informations about the
installed software or removes or updates installed Software.

With LibreELEC it is not possible to change the system for security and
stability reasons so even 'apt-get' would not be able to do this.
We also dont have and want to maintain such a repo for various other
great reasons.

Also Ubuntu or Debian packages are often outdated and not compatible
with LibreELEC

TIP: use Kodi's addon browser to enhance your LibreELEC system
LibreELEC:~ #
</pre>

But you can remove the ['''Fan FS'''] jumper to make the PWM fan run at full speed.

'''How to enalbe ssh connection?'''

Refer to: https://www.jeffgeerling.com/blog/2022/using-libreelec-pro-management-ssh

</div>
</div>


Return to [[X735]]

<!--Add review function! -->
<comments />

<!--Please choose the -->
<!--Remove other categories, just keep the appropriate categories -->

[[Category:Product Manual]]
[[Category:Raspberry pi]]
[[Category:Knowledge]]