Có ai biết cài gì cho Debian để lập trình điều khiển chân GPIO ko ạ. Mình đang tính gắn quạt chỉ...

dinhtuan2580

New member
** Cách lập trình điều khiển quạt GPIO trên Debian cho OPI One Plus **

Nếu OPI One của bạn đang chạy nóng, bạn có thể sử dụng điều khiển quạt GPIO để tự động bật quạt khi nhiệt độ CPU đạt đến một ngưỡng nhất định.Điều này sẽ giúp giữ cho thiết bị của bạn mát mẻ và ngăn không cho nó quá nóng.

Để lập trình điều khiển quạt GPIO trên Debian, bạn sẽ cần cài đặt các gói sau:

* `gpiod`
* `sysfsutils`

Khi bạn đã cài đặt các gói yêu cầu, bạn có thể làm theo các bước này để lập trình điều khiển quạt GPIO:

1. Mở một cửa sổ thiết bị đầu cuối.
2. Chạy lệnh sau để tạo một tệp mới có tên `99-fan.rules`:

`` `
sudo touch /etc/udev/rules.d/99-fan.rules
`` `

3. Mở tệp `99-fan.rules` trong trình chỉnh sửa văn bản.
4. Thêm các dòng sau vào tệp:

`` `
Hệ thống con == "gpio", kernel == "gpiochip*", attr {gpio_line} == "23", attr {hướng} == "out", chạy+= "/bin/sh -c 'echo 1>/sys/class/gpio/gpio23/value '"
`` `

5. Lưu tệp và đóng Trình chỉnh sửa văn bản.
6. Chạy lệnh sau để tải lại các quy tắc UDEV:

`` `
điều khiển sudo udevadm--reload-RULES
`` `

7. Khởi động lại thiết bị của bạn.

Bây giờ, khi nhiệt độ CPU đạt đến một ngưỡng nhất định, quạt GPIO sẽ tự động bật.Bạn có thể điều chỉnh ngưỡng bằng cách chỉnh sửa tệp `99-fan.rules`.

** Mẹo thưởng: ** Nếu bạn muốn điều khiển tốc độ quạt, bạn có thể sử dụng tiện ích `pwm`.Để tìm hiểu thêm, hãy xem [Tài liệu PWM] (https://www.kernel.org/doc/documentation/pwm/pwm-sysfs.txt).
=======================================
**How to Program GPIO Fan Control on Debian for OPI One Plus**

If your OPI One Plus is running hot, you can use GPIO fan control to automatically turn on the fan when the CPU temperature reaches a certain threshold. This will help to keep your device cool and prevent it from overheating.

To program GPIO fan control on Debian, you will need to install the following packages:

* `gpiod`
* `sysfsutils`

Once you have installed the required packages, you can follow these steps to program the GPIO fan control:

1. Open a terminal window.
2. Run the following command to create a new file called `99-fan.rules`:

```
sudo touch /etc/udev/rules.d/99-fan.rules
```

3. Open the `99-fan.rules` file in a text editor.
4. Add the following lines to the file:

```
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ATTR{gpio_line}=="23", ATTR{direction}=="out", RUN+="/bin/sh -c 'echo 1 > /sys/class/gpio/gpio23/value'"
```

5. Save the file and close the text editor.
6. Run the following command to reload the udev rules:

```
sudo udevadm control --reload-rules
```

7. Reboot your device.

Now, when the CPU temperature reaches a certain threshold, the GPIO fan will automatically turn on. You can adjust the threshold by editing the `99-fan.rules` file.

**Bonus tip:** If you want to control the fan speed, you can use the `pwm` utility. To learn more, see the [pwm documentation](https://www.kernel.org/doc/Documentation/pwm/pwm-sysfs.txt).
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top