Forum
[PROBLEM] Fan control - GPIO pins not working - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Hardware (/forum-7.html)
+--- Forum: Peripherals (/forum-27.html)
+--- Thread: [PROBLEM] Fan control - GPIO pins not working (/thread-4087.html)



Fan control - GPIO pins not working - oz1sej - 26th Apr, 2020 10:46 PM

How does one control a fan under xbian?

I'm running Linux xbian 4.19.90+ #1 SMP PREEMPT Wed Dec 18 20:39:10 CET 2019 armv7l GNU/Linux on a Raspberry Pi 3. For all my other Raspberry Pi's, I've attached a fan for PID CPU temperature control which is PWM modulated via a GPIO pin through a python script. It works flawlessly on my other Pi's.

First thing I notice is that python says

Terminal
ImportError: No module named RPi.GPIO

So I try

Terminal
pip install RPi.GPIO

Turns out that pip is not installed. So I go to https://pip.pypa.io/en/stable/installing/ which says to run

Terminal

Turns out that curl is not installed. So I run

Terminal
sudo apt install curl

and then

Terminal
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

and then

Terminal
sudo pip install RPi.GPIO

which gives me LOTS of errors. Then I say to myself: If I can just turn on the fan, at least I can cool the CPU. But it turns out that even

Terminal
sudo echo 1 > /sys/class/gpio/gpio17/value

gives me "Access denied".

How does one control a fan under xbian?


RE: Fan control - GPIO pins not working - Nachteule - 29th Apr, 2020 10:06 PM

Good question. Maybe you have to figure out first why sudo pip install RPi.GPIO creates a lot of errors


RE: Fan control - GPIO pins not working - the_redburn - 31st Aug, 2021 02:35 AM

For the record, the easiest way to install RPi.GPIO is with
Terminal
sudo xbian-config
Look in package > python

To install a pre-release of RPi.GPIO, do
Terminal
sudo apt-get install python-dev
then
Terminal
pip install RPi.GPIO==[version]
If you go to https://pypi.org/project/RPi.GPIO/#history then click on the version you want, the command will be shown at the top of the page.

By the way, 0.7.1a4 or later is needed for Raspberry 4 support.

I forgot to mention that root is currently needed on xbian for GPIO access.
See https://github.com/xbianonpi/xbian/issues/898 for non root access.