Open main menu

This guide is only for X715 V1.0 shield based on RASPBIAN.

How to control PWM fan speed

The PWM fan is not rotating when X715 is connected to PI 4, we need to to install the pwm fan control script

#fan control code need pigpiod library, so we need to install it firstly.
sudo apt-get update
sudo apt-get install -y pigpio python3-pigpio python3-rpi.gpio
sudo systemctl enable pigpiod
git clone https://github.com/geekworm-com/x715
//reboot to enable pigpiod
sudo reboot
cd ~
python3 /home/pi/x715/pwm_fan_control.py&

Then the x715 fan will start working.

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

How to start PWM fan when pi 4 boots

The following comment is from X735 V2.5 Software

sudo crontab -e

 

Choose "1" then press Enter

Add a line at the end of the file that reads like this:

@reboot python3 /home/pi/x715/pwm_fan_control.py

Please note the path of this file.

 

Save and exit (CTRK + O and ENTER to save it). In nano editor, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted.

How to read the fan RPM?

please refer to /home/pi/x715/read_fan_speed.py, and this is only show how to get the fan speed every second, run the following command.

sudo python3 /home/pi/x715/read_fan_speed.py

Return to X715

Add your comment
Geekworm Wiki welcomes all comments. If you do not want to be anonymous, register or log in. It is free.


 

Anonymous user #6

7 months ago
Score 0  
Pine64 support (Rock64/Rock64Pro)?
 

Anonymous user #5

11 months ago
Score 0  
The PWM signal is not at 25 kHz as it should using PWMLED
 

Walker

11 months ago
Score 0  
Hi, if you would like to investigate using this code on the Raspberry Pi 5, you can send an e-mail to our technical support( support@geekworm.com ), and we would be happy to start a conversation with you about the Raspberry Pi 5 product.
 

Anonymous user #5

11 months ago
Score 0  

Seems to work with this code:

  1. !/usr/bin/python

from gpiozero import PWMLED import time

try: servo = 13 fan = PWMLED(servo)

while(1):

  1. get CPU temp

file = open("/sys/class/thermal/thermal_zone0/temp") temp = float(file.read()) / 1000.00 temp = float('%.2f' % temp) file.close()

if(temp > 35): fan.value = 0.4

if(temp > 40): fan.value = 0.5

if(temp > 50): fan.value = 0.75

if(temp > 55): fan.value = 0.9

if(temp > 60): fan.value = 1.0

if(temp < 30): fan.off()

time.sleep(1)

except KeyboardInterrupt:

fan.off()
 

Anonymous user #5

11 months ago
Score 0  

The hat works well with a Raspberry Pi 5 but I can not control the fan using PWM. I currently have it running as on-off with the gpiod library.

Any advice on how to use PWM on the Raspberry Pi 5?

Thank you for your help
 

Walker

11 months ago
Score 0  
Hi, because this HAT is compatible with Raspberry Pi 4B/ 3B+/3B, it hasn't been tested on Raspberry Pi 5 yet, if it is used on Raspberry Pi 5, there may be some problems, products related to Raspberry Pi 5 are being designed, please pay attention to our product updates!
 

Anonymous user #4

34 months ago
Score 0  
Won't run, GPIO module not found, even though python is installed. IF I hold the power button on, the fan will then run BUT the until won't boot. Pretty much a useless purchase at this point as I can't use the case without the fan and the fan won't run. I left notes on Amazon and will also check here.
 

Lisa

34 months ago
Score 0  

Hi,

could you please tell us more details. such as what OS are you using? Does it work with Pi 4? Would you mind telling us the order number?
 

Harry

32 months ago
Score 0  

Run the following command:


sudo apt-get -y install python-rpi.gpio python3-rpi.gpio
 

Anonymous user #3

40 months ago
Score 0  

Hi Geekworm!

Is there a way to shut down the X715 after the Pi shut down? (as the momentary switch has been removed, poweroff now needs to come after a safe shutdown of the Pi)
 

Lisa

40 months ago
Score 0  
Hi,sorry x715 canceled the safe shutdown function
 

Anonymous user #3

39 months ago
Score 0  

'm not akong for a safe shutdown of the Pi, I know you've removed that feature.

I want to shutdown the X715 with a script

- as I really really do not want two buttons for one machine [quote]


Hi,sorry x715 canceled the safe shutdown function [/quote]
 

Lisa

39 months ago
Score 0  
Sorry, the current version does not support safe shutdown through scripts
 

Anonymous user #1

41 months ago
Score 0  

Bonjour,

mon fan ne démarre pas après l'étape 1
 

Lisa

41 months ago
Score 0  
Hi,Have you successfully downloaded and installed the script? Are you using a Raspberry Pi system or another system? Could you please email to us and tell us more information? So that we can better understand the problem.and please tell us your order number,thanks~
 

Anonymous user #2

41 months ago
Score 0  

Bonjour, RPI 4 sous buster mis a jour, j'ai réussi a démarrer le fan en incluant "sudo rpigpiod" avant #python /home/pi/x715/pwm_fan_control.py le terminal ne me rend pas la main.

je suis obligé d'ouvrir un autre terminal pour la suite des commandes. cela doit bloquer le processus car au redémarrage le fan ne redémarre pas sans la commande "sudo rpigpiod"
 

Harry

41 months ago
Score 0  

Hi, the script be updated. thanks.

the python code need pigpiod library, so need to install firstly.

Regards,

Harry / Geekworm