Introduction: Quadcopter Using Zybo Zynq-7000 Board

Before we get started, here are some things you want for the project:

Parts List

1x Digilent Zybo Zynq-7000 board

1x Quadcopter Frame able to mount Zybo (Adobe Illustrator file for lasercutting attached)

4x Turnigy D3530/14 1100KV Brushless Motors

4x Turnigy ESC Basic-18A Speed Controller

4x Propellers(these need to be big enough to lift your quadcopter)

2x nRF24L01+ transceiver

1x IMU BNO055

Software Requirements

Xilinx Vivado 2016.2

NOTE: The motors above are not the only motors that can be used. They are just the ones used in this project. Same goes for the rest of the parts and software requirements. Hopefully, that is an unspoken understanding when reading this Instructable.

Step 1: Get the PWM Module Running



Program a simple SystemVerilog (or other HDL program) to register HI throttle and LO throttle using input switches.

Hook the PWM with a single ESC and Turnigy Brushless Motor. Check the following files to find out how to calibrate the ESC.



The final code is attached in step 5 for the PWM module.

A PWM starter is attached in this step

ESC Datasheet: Turnigy ESC Datasheet PDF (Things to pay attention to are the different modes you can select using HI and LO throttle)

Attachments

Step 2: Set Up the Block Design

Create Block Design

Double click the newly generated block

Import XPS settings downloaded here: https://github.com/ucb-bar/fpga-zynq/tree/master/z...

Modify settings

PS-PL Configuration

M AXI GP0 interface

Peripheral I/O Pins

Ethernet 0

USB 0

SD 0

SPI 1

UART 1

I2C 0

TTC0

SWDT

GPI MIO

MIO Configuration

Timer 0

Watchdog

Clock Configuration

FCLK_CLK0 and set frequency to 100 MHz

Make I2C and SPI external

Connect FCLK_CLK0 to M_AXI_GP0_ACLK

Run block automation

Create Port and call it "gnd"



Step 3: Calibrate the IMU

The BNO055 transceiver uses I2C communication. (Beginner's Suggested Reading: https://learn.sparkfun.com/tutorials/i2c)

The driver to run the IMU is located here: https://github.com/BoschSensortec/BNO055_driver

A quadcopter does not require use of the magnetometer from the BNO055. Because of this, the operation mode necessary is the IMU mode. This is changed by writing a binary number xxxx1000 to the OPR_MODE register, where 'x' is a 'don't care'. Set those bits to 0.

Step 4: Integrate the Wireless Transceiver

The wireless transceiver uses SPI communication. Attached is the specification sheet for the nRF24L01+

A good tutorial on the nrf24l01+ but with arduino: https://arduino-info.wikispaces.com/Nrf24L01-2.4GH...

Step 5: Program the Zybo FPGA

Overview

These modules are the final modules used for the control of the quadcopter's PWM.

motor_ctl_wrapper.sv

Purpose: The wrapper takes in Euler angles and a throttle percentage. It outputs a compensated PWM that will allow the quadcopter to stabilize. This block exists, because quadcopters are prone to disturbances in the air and require some sort of stabilization. We are using Euler angles, as we don't plan on flips or heavy angles which might cause Gimbal Lock.

Input: 25-bit bus of data CTL_IN = { [24] GO, [23:16] Euler X, [15:8] Euler Y, [7:0] Throttle Percentage }, Clock (clk), Synchronous CLR (sclr)

Output: Motor 1 PWM, Motor 2 PWM, Motor 3 PWM, Motor 4 PWM, Throttle Percentage PWM The Throttle Percentage PWM is used for initializing the ESC, which will want a pure 30% - 70% range of PWM, not the one from the Motor 1-4 PWM values.

Advanced - Vivado Zynq IP Blocks:

8 Adds (LUTs)

3 Subtracts (LUTs)

5 Multipliers (Block Memory (BRAM))

clock_div.sv (AKA pwm_fsm.sv)

Purpose: Control the hardware, including the MUX, PWM output, and sclr for motor_ctl_wrapper. Any Finite State Machine (FSM) is used for one thing: control other hardware. Any large deviation from this objective can cause the supposed FSM to take the form of a different type of module (counter, adder, etc.).

pwm_fsm has 3 states: INIT, CLR, and FLY

INIT: Allow the user to program the ESC as desired. Sends a select signal to mux_pwm that outputs straight PWM to all motors. Loops back to itself until GO == '1'.

CLR: Clear data in motor_ctl_wrapper and the pwm out module.

FLY: Loop forever to stabilizing the quadcopter (unless we are reset). Sends the compensated PWM through the mux_pwm.

Input: GO, RESET, clk

Output: RST for other module resets, FullFlight to signal FLY mode, Period to run at

mux_pwm.sv

Purpose:

Input:

Output: PWM for all 4 motors

pwm.sv

Purpose:

Input:

Output: