Ask Văn bằng liên kết một kênh với GA

cựcđoan

New member
#pid #Arduino #pid-controller #throttle #pid-tuning ## Cách liên kết kênh PID với van tiết lưu trên Arduino

Bộ điều khiển PID được sử dụng để điều chỉnh tốc độ của động cơ bằng cách liên tục so sánh tốc độ mong muốn với tốc độ thực tế và điều chỉnh đầu ra của động cơ cho phù hợp.Đ ga là một chiết áp điều khiển lượng điện được gửi đến động cơ.Bằng cách liên kết kênh PID với ga, bạn có thể tạo một hệ thống tự động điều chỉnh tốc độ của động cơ để duy trì tốc độ mong muốn.

Để liên kết kênh PID với ga, bạn sẽ cần:

1. Kết nối ga với Arduino.
2. Tạo một vòng điều khiển PID.
3. Ánh xạ giá trị bướm ga cho đầu ra PID.

** Kết nối ga với Arduino **

Đ ga là một chiết áp, là một điện trở thay đổi.Điện trở của chiết áp thay đổi khi bạn xoay núm, từ đó thay đổi đầu ra điện áp.Bạn có thể kết nối ga với Arduino bằng các chân sau:

*** VCC: ** Kết nối điện áp dương (5V) từ Arduino với chân VCC của chiết áp.
*** GND: ** Kết nối mặt đất (GND) từ Arduino với pin GND của chiết áp.
*** Sig: ** Kết nối chân sig trên chiết áp với chân đầu vào tương tự trên arduino.

** Tạo vòng điều khiển PID **

Vòng điều khiển PID là một vòng phản hồi sử dụng bộ điều khiển tỷ lệ, tích phân và phái sinh (PID) để điều chỉnh tốc độ của động cơ.Bộ điều khiển PID liên tục so sánh tốc độ mong muốn với tốc độ thực tế và điều chỉnh đầu ra của động cơ cho phù hợp.

Để tạo vòng điều khiển PID trên Arduino, bạn sẽ cần:

1. Xác định các hằng số PID.
2. Khởi tạo bộ điều khiển PID.
3. Cập nhật bộ điều khiển PID.
4. Tính đầu ra PID.

** Xác định hằng số PID **

Các hằng số PID là các giá trị kiểm soát tính hung hăng của bộ điều khiển PID.Sau đây là ba hằng số PID:

*** Hằng số tỷ lệ (KP) **: Hằng số này xác định số lượng bộ điều khiển PID sẽ điều chỉnh đầu ra của động cơ cho mỗi thay đổi trong lỗi.
*** Hằng số tích phân (KI) **: Hằng số này xác định số lượng bộ điều khiển PID sẽ tính đến các lỗi trước đó.
*** Hằng số dẫn xuất (KD) **: Hằng số này xác định số lượng bộ điều khiển PID sẽ tính đến tốc độ thay đổi lỗi.

Các giá trị của các hằng số PID sẽ cần được điều chỉnh để có kết quả tốt nhất.Bạn có thể tìm thêm thông tin về điều chỉnh PID trong tài liệu Arduino.

** Khởi tạo bộ điều khiển PID **

Khi bạn đã xác định các hằng số PID, bạn có thể khởi tạo bộ điều khiển PID.Để làm điều này, bạn sẽ cần gọi hàm `pid ()`.Hàm `pid ()` có các tham số sau:

* `Kp`: hằng số tỷ lệ.
* `Ki`: Hằng số tích phân.
* `KD`: Hằng số phái sinh.
* `Setpoint`: tốc độ mong muốn của động cơ.
* `Input`: Tốc độ thực tế của động cơ.
* `Đầu ra`: Đầu ra của bộ điều khiển PID.

** Cập nhật bộ điều khiển PID **

Bộ điều khiển PID cần được cập nhật thường xuyên để giữ tốc độ của động cơ ở tốc độ mong muốn.Để cập nhật bộ điều khiển PID, bạn sẽ cần gọi chức năng `ending ()`.Hàm `apped ()` mất các tham số sau:

* `Input`: Tốc độ thực tế của động cơ.

** Tính đầu ra PID **

Bộ điều khiển PID sẽ xuất ra giá trị từ 0 đến 255. Giá trị này biểu thị lượng công suất nên được gửi đến động cơ.Để tính toán đầu ra PID, bạn sẽ cần gọi hàm `compute ()`.Hàm `compute ()` lấy các tham số sau:

* `Đầu ra`: Đầu ra của bộ điều khiển PID.

** Ánh xạ giá trị ga cho đầu ra PID **

Giá trị bướm ga là một số từ 0 đến 1023. Giá trị này biểu thị lượng công suất nên được gửi đến động cơ.Bạn có thể ánh xạ giá trị bướm ga cho đầu ra PID bằng phương trình sau:

`` `
Pid_output = van tiết lưu_value * 255
=======================================
#pid #Arduino #pid-controller #throttle #pid-tuning ## How to Link a PID Channel with Throttle on Arduino

PID controllers are used to regulate the speed of a motor by continuously comparing the desired speed to the actual speed and adjusting the motor's output accordingly. The throttle is a potentiometer that controls the amount of power sent to the motor. By linking the PID channel with the throttle, you can create a system that automatically adjusts the motor's speed to maintain the desired speed.

To link the PID channel with the throttle, you will need to:

1. Connect the throttle to the Arduino.
2. Create a PID control loop.
3. Map the throttle value to the PID output.

**Connecting the Throttle to the Arduino**

The throttle is a potentiometer, which is a variable resistor. The resistance of the potentiometer changes as you turn the knob, which in turn changes the voltage output. You can connect the throttle to the Arduino using the following pins:

* **VCC:** Connect the positive voltage (5V) from the Arduino to the potentiometer's VCC pin.
* **GND:** Connect the ground (GND) from the Arduino to the potentiometer's GND pin.
* **SIG:** Connect the SIG pin on the potentiometer to an analog input pin on the Arduino.

**Creating a PID Control Loop**

A PID control loop is a feedback loop that uses a proportional, integral, and derivative (PID) controller to regulate the speed of a motor. The PID controller continuously compares the desired speed to the actual speed and adjusts the motor's output accordingly.

To create a PID control loop on the Arduino, you will need to:

1. Define the PID constants.
2. Initialize the PID controller.
3. Update the PID controller.
4. Calculate the PID output.

**Defining the PID Constants**

The PID constants are the values that control the aggressiveness of the PID controller. The following are the three PID constants:

* **Proportional constant (Kp)**: This constant determines how much the PID controller will adjust the motor's output for each change in the error.
* **Integral constant (Ki)**: This constant determines how much the PID controller will take into account the previous errors.
* **Derivative constant (Kd)**: This constant determines how much the PID controller will take into account the rate of change of the error.

The values of the PID constants will need to be tuned to get the best results. You can find more information on PID tuning in the Arduino documentation.

**Initializing the PID Controller**

Once you have defined the PID constants, you can initialize the PID controller. To do this, you will need to call the `PID()` function. The `PID()` function takes the following parameters:

* `Kp`: The proportional constant.
* `Ki`: The integral constant.
* `Kd`: The derivative constant.
* `Setpoint`: The desired speed of the motor.
* `Input`: The actual speed of the motor.
* `Output`: The output of the PID controller.

**Updating the PID Controller**

The PID controller needs to be updated regularly to keep the motor's speed at the desired speed. To update the PID controller, you will need to call the `update()` function. The `update()` function takes the following parameters:

* `Input`: The actual speed of the motor.

**Calculating the PID Output**

The PID controller will output a value between 0 and 255. This value represents the amount of power that should be sent to the motor. To calculate the PID output, you will need to call the `compute()` function. The `compute()` function takes the following parameters:

* `Output`: The output of the PID controller.

**Mapping the Throttle Value to the PID Output**

The throttle value is a number between 0 and 1023. This value represents the amount of power that should be sent to the motor. You can map the throttle value to the PID output using the following equation:

```
PID_output = throttle_value * 255
 
Join ToolsKiemTrieuDoGroup
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock