PWM_FREQ = 25 # 25kHz for Noctua PWM control WAIT_TIME = 1 # Time to wait between each refresh More detail: Pulse-width modulationĪnd we can take a look at the control script: 1įAN_PIN = 18 # BCM pin used to drive PWM fan PWM uses square wave’s duty-cycle to reduce the average value of voltage, if the duty cycle is 50%, the fan will spin at 50% of it’s full speed duty cycle 75%, fan 75%, and so on. If you don’t want to know the theory part, than go ahead to: Reading RPM Signal The ‘&’ symbol means this script runs in background. Hardware PWM and the headphone jack use the same circuits, don’t use them at the smae time. I use GPIO18 which is the hardware PWM(12/13 and 18/19) and all other pins are software PWM. The control script is on: DriftKingTW/Raspberry-Pi-PWM-Fan-Control Set pin 1 to PWM mode (using wiring-pi pin number: Pi GPIO Pinout).Ĭheck the fan is working as you expect. The latest version when I write this post is 2.52 The Pi4 haven’t update to latest version of wiring-pi yet, need to update it manually. If you don’t want to test it, jump to Use PWM to Control Fan Speed. Here’s a photo testing hardware and program on Pi 3B.` (Need to cut out some fool-proof board to fit.) I use a Molex 2510 4PIN (2.54mm) connector to connect the fan. Most micro-controller or SBC already have a decent circuit to generate PWM signal, you don’t need special circuit to generate it. According to Ohm’s Law: $V=IR$, the resistor should be 660Ω or larger to protect your fan. The white paper says the maximum current is 5mA. The pull-up resistor that I use is 1kΩ 1/4W. Warning! The Pi has 3.3V GPIO, so your pull-up resistor must be connect to 3.3V ONLY! You will fry your Pi if Vcc is connected to 5V. The fan’s RPM signal is an OC(Open-Collector) circuit design (in most fan), so you’ll need a pull-up resistor to measure output waveform according to Noctua PWM white paper. If your fan doesn’t support PWM control, then you can see #138 Variable Speed Cooling Fan for Raspberry Pi using PWM and PID controller or PWM Regulated Fan Based on CPU Temperature for Raspberry Pi to use a BJT transistor to use PWM control. I use Noctua NF-A4 5V PWM, a 40mm, 5V PWM fan. In most case pi didn’t need that amount of cooling performance, so we can use PWM (Pulse Width Modulation) to control fan speed and reduce the noise. A lot of people uses fan to cool down their Raspberry Pi 4, but the fan’s noise is quiet problem (in a quiet room).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |