Skip to content

Latest commit

 

History

History
213 lines (171 loc) · 8.86 KB

README_EN.md

File metadata and controls

213 lines (171 loc) · 8.86 KB

Quadcopter

README English | 中文

Introduction

MIT platform

This is an Integrated Course Design of School of Information and Software Engineering of UESTC: Quadcopter Based on STM32F401RE. It contains:

  • Extending attitude sensor module on STM32 board to determine the flying attitude of quadcopter

  • Complete the task of attitude calculation on STM32 board after the data from attitude sensor module are collected

  • Through the PID control and PWM motor speed regulation on STM32, the quadcopter can maintain stable flight by adjusting the speed of the propeller, and constantly adjust to achieve stability, as shown in the figure.

Hardware Requirement

Components Type and Parameters
Quadcopter Rack F450 (Propeller pitch is 450mm)
Brushless Motor Hobbywing Skywalker-20A
Motor A2212/13T (1000KV)
Propeller Gemfan 1045 (Diameter is 10 inches; Blade angle is 45°)
Battery ACE 2200mAh 25C lithium-polymer battery
Development Board STM32F401RE (Up to 84MHZ)
Accelerometer & Gyroscope MPU6050 (Integrated in GY-86/MPU-9150)
Magnetometer HMC5883L(Integrated in GY-86) or AK8975(Integrated in MPU-9150)
Remote Controller RadioLink T4EU-6 2.4G six-channels remote controller
Remote Receiver RadioLink R7EH-S 2.4G six-channels remote receiver
Bluetooth HM-10 * 2
Expansion Board Design and draw using Altium Desogner

Software Requirement

Operating System: Windows or Linux

IDE: Keil v5

Compiler" ARM Compiler(Integrated in Keil uVision) or gcc-arm-none-eabi(Linux)

Project Structure

├── docs
│   ├── 电压分配.txt
│   ├── 引脚配置.txt
│   └── 九轴数据变化.txt
├── PCB
│   ├── IntLib
│   └── PCB
│       ├── pcb.PcbDoc  //PCB file
│       ├── PCB_Project.PrjPcb  //AD project file
│       └── pcb.SchDoc  //schematic diagram file
└── Project
    ├── APP  // user file
    │   ├── app_cfg.h  //selecting compiler options & APP_FUNC switch
    │   ├── includes.h  //head files set, see Development instructions
    │   ├── main.c  //main file
    │   ├── os_cfg.h  //ucosii module switch
    │   └── RTE_Components.h  //STM32 standard lib switch
    ├── APP_FUNC  //user lib
    │   ├── delay.c  //different from OSTimeDly()
    │   ├── delay.h
    │   ├── gpio.c
    │   ├── gpio.h
    │   ├── iic.c
    │   ├── iic.h
    │   ├── IMU.c  //attitude calculation
    │   ├── IMU.h
    │   ├── led.c
    │   ├── led.h
    │   ├── MPU9150.c  //GY-86、MPU9150
    │   ├── MPU9150.h
    │   ├── nvic.c
    │   ├── nvic.h
    │   ├── pid.c  //PID algorithm
    │   ├── pid.h
    │   ├── pwm.c
    │   ├── pwm.h
    │   ├── pwm_led.c
    │   ├── pwm_led.h
    │   ├── tim_led.c
    │   ├── tim_led.h
    │   ├── usart.c
    │   └── usart.h
    ├── BSP_SELF  //hardware related, need modify
    │   ├── BSP.c  //bsp init, including Systick interrupt config
    │   ├── BSP.h
    │   ├── startup_stm32f401xx.s  //startup file, had modified PendSV interrupt
    │   ├── stm32f4xx_it.c  //about interrupt
    │   ├── stm32f4xx_it.h
    │   ├── system_stm32f4xx.c  //Sysclock config
    │   └── system_stm32f4xx.h
    ├── BSP_SYS  //hardware related, don`t need modify
    │   ├── core_cm4.h
    │   ├── core_cm4_simd.h
    │   ├── core_cmFunc.h
    │   ├── core_cmInstr.h
    │   ├── stm32f4xx_conf.h
    │   ├── stm32f4xx.h
    │   ├── system_stm32f4xx.c
    │   └── system_stm32f4xx.h
    ├── CLIB  //C language lib
    ├── STLIB  //STM32 standard lib
    ├── UCOS_PORT  //ucosii hardware related
    │   ├── os_cpu_a.s
    │   ├── os_cpu_c.c
    │   ├── os_cpu.h
    │   └── os_dbg.c
    └── UCOS_SOURCE  //ucosii module
        ├── os_core.c
        ├── os_core.h
        ├── os_flag.c
        ├── os_mbox.c
        ├── os_mem.c
        ├── os_mutex.c
        ├── os_q.c
        ├── os_sem.c
        ├── os_task.c
        ├── os_time.c
        ├── os_tmr.c
        ├── ucos_ii.c
        └── ucos_ii.h

Development Instructions

Head files relationship:

includes.h
├── BSP.h
├── core_cm4.h
├── stm32f4xx.h
│   └── stm32f4xx_conf.h
│       └── RTE_Components.h  //standard lib switch
│           ├── stm32f4xx_gpio.h
│           ├── ......
│           └── stm32f4xx_rcc.h
└── ucosii.h
    ├── app_cfg.h  //user file switch
    │   ├── gpio.h
    │   ├── ......
    │   └── pid.h
    └── os_cfg.h

Attention! There a piece of code in "stm32f4xx.h"

#ifdef USE_STDPERIPH_DRIVER
    #includes "stm32f4xx_conf.h"
#endif

That means you should define USE_STDPERIPH_DRIVER to include stm32f4xx_conf.h.

If you want to add file in APP_FUNC folder, your code style should look like this and turn on the corresponding switch in app_cfg.h:

//xx.h
#ifndef XX_H
#define XX_H
#includes "includes.h"
//#includes "math.h"  
//C lib file should be added separately, if you need

......

#endif
//xx.c
#includes "xx.h"

......

Get Started

  • Windows (Keil uVision has been installed)

    1. Open Project/exp4.uvprojx

    2. Click button Build

    3. Click button DownLoad to burn

  • Linux (gcc-arm-none-eabi and st-flash have been installed)(Coming soon)

    1. Execute make instruction

    2. Execute make burn instruction to burn

Acknowledgement

LIAO Yong, Alron

Contact

jianshu QQ wechat twitter

About

My learning process is recorded on Wiki.