You are on page 1of 25

***

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY


SCHOOL OF ELECTRICAL ENGINEERING
----

EMBEDDED SYSTEM DESIGN


PROJECT REPORT
VERTICAL LANDING CONTROLLER
Instructor: MSc. Chu Đức Việt
Group: 4
Members: ID Number:
Bùi Hải Đăng 20173723
Đoàn Duy Thiêm 20176957
Lê Trung Đức 20176931
Bùi Đức Hiếu 20176937

Hanoi, 2021

1
Table of contents
Abstract............................................................................................................................................4
I. HARDWARE DESIGN...........................................................................................................4
1. Object Brief Description.......................................................................................................4
2. Concept design......................................................................................................................4
2.1 Design requirement............................................................................................................4
2.2 Block diagram....................................................................................................................5
3.Hardware design details............................................................................................................7
3.1 Battery circuit.....................................................................................................................7
3.2 Voltage regulator................................................................................................................9
3.3 Sensors..............................................................................................................................10
3.4 Driving Circuit.................................................................................................................15
3.5 MCU selection..................................................................................................................17
II. SOFTWARE DESIGN...........................................................................................................20
1. Finite State Machine...........................................................................................................20
2. Detailed software design........................................................................................................21
2.1 Main program...................................................................................................................21
2.2 Unit control.......................................................................................................................22
2.3 Motion control..................................................................................................................23
2.4 Other subroutines.............................................................................................................24
Conclusion.....................................................................................................................................24
References......................................................................................................................................25

2
List of figures
Figure 1: Design Concept................................................................................................................5
Figure 2: General block...................................................................................................................6
Figure 3: Component selection........................................................................................................7
Figure 4: Battery circuit Altium design...........................................................................................8
Figure 5: Voltage regulator Altium design....................................................................................10
Figure 6: LSM303CTR specifications...........................................................................................11
Figure 7: LPS22HB specifications................................................................................................12
Figure 8: L3GD20 specifications...................................................................................................13
Figure 9: Sensors Altium design....................................................................................................14
Figure 10: Servo driver Altium design..........................................................................................16
Figure 11: BLDC driver design.....................................................................................................17
Figure 12: STM32F411 Altium design..........................................................................................18
Figure 13: STM32F411 pin configuration.....................................................................................19
Figure 14: Finite state machine of Unit Control............................................................................20
Figure 15: Request Resolver..........................................................................................................21
Figure 16: Main program architecture...........................................................................................21

3
Abstract
Rocket is a system with multiple inputs and multiple outputs that has unstable dynamics, non-
linear, high order, and sensitive to external disturbances. In this project, we propose a design of a
controller which maneuvers the process of hovering, landing and take off vertically of a rocket.
This project was inspired by SpaceX Falcon 9 rocket.

I. HARDWARE DESIGN
1. Object Brief Description
Model of the rocket used as the objective in this project:
- Main thrust is generated by two co-axial propelled BLDC motors pointing downward,
each rotates at inversed directions to cancel angular momentum. The air thread is pushed
through 4 independent tail wings then the thrust vector is controlled by tunning these
wings by attached servos.
- On the top, 4 auxiliary brushless motors act as side thrusters, providing
the horizontall forces to help balancing the rocket.
- Battery provide energy for the whole system.
Our aim on this project is to design a controller for the above rocket model
which is capable to mimic the basic operations of SpaceX Falcon 9 including
these actions:
- Vertical take-off: The rocket can take off only by the motors in the
bottom. 4 motors on the top can support this action.
- Hovering: The main motors and 4 motors on the top need to run
properly to keep the rocket stable.
- Vertical landing (main goal): perform the re-entry process and land the
rocket gently even from the free fall state.
2. Concept design
2.1 Design requirement
a) Main thrust control:

- Control amplitude of thrust: by control speed of 2 mainBLDC (using external


ESC)
- Control vector of thrust: by control 4 tail fins using external servos
b) Side thrust control:
- Control amplitude of thrust: by control speed of 4 sided BLDC (using external 4X ESC)
- Control vector of thrust: by control 4 angle of sided BLDCs using external servos attached to
each BLDC’s pivot.

4
c) Input parameters:
-Acceleration: required to perform motion planning and free fall detection
-Height: required to determine position of the rocket on the air
-Coordinates: determine yaw, till, pitch of a flying vehicle.
d) Remote control:
- In order to receive commands from the station while flying, a radio-based communication is
required
e) Power supply
- Main power source is battery, secondary power source for other devices on board is regulated
from main battery.
-Battery management system
Function Design Requirement Hardware Requirement
-2 outputs for ESC (each up
2 BLDCs control to 30A)
Main thrust vectoring
4 tail wings control -4 outputs for servos

-1 output for 4X ESC


Side thrust controlling 4 side BLDCs control
-4 output for servos
Acceleration -Accelerometter sensor
Input parameters Height -Barometter sensor
Coordinate -Gyroscope sensor
Remote control Radio communication -LoRa
-Battery input -Switching converters
Power supply
-Battery mângement -Fuel gauge
Figure 1: Design Concept

2.2 Block diagram


a) Function Blocks
The concept design of the rocket contains 4 main function blocks: Power source, Driving,
Sensors and Communication.

5
Figure 2: General block

b) Components
Functions Requirements Components
- Small range: ±2g, ±4g
- I2C/SPI bus interface
Accelerometer LSM303C
- Voltage supply: 3.3VDC
- IC module
- Altitude resolution of 10cm
- I2C/SPI bus interface
Barometer LPS22HB
- Voltage supply: 3.3VDC
- IC module
Gyroscope - I2C/SPI bus interface L3GD20

6
- Voltage supply: 3.3VDC
- IC module
- SPI connection
LoRa - Voltage supply: 3.3VDC AIThinkerRA02
- IC module
- Voltage: 14.8VDC
- Thrust: 1000gf
2 main thrust BLDCs SunnySky X2216 Kv1100
- Amps: 14.2A
- Max. Speed: 15,000rpm
Propellers - Size: 9 inch Propeller APC 9047
- Current: 30A
- Protocol: Dshot600 with
ESCs for main thrust BLDCs KISS ESC 25A 2-5S
26.7us latency
- Individual ESC
- Voltage: 14.8VDC
4 side thrust BLDCs
- Thrust: 500gf SunnySky X2216 Kv880
- Max. Speed: 10000rpm
Propellers - Size: 4 inch Propeller APC 4x4.7 
Servo SG90
- Current: 30A
- Protocol: Dshot600 with
ESCs for side thrust BLDCs 26.7us latency 4-in-1 KISS ESC 25A 2-5S
- 4-in-1 ESC or 4 individual
ESCs
- Input voltage: battery voltage
Buck converter LM2596
- Output voltage: 12V
- Input voltage: battery voltage
Buck converter LM2596
- Output voltage: 3.3V
Battery - Max. current: 30A LiPo 4S 6C 5000mAh
Fuel guage - MAX17055
- Reversed battery protection
Battery protection circuit RBO08
- Overvoltage protection
Figure 3: Component selection

3.Hardware design details


3.1 Battery circuit
The system is powered by LiPo 4S 6C battery with capacity of 5000mAh. To protect against
battery reversal and overvoltages, RBO08 is used. RBO08 offers multiple functions in the same
package:
 8a diode to guard against battery reversal.
 Negative overvoltage protection by clamping.
 Compliant with iso/dtr 7637 standard for pulses 1, 2, 3a and 3b.
 Suitable for autoprotected alternator environment.
 Breakdown voltage : 24 v min.
 Clamping voltage : ± 40 v max.

7
 Monolithic structure for greater reliability.
To determine battery state-of-charge (SoC) and state-of-health, fuel gauge MAX17055 is used.
The MAX17055 will send signal to microcontroller through I2C wire. Microcontroller will know
the status of the battery and then have proper actions. The MAX17055 automatically
compensates for cell aging, temperature, and discharge rate. The device also provides an accurate
state-of-charge (SoC in %) and the remaining capacity in milliampere-hours (mAh).

Figure 4: Battery circuit Altium design

8
3.2 Voltage regulator
In this system, 14.8V input voltage is applied. However, some components only operates at
voltage of 3.3V (sensors, microprocessor, LoRa) and 12V (servos and servo drivers). Therefore,
buck converter is needed to step-down the input voltage to appropriate values.
The LM2596 used in this project provides all the active functions for a step-down (buck)
switching regulator:

 3.3-V, 5-V, 12-V, and adjustable output versions


 Adjustable version output voltage range: 1.2-V to 37-V ±4% maximum over line and
load conditions
 Available in TO-220 and TO-263 packages
 3-A output load current
 Input voltage range up to 40 V
 Requires only four external components
 Excellent line and load regulation specifications
 150-kHz Fixed-frequency internal oscillator
 TTL shutdown capability
 Low power standby mode, IQ, typically 80 µA
 High efficiency
 Uses readily available standard inductors
 Thermal shutdown and current-limit protection

9
Figure 5: Voltage regulator Altium design

3.3 Sensors
To control the rocket, the controller needs accurate information about the status of the rocket
such as altitude, acceleration, speed and angle between the rocket axis and vertical axis.
Therefore, accelerometer, barometer and gyroscope with high resolution and high speed is
needed in the system.
a) Accelerometter: LSM303CTR (ST Microelectonic)
Accelerometer will measure linear acceleration, inclination and vibration of the rocket. This
sensor communicates with MCU through I2C/SPI interface. The LSM303C is a system-in-
package featuring a 3D digital linear acceleration sensor and a 3D digital magnetic sensor. Some
key features of this sensor:
 Magnetic field channels and 3 acceleration channels
 ±16 gauss magnetic full scale
 ±2/±4/±8 g selectable acceleration full scale
 16-bit data output
 SPI / I2C serial interfaces
 Analog supply voltage 1.9V to 3.6V
 Power-down mode / low-power mode
 Programmable interrupt generators for free-fall, motion detection and magnetic field
detection
 Embedded temperature sensor

10
Figure 6: LSM303CTR specifications

b) Barometter: LPS22HB (ST Microelectronics)


A barometer will measure the air pressure and then convert to the altitude with respect to the
ground. The LPS22HB is an ultra-compact piezoresistive absolute pressure sensor which
functions as a digital output barometer.
 260 to 1260 hPa absolute pressure range
 Current consumption down to 3 μA
 High overpressure capability: 20x full-scale
 Embedded temperature compensation
 24-bit pressure data output
 16-bit temperature data output
 ODR from 1 Hz to 75 Hz
 SPI and I²C interfaces
 Embedded FIFO
 Interrupt functions: Data Ready, FIFO flags, pressure thresholds
 Supply voltage: 1.7 to 3.6 V
 High shock survivability: 22,000 g
 Small and thin package

11
Figure 7: LPS22HB specifications

c)Gyroscope: L3GD20 (ST Microelectronics)


A gyroscope is used for measuring or maintaining orientation and angular velocity of the
rocket. The L3GD20 is a low-power three-axis angular rate sensor with these key features:
 Three selectable full scales (250/500/2000 dps)
 I2C/SPI digital output interface
 16 bit-rate value data output
 8-bit temperature data output
 Two digital output lines (interrupt and data ready)
 Integrated low- and high-pass filters with user-selectable bandwidth
 Wide supply voltage: 2.4 V to 3.6 V
 Low voltage-compatible IOs (1.8 V)
 Embedded power-down and sleep mode
 Embedded temperature sensor
 Embedded FIFO
 High shock survivability
 Extended operating temperature range (-40 °C to +85 °C)

12
Figure 8: L3GD20 specifications

13
Figure 9: Sensors Altium design

14
3.4 Driving Circuit
The Driving block includes 2 separate operations: Servo driver and Thrust driver.
a) Servo Driver
There are 8 servos used in the project. Each is attached to a fin. The fins is constructed in
the top and at the bottom of the rocket. By rotating the fin through servo, the rocket can
change the direction and balance in the air.
Due to the fact that the number of servos is big, it is very hard to find a MCU with many
PWM signal outputs to drive those servos. To solve this problem, the DRV8860 is used.
The DRV8860 provides a 8-channel low-side driver with overcurrent protection and
open/shorted detection. A serial interface is provided to control the DRV8860 output
drivers, configure internal setting register and read the fault status of each channel.
DRV8860 will be daisy-chained with the MCU to use this serial interface in the project.
The 8 output of the DRV8860 will transmit PWM signals to drive 8 servos. PWM duty
cycles are configurable through serial interface as well.

15
Figure 10: Servo driver Altium design

b) Thrust Driver
The rocket needs 6 brushless DC motors to produce thrust. The 2 main thrust BLDCs are
constructed in the bottom of the rocket and the 4 side thrust BLDCs are located on the top
of the rocket. To control the speed of these BLDCs, 2 KISS ESCs 25A and a 4-in-1 KISS
ESC 25A are used. Operating voltages of these ESCs are 6-24V/2-5S LiPo, so the power
can be supplied by the LiPo battery used in the system.
6 PWM signals is needed from the MCU to the ESCs to control the speed of the BLDCs.

16
Figure 11: BLDC driver design

3.5 MCU selection


System requirement:
- Voltage operation: 3.3V
- Built in 4x SPI interface, 2x I2C interface 
- 6 high speed PWM signal ports
 Many microprocessors meet the requirement
 Selection: STM32F411
The STM32F411 devices carry 256 to 512 Kbytes of Flash and up to 128 Kbytes of SRAM.
The available packages range from 49 to 100 pins.
• 3x USARTs running at up to 12.5 Mbit/s,
• 5x SPI (muxed with I2S) running at up to 50 Mbit/s,
• 3x I²C up to 1Mbps
• 1x SDIO running at up to 48MHz and available on all packages,
• 1x USB 2.0 OTG full speed,
• 2x full duplex I²S up to 32-bit/192KHz,
• 3x simplex I²S up to 32-bit/192KHz,
• 12-bit ADC reaching 2.4 MSPS,

17
• 11 timers, 16- and 32-bit, running at up to 100 MHz

Figure 12: STM32F411 Altium design

18
Figure 13: STM32F411 pin configuration

19
II. SOFTWARE DESIGN
1. Finite State Machine

Figure 14: Finite state machine of Unit Control

20
Figure 15: Request Resolver

2. Detailed software design


2.1 Main program

Figure 16: Main program architecture

In the main program, unit control and request resolver are 2 indepentdent states then we design them as
polling data processing type so that each loop, requests are updated.
#
Define constants;
Initiate ISR(); \\ initiate interrupt which check if deflection
detected and then stablize the rocket
Main(){
Declare global variable();
While(1){
Request_Resolver();
Unit_control();
}
}

21
#

2.2 Unit control


#
Void unit_control(){
Switch(state)
Case on_air:

Case on_land:

22
}

2.3 Motion control


#
Void motion_control(){
Switch(air_State)
Case Going_up:

Case Going_down:

23
Case Hover:

2.4 Other subroutines


In the motion_control subroutine, three function F=P; F>P and F<P are related to the thrust manipulation
in order to perform motion control as same as each case. These functions and the ISR can be described
accurately if and only if the control model and algorithm is well-studied (which is very difficult at the
moment and our group have not complete it yet).

Conclusion
In this project, our group designed a flight controller for vertical landing rocket which capable of control
a rocket to perform simple tasks. Although the design is quite simple and may not work in reality, we
have try our best since this is a hard topic to deploy. However, we have gain knowledges about
Embedded control system designing process, and some details about synchronous communication method
including SPI and I2C and many other fields relating to the subject. We hope that in the future, this design
can be completed and our rocket could fly and land successfully.

24
References
[1] Datasheet of MEMS nano pressure sensor: 260-1260 hPa absolute digital output barometer:
LPS22HB, ST Microelectronics
[2] Datasheet of MEMS motion sensor: three-axis digital output gyroscope: L3GD20, ST
Microelectronics
[3] Datasheet of Ultra-compact high-performance eCompass module: 3D accelerometer and 3D
magnetometer: LSM303CTR, ST Microelectronics
[4] MB1115-F411VE-C01 Board Schematic 1.0, ST Microelectronics

25

You might also like