The Importance of Motor Direction

In order to stop our drone spinning like a top, it is important that the four motors turn in a particular direction. As shown in figure 1, we want the motors to alternate spinning clock wise and counter clockwise. This arrangement causes the torque from the spinning motors to cancel out and the quad only yaws when we want it to.

Figure 1. Required Motor Directions for the Magpie Drone.

We wired up all our motors to the RacerStar Quad ESC in the same way as we assumed that the default arrangement would give us the correct spin direction. It doesn’t. Two diagonally opposed motors are spinning in the…


What’s Next?

In Part 3 of our series on writing your own flight controller software, we looked at PID control and what that consists of. When writing complex software, it is usually easier to break it down into smaller parts which you can test independantly. Our path to functioning flight control firmware on an Arduino looks like this:

  1. Pilot input (i.e. decoding SBUS);
  2. Gyroscope output;
  3. PID control loops; and
  4. Motor mixing and motor output.

Our next challenge is part 3, feeding the error signal e(t) for roll and pitch into our PID loop and then outputting a corresponding PWM control signal to…


The PID Loop

In Part 1 of our series we spoke about the flight controller PID Loop. It is worth revisting that now (see Figure 1). In previous parts we have spoken about how we decode the remote control input, r(t), and how we generate our PWM control for the ESC, u(t). In Part 3, we will look at the roll, pitch and yaw inputs from the IMU and combining that with r(t) to get our error signal , e(t), which is fed into our PID loop. …


For the Arduino Portenta H7.

The Story So Far…

Figure 1. The initial prototype of the Nexgen Drone.

As described in Part 1 of our series, we are designing a drone using the new Arduino Portenta H7 as a flight controller. Our intention is to port BetaFlight across to the STM32H747 microprocessor as the flight controller firmware.

We have modified the BetaFlight firmware so that it compiles for the H7. The next step is to load the firmware into memory and tell the processor where the first instruction is located.


Overview

In this tutorial we will modify the BetaFlight source code to create a new hardware flight controller target. We want to add the Arduino Portenta H7 to the list of valid hardware targets. The Portenta uses the STM32H747XI dual Cortex®-M7+M4 32bit low power ARM MCU. This is quite a mouthful!

Despite their being two cores on the Portenta chip, at this stage we will only be looking at using one, the M7.

BetaFlight

Betaflight is flight controller software (firmware) used to fly multi-rotor and fixed wing craft. It is forked from Baseflight and Cleanflight and focuses on flight performance, leading-edge feature…


3D Print the Drone Air Frame

The DS3 variant of our Magpie air frame is a simple 220 mm Quad. The prototype drone airframe was the Martian II as described in Part 1 of this series. The Martian II is constructed of carbon fibre, which is strong, less flexible but heavier than the PLA that we are using to 3D print our design. For example the arms, bottom deck and power distribution board mount weighs 81g in carbon fibre compared with the PLA equivalents which are 42g. Our components are a similar thickness to the Martian II bits except the flight deck, which is 1mm thicker.

Figure 1. Bottom Deck and Arm Construction.


What is RSSI??

RSSI (Received Signal Strength Indication) is a measure of the signal strength between the Radio Control transmitter (Figure 1) and the receiver on your drone. The unit for RSSI is decibels (dB), these are used to quantify the power of an electrical signal. The signal strength of your radio control signal becomes very important when you are about to go out of receiver range!

Figure 1. Taranis Q X7 Radio Control Transmitter.

As part of our drone development project we need to interface with the radio control transceiver. We are using the FrySKY X8R for our prototype and you might expect it would use a simple industry standard…


Introduction

Figure 1. 3D Rendering of the Magpie Drone PDB PCB.

The Nexgen team is designing their own drone to be used for school incursion courses with a duration of 1–3 days. The drone will be controlled by an Arduino Nano 33 BLE or an Arduino Portenta H7 (i.e. the Mbed OS based Arduino cores).

There is some additional hardware and interfacing requirements which we have spoken about in part 2 of our article on Writing your own Flight Controller Software. Our Power Distribution Board (PDB), makes it easy to include these in our drone build. Note that there are two different PDB’s for the Nano 33 BLE and the Portenta…


Adding some necessary hardware…

A Diversion down Hardware Lane

Before proceeding with the flight controller software, we need to sort out a couple of hardware issues. These are, controlling a buzzer (i.e. a passive piezo) and understanding remote control inputs via SBUS.

Figure 1. 3–30V Passive Piezo.

The Buzzer Issue

Why can’t we just connect a piezo to a pin on our Nano and use PWM to create a tone? I’m glad you asked! The biggest problem is current limits on the I/O pins. If you have a look at the pinout information for the Nano 33 IoT, you will see that the maximum current per pin is 7mA. …


Why would You?

It is a reasonable question. There are a number of Open Source and proprietary quadcopter flight controllers with firmware available. The problem is we want to use an Arduino board, to fit in with our other training programs. As soon as this becomes a constraint your options are very limited. In fact, your only real option is to write your own. So here we are.

Initially we attempted to port BetaFlight across to the Arduino Portenta H7, as this is designed for STM32 hardware and we know that writing your own flight controller firmware is tough and time consuming. We…

David Such

Reefwing Software · iOS & Android Development · Robotics · #followback #iOS #Android #developer #indiedev #robotics #startup #arduino #raspberrypi

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store