• sales

    +86-0755-88291180

Raspberry Pi ------ 4.2 Control Fan User Guide

2-Control Fan

The Raspberry Pi RGB_Cooling_HAT needs to be properly plugged into the GPIO port of the Raspberry Pi and open the Raspberry Pi system I2C function.

This experimental phenomenon shows that after 2s, the fan speed is increased every second, next, it will run for 2 seconds with the highest speed, finally, it stops again and keep looping in this state.

1. File transfer

1.1 Install WinSCP tool on the computer side, connect the Raspberry Pi and transfer the temp_control.zip package to the pi directory of the Raspberry Pi.

Path of WinSCP:[Raspberry Pi RGB_Cooling_HAT]---[Tools]---[winscp556_setup.1416364912.exe]


1.2 Extract file

Open the Raspberry Pi terminal and input command ls to find the RGB_Cooling_HAT.zip file. 

As shown below:


Input command to extract file:

unzip RGB_Cooling_HAT.zip


2. Compiling and running program

2.1 Input command to enter temp_control find file:

cd RGB_Cooling_HAT/

ls


2.2 Input command to run the program

python fan.py


After 2s, the fan speed is increased every second, next, it will run for 2 seconds with the highest speed, finally, it stops again and keep looping in this state.

3. About code

3.1 Initialize the Raspberry Pi I2C configuration, import smbus module for I2C communication, import time for delay.


3.2 Cyclically control the fan speed, according to the agreement, we can know the fan speed level, 0x00 off, 0x01 full speed, 0x02: 20% speed, 0x03: 30% speed, ..., 0x09: 90% speed


3.3 Limit the state size, set to 0 when greater than 9 to achieve loop effect


TAG: NanoKVM-USB-Development DAPLINK Raspberry Pi 5 5V5A Power 1.28 inch Round Rotary LCD Smart Screen 1.28inch Knob Display 240x240 Option Touch/No-Touch Industrial RS232 to RS485 LuckFox SC3336 Raspberry Pi USB Camera 5MP OS05A10 Distortion-Free USB 2.0 For Jeston RDK NVIDIA Jetson Orin Nano Developer Kit Official Original 8GB AI 40Tops For Embedded and Edge Systems Raspberry Pi 1.3inch Jetson Nano Module Raspberry Pi Pico 1024×600 ESP32-S3 Development Board 1.85 inch Round LCD N16R8 DeepSeek AI Voice Chat Robot BOX Magnetic-charging Milk V Duo Raspberry Pi Pico Display 0.85inch Screen Raspberry Pi Pico Raspberry Pi 5 DSI display Industrial Modbus RTU RS485 8-ch 30A High Current Relay Module (E) With Digital Input ESP32 S3 4.3inch LCD (B) 800x480 Captive TouchScreen Display Board LVGL with Sensor CAN I2C RS485 MPS2280D Raspberry Pi 5 PCIe to M.2 NVMe Dual SSD Adapter Board HAT Pi5 Double 2280