Skip to content

RISCV based quadcopter experiment

RISCV-based quadcopter experiment

Project name:Hummingbird-based quadcopter experiment

Project Description:This project is based on perf_v development board (Hummingbird core) to realize the design of quadcopter flight control board, using pid algorithm to adjust attitude control, mainly using spi, iic, pwm and other peripherals.

First, Introduction of quadcopter

1、quadcopter hardware structure: quadcopter hardware mainly includes frame, motor, ESC, propeller, main control board, attitude sensor module (mainly including gyroscope, accelerometer), battery, power supply board, remote control and receiver, charger, etc.

2、 Software structure of quadcopter: The software of quadcopter depends on the flight control board and rocker. The controller mainly plays the role of control, communication and so on. The flight control board of the aircraft needs to complete the control, measurement, communication and other tasks. The basic programs that need to be written for the flight control board include driver, control program, and communication program. The driver is mainly some drivers on the bottom of the control board, including drivers for driving motors and other peripherals; the control program is the core program of the whole system, mainly including attitude control, altitude control, etc.; the communication program mainly includes the communication between the flight control board and the rocker, etc.

3、The realization principle of quadcopter

The quadcopter is a vehicle that flies in the air. In order to get cheap power, it can only use air power, and cannot fly like a rocket. Therefore, the power and yaw action of quadcopter can only rely on the action with the air to achieve. The following figure is a simplified diagram of the mechanics of the quadcopter.

The size of F1, F2, F3 and F4 in the above diagram is determined by the rotational speed of the paddles. The greater the rotational speed, the greater the force, and the smaller the rotational speed, the smaller the force. In this way, the forward, backward, steering (yaw) and rotation of the quadcopter can be achieved by controlling the change of the four forces.

Second, PID algorithm introduction

PID is a closed-loop control system.

PID control is based on proportional control; integral control can eliminate steady-state error, but may increase overshoot; differential control can speed up the response of large inertia system as well as attenuate the tendency of overshoot.

PID controller is based on the error of the system (current error and desired error), the use of proportional, integral, differential calculation of the control amount of control.

Proportional P control is one of the simplest forms of control. The output of its controller is proportional to the input error signal. When only proportional control is available the system output has a steady-state error.

In integral I control; the output of the controller is proportional to the integral of the input error signal. For an automatic control system, if there is a steady-state error after entering the steady state, the control system is said to be with steady-state error or referred to as a system with difference. In order to eliminate the steady-state error, an "integration term" must be introduced in the controller. The integral term depends on the integration of the error over time, and increases with time.

Thus, even if the error is small, the integral term will increase with time, which drives the output of the controller to increase so that the steady-state error is further reduced until it equals zero. The proportional + integral (PI) controller, therefore, allows the system to enter the steady state without steady-state error.

In differential D control, the output of the controller is proportional to the differential of the input error signal (i.e., the rate of change of the error). The automatic control system may oscillate or even become unstable during the regulation process to overcome the error. The reason for this is due to the presence of a large inertia component (link) or a hysteresis (delay) component, which has the effect of suppressing the error, and whose change always lags behind the change of the error. The solution is to make the change of the role of error suppression "ahead", the role of the proportional term is only to amplify the magnitude of the error, and the current need to increase the "differential term", which can predict the trend of error changes, so as to avoid a serious overshoot of the controlled amount.

Third. gyroscope mpu6050

The mpu6050 integrates a 3-axis MEMS gyroscope and a 3-axis MEMS accelerometer. Three 16-bit ADCs are used for the gyroscope and the accelerometer respectively to convert their measured analog quantities into output digital quantities. The data after attitude resolution is output to the application side through the main IIC interface.

IV. NRF24L01

NRF24L01 is a monolithic wireless transceiver chip operating in the 2.4~2.5GHz world-wide ISM band. The output power, channel selection and protocol settings can be set via SPI interface. Point-to-point or 1-to-6 wireless communication is possible. Wireless communication speed can reach up to 2Mbps.