Electronics & Software

Electronics List

  • (4) 2200KV Brushless Outrunner Motor
  • (4) 30A Electronic Speed Controllers (ESC)
  • (1) Matek V3.1 Power Distribution Board (PDB)
  • (1) Tattu LiPo Battery Pack 2300mAh 11.1V 45C 3S
  • (1) Elegoo Uno R3 (Arduino) Board
  • (1) JoyStick 
  • (2) Potentiometer
  • (1) MPU 6050 3 Axis Accelerometer Gyroscope Module

Electronics Configuration










                                    Figure 1. Electronics Attached to Drone

The Elegoo Uno R3 board is programmed to function as the flight controller, with the MPU 6050 sensor connected directly to the board. To simplify the setup, all four Electronic Speed Controllers (ESCs) and the LiPo battery connection are soldered to the Power Distribution Board (PDB). Power is drawn from the PDB to power the boards.

The ESCs, which control the motor speed and power transfer, are connected directly to the motors. The speed of each motor is determined by the signal wires from the respective ESCs connected to the Arduino board. The motor's rotational direction is determined by the connection to the ESCs; to reverse the direction of rotation, simply flip any two connections to change the motor phase.


Figure 2. Drone Propeller Rotation Directions

To achieve lift-off, it is necessary for the two adjacent motors to rotate in opposite directions. Although a remote transmitter/receiver had been ordered for controlling the drone, the receiver component did not arrive in time for the demo deadline. As a result, a joystick was used instead, connected to the Arduino board via a long cable, to provide commands for roll and pitch. Similarly, potentiometers were connected to the Arduino board, with one controlling the thrust and the other controlling the yaw.

Figure 3. Drone Orientation

Software

Regarding the software, we started with an Arduino code package [1] and ran the ESC calibration routine without significant modifications. We simplified the code used to control the drone considerably. Essentially, the code identifies the pins corresponding to the inputs/outputs, calibrates the MPU 6050 sensor based on the drone's initial configuration, converts sensor readings into positional information (roll, pitch, and yaw), determines motor speed commands based on inputs received, computes corrections to inputs with PID controllers (roll, pitch, and yaw), adjusts motor speed commands based on error corrections, and sends the motor commands to the ESCs.

The original code used input durations to determine the strength of inputs and, consequently, motor speeds. We modified the code to map joystick and potentiometer positions directly to motor speeds, removing some of the elegance from the code in favor of a simpler mapping. We also modified the arm/disarm logic of the code to work with the roll and pitch inputs associated with the joystick. However, we left alone the portion that computes and translates sensor readings and the PID portion that computes error adjustments. Unfortunately, we were unable to tune the PID gains due to the prototype's structural instability, but telemetry confirmed that the error adjustments made were in the correct directions (but with incorrect magnitude).

To roll the drone, the two motors on the left or right of the axis must spin faster than the two on the opposite side. To pitch the drone, the same concept applies, with the two rear or front motors spinning faster than the opposing pair. To yaw the aircraft, the two motors spinning CCW must spin faster than the two spinning CW, or vice versa, depending on the desired yaw direction.

References: 

[1] https://github.com/lobodol Retrieved [4/18/2023]