Open main menu

Changes

X-C1 Software

9,524 bytes added, 15:37, 8 September 2023
no edit summary
{{GD Template Impl}}
This guide <big>Although this tutorial is only for x-c1 adapter shield.still available, but we strongly recommend that you use [[XScript]] new tutorial, and we no longer maintain this page</big>
'''Note:''' Not tested with '''Home Assistant''', for some reason, we are not able to upgrade and use the Home Assistant to test, please pay attention to check if there is any update in the future.(If you have successfully tested Home Assistant, welcome to share your experience via email at: support@geekworm.com) <hr/> [Update] Support [https://getumbrel.com/ Umbrel] now. The script is '''not tested''' VMware ESXI ARM operating system. To make the 3pin PWM cooling fan running, please remove/pull out the yellow cable if you use X-C1 V1.3 version.Remove the jumper cap on "Fan FS" PIN of X-C1 V2.0 to let the fan running at full speed. NOTE: In general, two important libraries are needed to run this script:  1. pigpiod, refer to http://abyz.me.uk/rpi/pigpio/download.html 2. Python, try to run 'python --version' to check it. ==For Raspbian / RetroPie / Twister OS v2.0.2 ==Test this script based on the following OS:* Tested '2022-04-04-raspios-buster-armhf.img" on Apr. 13, 2022;* Raspbian 2021-05-07-raspios-buster-armhf, 2021-10-30-raspios-bullseye-armhf.img, 2021-10-30-raspios-bullseye-armhf-lite.img* RetroPie 4.7.1* Twister OS v2.0.2 / Twister OS 2.1.2 '''install'''  cd ~ sudo apt-get update sudo apt-get -y upgrade sudo apt-get -y install i2c-tools python3-smbus python3-rpi.gpio sudo apt-get install -y git sudo apt-get install -y pigpio python3-pigpio git clone https://github.com/geekworm-com/x-c1.git cd x-c1 sudo chmod +x *.sh sudo bash install.sh echo "alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" >> ~/.bashrc sudo reboot If reboot fails, please force shutdown or power off and restart ''' PWM fan control''' The script is installed successfully and the fan starts to run '''Test safe shutdown''' xoff* Please run 'xoff' to shut down or press the on-board button switch to shut down. <span style=How "color:red;">DON'T run the 'shutdown' linux command to setup shut down, otherwise the power of X-C1 will not be shut down.</span>* press button switch `1-2` seconds to reboot* press button switch `3` seconds to safe shutdown,* press `7-8` seconds to force shutdown. '''uninstall'''<pre>sudo ./uninstall.sh</pre> ==For ubuntu mate / ubuntun desktop / ubuntu server==Test this script??based on the following OS:* ubuntu-mate-20.04.1-desktop* ubuntu server 21.04* ubuntu-21.04-preinstalled-desktop-arm64+raspi '''install'''<pre>cd ~sudo apt-get updatesudo apt-get upgrade sudo apt-get install -y unzip make gcc python git wiringpi python3-pigpio python-setuptools python3-rpi.gpiosudo apt-get install -y python3-distutils #install pigpio library, also refer to http://abyz.me.uk/rpi/pigpio/download.htmlwget https://github.com/joan2937/pigpio/archive/master.zipunzip master.zipcd pigpio-mastersudo makesudo make install cd ~git clone https://github.com/geekworm-com/x-c1cd x-c1sudo chmod +x *.shsudo bash install-ubuntu.sh echo "alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" >> ~/.bashrcsudo reboot</pre> '''Test safe shutdown''' xoff* Please run 'xoff' to shut down or press the on-board button switch to shut down. <span style="color:red;">DON'T run the 'shutdown' linux command to shut down, otherwise the power of X-C1 will not be shut down.</span>* press button switch 1-2 seconds to reboot* press button switch 3 seconds to safe shutdown,* press 7-8 seconds to force shutdown. '''uninstall'''<pre>sudo ./uninstall-ubuntu.sh</pre> == For myNode OS and Umbrel ==About myNode, please refer to http://www. Once you have logged into your Raspberry Pi from mynodebtc.com/ About Umbrel, please refer to https://getumbrel.com/ '''Install''' Login to mynode teminal via Putty or Xsheel tool, the default user name is `admin`, default password is `bolt`, then run the following command line: Login to Umbrel teminal via Putty or Xsheel tool, the default user name is `umbrel`, default password is `moneyprintergobrrr`, then run the following commandscommand: '''FAQ''' Q: What are the credentials to SSH into my Umbrel? A: ssh umbrel@umbrel.local (or ssh umbrel@<IP address of your Umbrel>). The password is the same as your Umbrel's password. If you haven't set a password yet, the default password is: moneyprintergobrrr. <pre>
sudo apt-get update
sudo apt-get install pigpio python-pigpio python-smbuswiringpi -y git clone https://github.com/geekworm-com/x-c1 cd x-c1 chmod +x *.sh sudo aptbash install-get install pigpio pythonmynode.sh echo "alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" >> ~/.bashrc  sudo reboot</pre> ''' PWM fan control''' The script is installed successfully and the fan starts to run '''Test safe shutdown''' xoff* Please run 'xoff' to shut down or press the on-board button switch to shut down. <span style="color:red;">DON'T run the 'shutdown' linux command to shut down, otherwise the power of X-C1 will not be shut down.</span>* press button switch 1-pigpio python32 seconds to reboot* press button switch 3 seconds to safe shutdown,* press 7-pigpio8 seconds to force shutdown.
2'''uninstall''' . Download script and some sample code/uninstall-mynode.sh == For DietPi== git clone About DietPi, please refer to [https://githubdietpi.com/geekwormURL] Test 'DietPi_RPi-com/xARMv6-Bullseye.image' on May 5th, 2022. '''Install''' Test it base DietPi_RPi-ARMv8-c1Buster.gitimg
3login via teminal window, the default user name is `root`, password is `dietpi`, then run the following command:<pre> sudo apt-get update sudo apt-get install git pigpiod python3-pigpio python3-smbus python3-rpi. Setup scriptgpio -y git clone https://github.com/geekworm-com/x-c1
cd x-c1
sudo chmod +x x-c1.sh sudo bash x-c1*.sh
4 sudo bash install-dietPi. Rebootsh  echo "alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" >> ~/.bashrc
sudo reboot
</pre>
5. '''PWM fan control''' The script is installed successfully and the fan starts to run '''Test safe shutdown'''
xoff
* Please run 'xoff' to shut down or press the on-board button switch to shut down. <span style="color:red;">DON'T run the 'shutdown' linux command to shut down, otherwise the power of X-C1 will not be shut down.</span>
* press button switch `1-2` seconds to reboot
* press button switch `3` seconds to safe shutdown,
* press `7-8` seconds to force shutdown.
At this time, the fan is still not rotating, we need to continue to install the pwm fan control script'''uninstall''' sudo ./uninstall-dietPi.sh
We can manually run the following commands==For Manjaro==About Manjaro, please refer to https: sudo python /home/pimanjaro.org/x-c1/x-c1_pwm_fan_control.py&
Then the pwm fan will start workingTest this script based on Manjaro-ARM-kde-plasma-rpi4-21.07.img
But we hope that the script can be executed automatically when the Raspberry Pi board boots, we can use crontab system command to achieve it. please refer to the following'''install'''<pre>cd ~sudo pacman -Syyusudo pacman -S unzip make gcc python python-setuptools git
6#install pigpio library, also refer to http://abyz.me.uk/rpi/pigpio/download. How to start PWM fan when pi 4 bootshtmlwget https://github.com/joan2937/pigpio/archive/master.zipunzip master.zipcd pigpio-mastersudo makesudo make installsudo cp /usr/local/lib/libpigpio* /usr/lib/
sudo crontab -e#install wiringpigit clone https://github.com/WiringPi/WiringPi.gitcd WiringPi./build
[[Filecd ~git clone https:Crontab//github.com/geekworm-com/x-c1cd x-c1sudo chmod +x *.shsudo bash install-step1manjaro.png]]sh
Choose #create a alias xoffecho "1alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" then press Enter>> ~/.bashrcsudo reboot</pre>
Add a line at the end of the file that reads like this:'''PWM fan control'''
@reboot python /home/pi/x-c1/x-c1_pwm_fan_control.pyThe script is installed successfully and the fan starts to run
Please note the path of this file.'''Test safe shutdown'''
[[File xoff* Please run 'xoff' to shut down or press the on-board button switch to shut down. <span style="color:Crontabred;">DON'T run the 'shutdown' linux command to shut down, otherwise the power of X-C1 will not be shut down.</span>* press button switch `1-2` seconds to reboot* press button switch `3` seconds to safe shutdown,* press `7-8` seconds to force shutdown. '''uninstall'''<pre>sudo ./uninstall-ubuntu.sh</pre> ==For LibreELEC==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, so we cannot install some third-step2party libraries like pigpiod, Therefore, safe shutdown and dynamic adjustment of fan speed cannot be supported on liberelec.png]]
Save and exit (CTRK + O and ENTER '''Please pull out the yellow wire of the fan to save it). In nano editor, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted.make the fan run immediately'''
== How return to read the fan RPM?==X-C1 don't support read fan RPM![[NASPi]]
==For Volumio ==
Test this script based on the following OS:
* Volumio-3.175-2021-12-13-pi.img
 
'''install'''
 
cd ~
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y git pigpio
sudo apt-get install -y python-pigpio python3-pigpio
sudo apt-get install -y python-smbus python3-smbus
git clone https://github.com/geekworm-com/x-c1.git
cd x-c1
sudo chmod +x *.sh
sudo bash volumio.sh
echo "alias xoff='sudo /usr/local/bin/x-c1-softsd.sh'" >> ~/.bashrc
sudo reboot
 
''' PWM fan control'''
The script is installed successfully and the fan starts to run
 
'''Test safe shutdown'''
xoff
* Please run 'xoff' to shut down or press the on-board button switch to shut down. <span style="color:red;">DON'T run the 'shutdown' linux command to shut down, otherwise the power of X-C1 will not be shut down.</span>
* press button switch `1-2` seconds to reboot
* press button switch `3` seconds to safe shutdown,
* press `7-8` seconds to force shutdown.
 
'''uninstall'''
<pre>
sudo ./uninstall.sh
</pre>
 
'''Note'''
<pre>
Enable SSH:
http://volumio.local/dev/
Name: volumio
Password: volumio
</pre>
we use the default password to run the volumio.sh, please replace default password 'volumio' with your new password in volumio.sh file .(Line 72)
 
==FAQ==
Q1: Can't connect to pigpio at localhost(8888)
<pre>
Can't connect to pigpio at localhost(8888)
Did you start the pigpio daemon? E.g. sudo pigpiod
 
Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888
 
Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Traceback (most recent call last):
File "/home/volumio/x-c1/fan.py", line 8, in <module>
pwm.set_mode(servo, pigpio.OUTPUT)
File "/usr/lib/python2.7/dist-packages/pigpio.py", line 1376, in set_mode
return _u2i(_pigpio_command(self.sl, _PI_CMD_MODES, gpio, mode))
File "/usr/lib/python2.7/dist-packages/pigpio.py", line 1025, in _pigpio_command
sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
AttributeError: 'NoneType' object has no attribute 'send'
</pre>
A: If you find an error similar to the above, it is because pigpiod library is not started, we need to run pigpiod first,
sudo pigpiod
python 'your directory'/x-c1/fan.py &
If 'sudo' command request a password, you can use the following command:
echo 'your password' | sudo -S pigpiod
python 'your directory'/x-c1/fan.py &
You can put these two lines in the /etc/rc.local file so that it will run automatically after booting.
 
[[File:Volumio-rc-local.jpg|800px]]
 
Q2:How to get the current fan speed value? As I remember old x735 software where with such read_fan_speed.py script example, but not found such in X-C1.
 
A: The X-C1's PWM fan is a 3Pin FAN, and does not support reading speed. The Fan of X735 is a 4Pin PWM fan.
 
<hr/>
<!--Add review function! -->
<comments />
 
[[Category:Product Manual]]
[[Category:Raspberry pi]]
[[Category:Knowledge]]