Can't get the fan program to operate correctly

March 26, 2023, 17:10

intentionallyblank_

I got this tower kit for my pi https://wiki.52pi.com/index.php?title=ZP-0130-4wire , and can not figure out why the fan is not operating correctly. Admittedly I know very little about programming or python for that matter. Before I even installed any of the software for the tower kit, the fan started working as soon as I started the Pi up. Following the instructions I created the file pwn_fan.py. When I execute the CLI just starts displaying the cpu temp refreshing every .1 sec, and I can only get it to stop by closing the shell window and relaunching. From what I understand, the script controls the fan through PWM so that depending on CPU temp it will vary the speed of the fan. Am I executing the program in the wrong place, is it bad code....or?

intentionallyblank_

I have that documentation, that's what I followed to build and install everything. When I execute that script it just starts running in the shell

andy_s

and did you connect it properly?

andy_s

<@1063234946057113761>

intentionallyblank_

I did

andy_s

so... that fan has 3 wires.

andy_s

where did you connect them?

intentionallyblank_

it has 4 wires. it connects to a header at the screen

intentionallyblank_


andy_s

oh

andy_s

it wants to use PWM.

andy_s

so you have to disable onboard analog audio

intentionallyblank_

ohhhhh ok, I had an issue with the fans rgb crashing on boot so I went into /boot/config.txt and commented #dtparam=audio=on and that fixed the fans crashing on start so I thought I would've been all set with my audio config.

intentionallyblank_

how do I disable onboard analog audio, is there another setting to edit in the config file? The only other info I have found regarding the topic says to blacklist the broadcom audio kernel module.

oops.se

With alsamixer can you choose audio output
alsamixer

oops.se

In Raspberry Pi 4 the BCM2711 has two PWM controllers, allowing one to be used for general PWM duties while the other is used for audio. PWM1 - is only available on GPIOs 40 & 41 PWM0 - is on all the other PWM pins - 12, 13, 18, 19, 45, 52 & 53. Raspberry Pi 4B drives the headphone (analog) output from GPIOs 40 & 41 (PWM1).